def initialize_federation_proxy(user=None): """Get needed config parts and initialize AWSFederationProxy""" config_path = request.environ.get('CONFIG_PATH') if config_path is None: raise Exception("No Config Path specified") config = yaml_load(config_path) try: logger = setup_logging(config, logger_name=LOGGER_NAME) except Exception as exc: raise ConfigurationError(str(exc)) if user is None: user = get_user(config['api']['user_identification']) account_config_path = request.environ.get('ACCOUNT_CONFIG_PATH') if account_config_path is None: raise Exception("No Account Config Path specified") account_config = yaml_load(account_config_path) proxy = AWSFederationProxy(user=user, config=config, account_config=account_config, logger=logger) return proxy
def test_setup_logging_sets_log_level(self): self.basicconfig['log_level'] = 'debug' setup_logging(self.basicconfig, logger_name='foobar') logger = logging.getLogger('foobar') self.assertEqual(logger.getEffectiveLevel(), logging.DEBUG)