Beispiel #1
0
 def _get_config_variable_with_custom_methods(self, logical_name, methods):
     # If a custom list of methods was supplied we need to perserve the
     # behavior with the new system. To do so a new chain that is a copy of
     # the old one will be constructed, but only with the supplied methods
     # being added to the chain. This chain will be consulted for a value
     # and then thrown out. This is not efficient, nor is the methods arg
     # used in botocore, this is just for backwards compatibility.
     chain_builder = SubsetChainConfigFactory(session=self, methods=methods)
     mapping = create_botocore_default_config_mapping(self)
     for name, config_options in self.session_var_map.items():
         config_name, env_vars, default, typecast = config_options
         build_chain_config_args = {
             'conversion_func': typecast,
             'default': default,
         }
         if 'instance' in methods:
             build_chain_config_args['instance_name'] = name
         if 'env' in methods:
             build_chain_config_args['env_var_names'] = env_vars
         if 'config' in methods:
             build_chain_config_args['config_property_name'] = config_name
         mapping[name] = chain_builder.create_config_chain(
             **build_chain_config_args
         )
     config_store_component = ConfigValueStore(
         mapping=mapping
     )
     value = config_store_component.get_config_variable(logical_name)
     return value
Beispiel #2
0
 def _get_config_variable_with_custom_methods(self, logical_name, methods):
     # If a custom list of methods was supplied we need to perserve the
     # behavior with the new system. To do so a new chain that is a copy of
     # the old one will be constructed, but only with the supplied methods
     # being added to the chain. This chain will be consulted for a value
     # and then thrown out. This is not efficient, nor is the methods arg
     # used in botocore, this is just for backwards compatibility.
     chain_builder = SubsetChainConfigFactory(session=self, methods=methods)
     mapping = create_botocore_default_config_mapping(
         chain_builder
     )
     for name, config_options in self.session_var_map.items():
         config_name, env_vars, default, typecast = config_options
         build_chain_config_args = {
             'conversion_func': typecast,
             'default': default,
         }
         if 'instance' in methods:
             build_chain_config_args['instance_name'] = name
         if 'env' in methods:
             build_chain_config_args['env_var_names'] = env_vars
         if 'config' in methods:
             build_chain_config_args['config_property_name'] = config_name
         mapping[name] = chain_builder.create_config_chain(
             **build_chain_config_args
         )
     config_store_component = ConfigValueStore(
         mapping=mapping
     )
     value = config_store_component.get_config_variable(logical_name)
     return value
Beispiel #3
0
 def _register_config_store(self):
     chain_builder = ConfigChainFactory(session=self)
     config_store_component = ConfigValueStore(
         mapping=create_botocore_default_config_mapping(chain_builder)
     )
     self._components.register_component('config_store',
                                         config_store_component)
Beispiel #4
0
 def _register_config_store(self):
     chain_builder = ConfigChainFactory(session=self)
     config_store_component = ConfigValueStore(
         mapping=create_botocore_default_config_mapping(chain_builder)
     )
     self._components.register_component('config_store',
                                         config_store_component)
Beispiel #5
0
 def _register_config_store(self):
     chain_builder = ConfigChainFactory(session=self)
     config_store = ConfigValueStore(
         mapping=create_botocore_default_config_mapping(chain_builder))
     return config_store
Beispiel #6
0
 def _register_config_store(self):
     config_store_component = ConfigValueStore(
         mapping=create_botocore_default_config_mapping(self)
     )
     self._components.register_component('config_store',
                                         config_store_component)