osa_toolkit/filesystem.py
def load_inventory(preferred_path=None, default_inv=None, filename=None):
    """Create an inventory dictionary.

       Create inventory dictionary from the given source file or a default
       inventory. If an inventory is found then a backup tarball is created
       as well.

    :param preferred_path: ``str`` Path to the inventory directory to try FIRST
    :param default_inv: ``dict`` Default inventory skeleton

    :return: ``(dict, str)`` Dictionary describing the JSON file contents or
        ``default_inv``, and the directory from which the inventory was loaded
        or should have been loaded from.
    """

    if filename:
        inv_fn = filename
    else:
        inv_fn = INVENTORY_FILENAME

    inventory, file_loaded = _load_from_json(inv_fn, preferred_path,
                                             raise_if_missing=False)
    if file_loaded is not False:
        load_path = os.path.dirname(file_loaded)
    else:
        load_path = dir_find(preferred_path)

    if inventory is not False:
        logger.debug("Loaded existing inventory from {}".format(file_loaded))
    else:
        logger.debug("No existing inventory, created fresh skeleton.")
        inventory = copy.deepcopy(default_inv)

    return inventory, load_path
Create an inventory dictionary.

       Create inventory dictionary from the given source file or a default
       inventory. If an inventory is found then a backup tarball is created
       as well.

    :param preferred_path: ``str`` Path to the inventory directory to try FIRST
    :param default_inv: ``dict`` Default inventory skeleton

    :return: ``(dict, str)`` Dictionary describing the JSON file contents or
        ``default_inv``, and the directory from which the inventory was loaded
        or should have been loaded from.
    
Create an inventory dictionary.
Create inventory dictionary from the given source file or a default
inventory. If an inventory is found then a backup tarball is created
as well.
Create an inventory dictionary . Create inventory dictionary from the given source file or a default inventory . If an inventory is found then a backup tarball is created as well .
def load_inventory(preferred_path=None, default_inv=None, filename=None):
    if filename:
        inv_fn = filename
    else:
        inv_fn = INVENTORY_FILENAME
    inventory, file_loaded = _load_from_json(inv_fn, preferred_path,
                                             raise_if_missing=False)
    if file_loaded is not False:
        load_path = os.path.dirname(file_loaded)
    else:
        load_path = dir_find(preferred_path)
    if inventory is not False:
        logger.debug("Loaded existing inventory from {}".format(file_loaded))
    else:
        logger.debug("No existing inventory, created fresh skeleton.")
        inventory = copy.deepcopy(default_inv)
    return inventory, load_path
def load_inventory ( preferred_path = None , default_inv = None , filename = None ) : if filename : inv_fn = filename else : inv_fn = INVENTORY_FILENAME inventory , file_loaded = _load_from_json ( inv_fn , preferred_path , raise_if_missing = False ) if file_loaded is not False : load_path = os . path . dirname ( file_loaded ) else : load_path = dir_find ( preferred_path ) if inventory is not False : logger . debug ( "Loaded existing inventory from {}" . format ( file_loaded ) ) else : logger . debug ( "No existing inventory, created fresh skeleton." ) inventory = copy . deepcopy ( default_inv ) return inventory , load_path
Create an inventory dictionary.
Create an inventory dictionary .
"""Create an inventory dictionary.

       Create inventory dictionary from the given source file or a default
       inventory. If an inventory is found then a backup tarball is created
       as well.

    :param preferred_path: ``str`` Path to the inventory directory to try FIRST
    :param default_inv: ``dict`` Default inventory skeleton

    :return: ``(dict, str)`` Dictionary describing the JSON file contents or
        ``default_inv``, and the directory from which the inventory was loaded
        or should have been loaded from.
    """
``(dict, str)`` Dictionary describing the JSON file contents or
``default_inv``, and the directory from which the inventory was loaded
or should have been loaded from.
` ` ( dict str ) ` ` Dictionary describing the JSON file contents or ` ` default_inv ` ` and the directory from which the inventory was loaded or should have been loaded from .
preferred_path
``str`` Path to the inventory directory to try FIRST
` ` str ` ` Path to the inventory directory to try FIRST
default_inv
``dict`` Default inventory skeleton
` ` dict ` ` Default inventory skeleton
filename