Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _entrypoint(ctx, section, section_name, cluster_name, parameter_prefix, command, dry_run):
if section_name and cluster_name:
# The only thing we need out of Config is the names of any config:
# section variables we might have. We don't need to do interpolation
# in the config: section, because we retrieve the values from Parameter
# Store, and we don't want to use any aws: section that might be in the
# deployfish.yml to configure our boto3 session because we want to defer
# to the IAM ECS Task Role.
config = Config(
filename=ctx.obj['CONFIG_FILE'],
interpolate=False,
use_aws_section=False
)
try:
section_yml = config.get_section_item(section, section_name)
except KeyError:
click.echo("Our container's deployfish config file '{}' does not have section '{}' in '{}'".format(
ctx.obj['CONFIG_FILE'] or 'deployfish.yml',
section_name,
section
))
sys.exit(1)
parameter_store = []
if 'config' in section_yml:
parameter_name = parameter_prefix + section_name
def wrapper(*args, **kwargs):
try:
args[0].obj['CONFIG'] = Config(
filename=args[0].obj['CONFIG_FILE'],
env_file=args[0].obj['ENV_FILE'],
import_env=args[0].obj['IMPORT_ENV'],
tfe_token=args[0].obj['TFE_TOKEN']
)
except NoSuchStateFile as e:
click.echo(str(e))
sys.exit(1)
else:
return func(*args, **kwargs)
return wrapper