def _init_cache_dir(self, cache_dir): home_dir = cdist.home_dir() if cache_dir: self.cache_path = cache_dir elif home_dir: self.cache_path = os.path.join(home_dir, "cache") else: raise cdist.Error( "No homedir setup and no cache dir location given")
def determine_default_inventory_dir(args): # The order of inventory dir setting by decreasing priority # 1. inventory_dir argument # 2. CDIST_INVENTORY_DIR env var if set # 3. ~/.cdist/inventory if HOME env var is set # 4. distribution inventory directory if not args.inventory_dir: if 'CDIST_INVENTORY_DIR' in os.environ: args.inventory_dir = os.environ['CDIST_INVENTORY_DIR'] else: home = cdist.home_dir() if home: args.inventory_dir = os.path.join(home, DIST_INVENTORY_DB_NAME) else: args.inventory_dir = dist_inventory_db
def determine_default_inventory_dir(args, configuration): # The order of inventory dir setting by decreasing priority # 1. inventory_dir from configuration # 2. ~/.cdist/inventory if HOME env var is set # 3. distribution inventory directory inventory_dir_set = False if 'inventory_dir' in configuration: val = configuration['inventory_dir'] if val: args.inventory_dir = val inventory_dir_set = True if not inventory_dir_set: home = cdist.home_dir() if home: args.inventory_dir = os.path.join(home, DIST_INVENTORY_DB_NAME) else: args.inventory_dir = dist_inventory_db
def home_dir(self): return cdist.home_dir()