def __init__(self, ssm_init: SsmDao, colors_enabled: bool, context: ConfigContext): super().__init__(validate, colors_enabled, context) self._ssm = ssm_init self._config_path = context.ci_config_path if context.ci_config_path else Utils.find_figgy_json( ) self._utils = Utils(colors_enabled) self._replication_only = context.replication_only self._errors_detected = False self.example = f"{self.c.fg_bl}{CLI_NAME} config {self.command_printable} " \ f"--env dev --config /path/to/config{self.c.rs}" self._FILE_PREFIX = "file://" self._out = Output(colors_enabled)
def __init__(self, ssm: SsmDao, ddb: ConfigDao, repl_dao: ReplicationDao, context: ConfigContext, config_completer_init: WordCompleter, colors_enabled: bool, delete: Delete, args=None): super().__init__(prune, colors_enabled, context) self._ssm = ssm # type: SsmDao self._config_dao = ddb # type: ConfigDao self._repl = repl_dao self._config_completer = config_completer_init # type: WordCompleter self._utils = Utils(colors_enabled) self.example = f"{self.c.fg_bl}{CLI_NAME} config {self.command_printable} --env dev " \ f"--config /path/to/figgy.json{self.c.rs}" self._config_path = context.ci_config_path if context.ci_config_path else Utils.find_figgy_json( ) self._out = Output(colors_enabled) # If user passes in --info flag, we don't need all of this to be initialized. if not hasattr(args, info.name) or args.info is False: # Validate & parse figgy.json self._config = self._utils.get_ci_config( self._config_path) # type: Dict self._shared_names = set( self._utils.get_config_key_safe(SHARED_KEY, self._config, default=[])) # type: Set self._repl_conf = self._utils.get_config_key_safe( REPLICATION_KEY, self._config, default={}) # type: Dict self._merge_conf = self._utils.get_config_key_safe( MERGE_KEY, self._config, default={}) # type: Dict self._config_keys = set( self._utils.get_config_key_safe(CONFIG_KEY, self._config, default=[])) # type: Set self._merge_keys = set(self._merge_conf.keys()) # type: Set self._namespace = self._utils.get_namespace( self._config) # type: str self._delete_command = delete self._repl_from_conf = self._utils.get_config_key_safe( REPL_FROM_KEY, self._config, default={}) self._repl_conf = KeyUtils.merge_repl_and_repl_from_blocks( self._repl_conf, self._repl_from_conf, self._namespace) # Build list of all keys found across all config types self._all_keys = KeyUtils().find_all_expected_names( self._config_keys, self._shared_names, self._merge_conf, self._repl_conf, self._repl_from_conf, self._namespace)