Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Switch to only output real errors (aka --quiet or --silent) #328

Open
seanorama opened this issue Dec 3, 2021 · 0 comments

Comments

@seanorama
Copy link

Expected Behavior

Only output real errors, or required input, when a switch, such as -s, --silent, is provided.

A successful authentication would show:

$ gimme-aws-creds --silent

Unsuccessful would show any errors or required input:

$ gimme-aws-creds --silent -p badprofile
Configuration profile not found! Use the --action-configure flag to generate the profile.

Current Behavior

$ gimme-aws-creds
Using password from keyring for myuser
Saving arn:aws:iam::111111111111:role/MyRole as my_profile
Written profile my_profile to /home/myuser/.aws/credentials
$

The stdout can be ignored with:

$ gimme-aws-creds >/dev/null
Using password from keyring for myuser
$

But notice above that an informational line is printed to stderr.

A shell based workaround is to send stdout to null, and alter stderr. See examples below

## successful authentication prints nothing
$ gimme-aws-creds >/dev/null 2> >(grep -v "^Using password from" >&2)
$

## but error prints
$ gimme-aws-creds -p badprofile >/dev/null 2> >(grep -v "^Using password from" >&2)
Configuration profile not found! Use the --action-configure flag to generate the profile.

## and input is requested
$ gimme-aws-creds --roles badrole >/dev/null 2> >(grep -v "^Using password from" >&2)
ERROR: AWS roles [badrole] not found!
Pick a role:
[0] arn:aws:iam::111111111111:role/SomeRole
[1] arn:aws:iam::111111111111:role/AnotherROle

Possible Solution

Use a switch, such as -s, --silent.

Context

The noise of successful authentication is not always needed. Especially effects users who wrap gimme-aws-creds into their local scripts to ensure the session is fresh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant