示例#1
0
文件: clidriver.py 项目: aws/aws-cli
    def _handle_top_level_args(self, args):
        emit_top_level_args_parsed_event(self.session, args)
        if args.profile:
            self.session.set_config_variable('profile', args.profile)
        if args.region:
            self.session.set_config_variable('region', args.region)
        if args.debug:
            # TODO:
            # Unfortunately, by setting debug mode here, we miss out
            # on all of the debug events prior to this such as the
            # loading of plugins, etc.
            self.session.set_stream_logger('botocore', logging.DEBUG,
                                           format_string=LOG_FORMAT)
            self.session.set_stream_logger('awscli', logging.DEBUG,
                                           format_string=LOG_FORMAT)
            self.session.set_stream_logger('s3transfer', logging.DEBUG,
                                           format_string=LOG_FORMAT)
            self.session.set_stream_logger('urllib3', logging.DEBUG,
                                           format_string=LOG_FORMAT)
            LOG.debug("CLI version: %s", self.session.user_agent())
            LOG.debug("Arguments entered to CLI: %s", sys.argv[1:])

        else:
            self.session.set_stream_logger(logger_name='awscli',
                                           log_level=logging.ERROR)
示例#2
0
 def _update_parsed_globals(self, parsed_alias_args, parsed_globals):
     global_params_to_update = self._get_global_parameters_to_update(
         parsed_alias_args)
     # Emit the top level args parsed event to ensure all possible
     # customizations that typically get applied are applied to the
     # global parameters provided in the alias before updating
     # the original provided global parameter values
     # and passing those onto subsequent commands.
     emit_top_level_args_parsed_event(self._session, parsed_alias_args)
     for param_name in global_params_to_update:
         updated_param_value = getattr(parsed_alias_args, param_name)
         setattr(parsed_globals, param_name, updated_param_value)
示例#3
0
 def _update_parsed_globals(self, parsed_alias_args, parsed_globals):
     global_params_to_update = self._get_global_parameters_to_update(
         parsed_alias_args)
     # Emit the top level args parsed event to ensure all possible
     # customizations that typically get applied are applied to the
     # global parameters provided in the alias before updating
     # the original provided global parameter values
     # and passing those onto subsequent commands.
     emit_top_level_args_parsed_event(self._session, parsed_alias_args)
     for param_name in global_params_to_update:
         updated_param_value = getattr(parsed_alias_args, param_name)
         setattr(parsed_globals, param_name, updated_param_value)
示例#4
0
    def _handle_top_level_args(self, args):
        emit_top_level_args_parsed_event(self.session, args)
        if args.profile:
            self.session.set_config_variable('profile', args.profile)
        if args.debug:
            # TODO:
            # Unfortunately, by setting debug mode here, we miss out
            # on all of the debug events prior to this such as the
            # loading of plugins, etc.
            self.session.set_stream_logger('botocore', logging.DEBUG,
                                           format_string=LOG_FORMAT)
            self.session.set_stream_logger('awscli', logging.DEBUG,
                                           format_string=LOG_FORMAT)
            self.session.set_stream_logger('s3transfer', logging.DEBUG,
                                           format_string=LOG_FORMAT)
            LOG.debug("CLI version: %s", self.session.user_agent())
            LOG.debug("Arguments entered to CLI: %s", sys.argv[1:])

        else:
            self.session.set_stream_logger(logger_name='awscli',
                                           log_level=logging.ERROR)