#!/usr/bin/env python
from credstash import putSecretAutoversion as update_secret
import docker
class CredStashAPI:
def __init__(self, log):
self.log = log
self.allowed_secrets = ['sec1']
def run(self, key, value):
if key in self.allowed_secrets:
update_secret("{}".format(key),
"{}".format(value),
region="us-east-1",
context={"environment": "production"})
self.log.info("Credstash key '{}' updated!".format(key))
else:
self.log.info("Key '{}' is not part of 'allowed_secrets' list!")
Produces an error related to boto3 region. The region is set specifically for credstash. This snippet runs inside a container. I tried setting AWS_DEFAULT_REGION as an env variable to the container, but still getting the error:
deployer.1.f9ntap553i0v@ip-10-0-12-167 | File "/usr/local/lib/python3.7/site-packages/botocore-1.12.227-py3.7.egg/botocore/session.py", line 839, in create_client
deployer.1.s212szy96baw@ip-10-0-12-167 | botocore.exceptions.NoRegionError: You must specify a region.
deployer.1.f9ntap553i0v@ip-10-0-12-167 | client_config=config, api_version=api_version)
deployer.1.f9ntap553i0v@ip-10-0-12-167 | File "/usr/local/lib/python3.7/site-packages/botocore-1.12.227-py3.7.egg/botocore/client.py", line 86, in create_client
deployer.1.f9ntap553i0v@ip-10-0-12-167 | verify, credentials, scoped_config, client_config, endpoint_bridge)
deployer.1.f9ntap553i0v@ip-10-0-12-167 | File "/usr/local/lib/python3.7/site-packages/botocore-1.12.227-py3.7.egg/botocore/client.py", line 328, in _get_client_args
deployer.1.f9ntap553i0v@ip-10-0-12-167 | verify, credentials, scoped_config, client_config, endpoint_bridge)
deployer.1.s212szy96baw@ip-10-0-12-167 | [2019-09-12 05:50:29 +0000] [1] [INFO] Handling signal: term
deployer.1.f9ntap553i0v@ip-10-0-12-167 | File "/usr/local/lib/python3.7/site-packages/botocore-1.12.227-py3.7.egg/botocore/args.py", line 47, in get_client_args
deployer.1.f9ntap553i0v@ip-10-0-12-167 | endpoint_url, is_secure, scoped_config)
deployer.1.s212szy96baw@ip-10-0-12-167 | [2019-09-12 05:50:29 +0000] [1] [INFO] Shutting down: Master
deployer.1.f9ntap553i0v@ip-10-0-12-167 | File "/usr/local/lib/python3.7/site-packages/botocore-1.12.227-py3.7.egg/botocore/args.py", line 117, in compute_client_args
deployer.1.f9ntap553i0v@ip-10-0-12-167 | service_name, region_name, endpoint_url, is_secure)
deployer.1.f9ntap553i0v@ip-10-0-12-167 | File "/usr/local/lib/python3.7/site-packages/botocore-1.12.227-py3.7.egg/botocore/client.py", line 402, in resolve
deployer.1.f9ntap553i0v@ip-10-0-12-167 | service_name, region_name)
deployer.1.f9ntap553i0v@ip-10-0-12-167 | File "/usr/local/lib/python3.7/site-packages/botocore-1.12.227-py3.7.egg/botocore/regions.py", line 122, in construct_endpoint
deployer.1.f9ntap553i0v@ip-10-0-12-167 | partition, service_name, region_name)
deployer.1.f9ntap553i0v@ip-10-0-12-167 | File "/usr/local/lib/python3.7/site-packages/botocore-1.12.227-py3.7.egg/botocore/regions.py", line 135, in _endpoint_for_partition
deployer.1.f9ntap553i0v@ip-10-0-12-167 | raise NoRegionError()
deployer.1.f9ntap553i0v@ip-10-0-12-167 | botocore.exceptions.NoRegionError: You must specify a region.
This might be related to #93 however in my case boto3 doesn't default to us-east-1.
Hello, the following code:
Produces an error related to boto3 region. The region is set specifically for credstash. This snippet runs inside a container. I tried setting
AWS_DEFAULT_REGION
as an env variable to the container, but still getting the error:This might be related to #93 however in my case boto3 doesn't default to
us-east-1
.