Skip to content

Commit

Permalink
removed support for stdin credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarneyjr committed Oct 4, 2019
1 parent 7c7a6c9 commit 5a5dfe2
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 163 deletions.
2 changes: 1 addition & 1 deletion awsume/__data__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = '4.1.7'
version = '4.1.8'

name = 'awsume'
author = 'Trek10, Inc'
Expand Down
9 changes: 4 additions & 5 deletions awsume/awsumepy/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,10 @@ def get_credentials(self, args: argparse.Namespace, profiles: dict) -> dict:
profiles=profiles,
)
try:
if not args.auto_refresh and (args.json or not sys.stdin.isatty()): # piping/sending credentials to awsume directly
logger.debug('Pulling credentials from {}'.format('json parameter' if args.json else 'stdin'))
args.target_profile_name = 'json' if args.json else 'stdin'
json_input = args.json if args.json else sys.stdin.read()
credentials = json.loads(json_input)
if not args.auto_refresh and args.json: # sending credentials to awsume directly
logger.debug('Pulling credentials from json parameter')
args.target_profile_name = 'json'
credentials = json.loads(args.json)
if 'Credentials' in credentials:
credentials = credentials['Credentials']
credentials = [credentials]
Expand Down
8 changes: 5 additions & 3 deletions awsume/awsumepy/default_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,11 @@ def add_arguments(config: dict, parser: argparse.ArgumentParser):
def post_add_arguments(config: dict, arguments: argparse.Namespace, parser: argparse.ArgumentParser):
logger.debug('Post add arguments')
logger.debug(json.dumps(vars(arguments)))
if arguments.role_arn and arguments.auto_refresh:
raise exceptions.ValidationException('Cannot use autoawsume with given role_arn')
if arguments.auto_refresh:
if arguments.role_arn:
raise exceptions.ValidationException('Cannot use autoawsume with a given role_arn')
if arguments.json:
raise exceptions.ValidationException('Cannot use autoawsume with json')
if arguments.version:
logger.debug('Logging version')
safe_print(__data__.version)
Expand Down Expand Up @@ -244,7 +247,6 @@ def post_add_arguments(config: dict, arguments: argparse.Namespace, parser: argp
parser.error('--principal-arn account id must be valid numeric account id of length 12')
arguments.principal_arn = 'arn:{}:iam::{}:role/{}'.format(partition, account_id, provider_name)


if not arguments.profile_name:
if arguments.role_arn:
logger.debug('Role arn passed, target profile name will be role_arn')
Expand Down
4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Awsume Changelog

## [4.1.8] - WIP - Bug Fix

- Removed support for piping credentials to stdin

## [4.1.7] - 2019-10-02 - Autoawsume Bug Fix

- Fixed autoawsume bug with datetime comparisons
Expand Down
154 changes: 0 additions & 154 deletions shell_scripts/awsume.fish

This file was deleted.

0 comments on commit 5a5dfe2

Please sign in to comment.