mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-05 03:26:53 +00:00
Add flag to detect-aws-credentials to allow missing keys
In the event that there exists no configuration for AWS credentials and they are not exported in to the current environment, a flag may be passed to allow exiting the hook successfully. Resolves #174 Signed-off-by: Mike Fiedler <miketheman@gmail.com>
This commit is contained in:
parent
20f04626a1
commit
312e721ce9
2 changed files with 23 additions and 0 deletions
|
|
@ -95,6 +95,12 @@ def main(argv=None):
|
|||
'secret keys from'
|
||||
)
|
||||
)
|
||||
parser.add_argument(
|
||||
'--allow-missing-credentials',
|
||||
dest='allow_missing_credentials',
|
||||
action='store_true',
|
||||
help='Allow hook to pass when no credentials are detected.'
|
||||
)
|
||||
args = parser.parse_args(argv)
|
||||
|
||||
credential_files = set(args.credential_files)
|
||||
|
|
@ -111,6 +117,9 @@ def main(argv=None):
|
|||
# the set of keys.
|
||||
keys |= get_aws_secrets_from_env()
|
||||
|
||||
if not keys and args.allow_missing_credentials:
|
||||
return 0
|
||||
|
||||
if not keys:
|
||||
print(
|
||||
'No AWS keys were found in the configured credential files and '
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue