class AwsAssumeRole::Cli::Actions::ResetEnvironment
Constants
- CommandSchema
- SHELL_STRINGS
Public Instance Methods
act_on(config)
click to toggle source
# File lib/aws_assume_role/cli/actions/reset_environment.rb, line 29 def act_on(config) shell_strings = SHELL_STRINGS[config.shell_type.to_sym] str = String.new("") %w[AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN AWS_PROFILE AWS_ASSUME_ROLE_LOG_LEVEL GLI_DEBUG AWS_ASSUME_ROLE_KEYRING_BACKEND].each do |key| str << format(shell_strings[:env_command], key: key) if ENV.fetch(key, false) end str << "# #{pastel.yellow t(shell_strings.fetch(:footer, 'commands.set_environment.shells.others'))}" puts str rescue KeyError, Aws::Errors::NoSuchProfileError error format(t("errors.NoSuchProfileError"), config.profile) raise rescue Aws::Errors::MissingCredentialsError error t("errors.MissingCredentialsError") raise end