def __init__(self, name, distro, root_dir, cli_opts): self.distro = distro self.root_dir = root_dir self.phase_dir = sh.joinpths(root_dir, 'phases') self.name = name self.interpolator = cfg.YamlInterpolator(settings.COMPONENT_CONF_DIR) self.passwords = {} self.keyring_path = cli_opts.pop('keyring_path') self.keyring_encrypted = cli_opts.pop('keyring_encrypted') self.prompt_for_passwords = cli_opts.pop('prompt_for_passwords', False) self.store_passwords = cli_opts.pop('store_passwords', True) self.cli_opts = cli_opts # Stored for components to get any options
def __init__(self, name, distro, root_dir, cli_opts): self.distro = distro self.name = name # Root directory where all files/downloads will be based at self.root_dir = root_dir # Action phases are tracked in this directory self.phase_dir = sh.joinpths(root_dir, 'phases') # Yamls are 'interpolated' using this instance at the given # component directory where component configuration will be found... self.interpolator = cfg.YamlInterpolator(settings.COMPONENT_CONF_DIR) # Keyring/pw settings + cache self.passwords = {} self.keyring_path = cli_opts.pop('keyring_path') self.keyring_encrypted = cli_opts.pop('keyring_encrypted') self.prompt_for_passwords = cli_opts.pop('prompt_for_passwords', False) self.store_passwords = cli_opts.pop('store_passwords', True) # Stored for components to get any options self.cli_opts = cli_opts
#!/usr/bin/env python import os import sys possible_topdir = os.path.normpath( os.path.join(os.path.abspath(sys.argv[0]), os.pardir, os.pardir)) if os.path.exists(os.path.join(possible_topdir, 'anvil', '__init__.py')): sys.path.insert(0, possible_topdir) if len(sys.argv) == 1: print(sys.argv[0] + " root-component") sys.exit(1) from anvil import settings from anvil import cfg from anvil import utils from anvil import pprint interp = cfg.YamlInterpolator(settings.COMPONENT_CONF_DIR) result = interp.extract(sys.argv[1]) pprint.pprint(result)