From 6fe83caa2f1fca7fc05b18c34e217dc63e326c30 Mon Sep 17 00:00:00 2001 From: Niels Laukens Date: Fri, 9 Nov 2018 14:06:32 +0100 Subject: [PATCH] Reformat code to fix linting errors --- stacker/lookups/handlers/ami.py | 6 ++++-- stacker/lookups/handlers/default.py | 6 +++--- stacker/lookups/handlers/dynamodb.py | 3 ++- stacker/lookups/handlers/envvar.py | 4 ++-- stacker/lookups/handlers/file.py | 11 ++++++----- stacker/lookups/handlers/kms.py | 7 ++++--- stacker/lookups/handlers/rxref.py | 4 ++-- stacker/lookups/handlers/split.py | 9 +++++---- stacker/lookups/handlers/ssmstore.py | 8 ++++---- stacker/lookups/handlers/xref.py | 4 ++-- stacker/lookups/registry.py | 4 ++-- 11 files changed, 36 insertions(+), 30 deletions(-) diff --git a/stacker/lookups/handlers/ami.py b/stacker/lookups/handlers/ami.py index 204e219e3..8d51c0619 100644 --- a/stacker/lookups/handlers/ami.py +++ b/stacker/lookups/handlers/ami.py @@ -33,7 +33,8 @@ def handle(cls, value, provider, **kwargs): account or amazon and the ami name matches the regex described, the architecture will be either x64 or i386 - You can also optionally specify the region in which to perform the AMI lookup. + You can also optionally specify the region in which to perform the + AMI lookup. Valid arguments: @@ -88,7 +89,8 @@ def handle(cls, value, provider, **kwargs): result = ec2.describe_images(**describe_args) - images = sorted(result['Images'], key=operator.itemgetter('CreationDate'), + images = sorted(result['Images'], + key=operator.itemgetter('CreationDate'), reverse=True) for image in images: if re.match("^%s$" % name_regex, image['Name']): diff --git a/stacker/lookups/handlers/default.py b/stacker/lookups/handlers/default.py index 3965c714e..fc2b5c845 100644 --- a/stacker/lookups/handlers/default.py +++ b/stacker/lookups/handlers/default.py @@ -22,9 +22,9 @@ def handle(cls, value, **kwargs): Groups: ${default app_security_groups::sg-12345,sg-67890} - If `app_security_groups` is defined in the environment, its defined value - will be returned. Otherwise, `sg-12345,sg-67890` will be the returned - value. + If `app_security_groups` is defined in the environment, its defined + value will be returned. Otherwise, `sg-12345,sg-67890` will be the + returned value. This allows defaults to be set at the config file level. """ diff --git a/stacker/lookups/handlers/dynamodb.py b/stacker/lookups/handlers/dynamodb.py index bd96e3c15..9dcd97ce8 100644 --- a/stacker/lookups/handlers/dynamodb.py +++ b/stacker/lookups/handlers/dynamodb.py @@ -39,7 +39,8 @@ def handle(cls, value, **kwargs): raise ValueError('Please make sure to include a tablename') if not table_name: - raise ValueError('Please make sure to include a dynamodb table name') + raise ValueError('Please make sure to include a dynamodb table ' + 'name') table_lookup, table_keys = table_keys.split(':', 1) diff --git a/stacker/lookups/handlers/envvar.py b/stacker/lookups/handlers/envvar.py index 568cd0915..a1d9ed5fd 100644 --- a/stacker/lookups/handlers/envvar.py +++ b/stacker/lookups/handlers/envvar.py @@ -24,8 +24,8 @@ def handle(cls, value, **kwargs): $ cat envvar_value.txt ENV_VAR_NAME - and reference it within stacker (NOTE: the path should be relative to - the stacker config file): + and reference it within stacker (NOTE: the path should be relative + to the stacker config file): conf_key: ${envvar file://envvar_value.txt} diff --git a/stacker/lookups/handlers/file.py b/stacker/lookups/handlers/file.py index 2791b548c..0eb87e74c 100644 --- a/stacker/lookups/handlers/file.py +++ b/stacker/lookups/handlers/file.py @@ -61,13 +61,14 @@ def handle(cls, value, **kwargs): - parameterized - the same as plain, but additionally supports referencing template parameters to create userdata that's supplemented with information from the template, as is commonly - needed in EC2 UserData. For example, given a template parameter of - BucketName, the file could contain the following text:: + needed in EC2 UserData. For example, given a template parameter + of BucketName, the file could contain the following text:: #!/bin/sh aws s3 sync s3://{{BucketName}}/somepath /somepath - and then you could use something like this in the YAML config file:: + and then you could use something like this in the YAML config + file:: UserData: ${file parameterized:/path/to/file} @@ -80,8 +81,8 @@ def handle(cls, value, **kwargs): ]] } - parameterized-b64 - the same as parameterized, with the results - additionally wrapped in *{ "Fn::Base64": ... }* , which is what you - actually need for EC2 UserData + additionally wrapped in *{ "Fn::Base64": ... }* , which is what + you actually need for EC2 UserData When using parameterized-b64 for UserData, you should use a variable defined as such: diff --git a/stacker/lookups/handlers/kms.py b/stacker/lookups/handlers/kms.py index c4cb0de7c..ba80d2779 100644 --- a/stacker/lookups/handlers/kms.py +++ b/stacker/lookups/handlers/kms.py @@ -25,7 +25,8 @@ def handle(cls, value, **kwargs): For example: # We use the aws cli to get the encrypted value for the string - # "PASSWORD" using the master key called "myStackerKey" in us-east-1 + # "PASSWORD" using the master key called "myStackerKey" in + # us-east-1 $ aws --region us-east-1 kms encrypt --key-id alias/myStackerKey \ --plaintext "PASSWORD" --output text --query CiphertextBlob @@ -39,8 +40,8 @@ def handle(cls, value, **kwargs): kms_value.txt us-east-1@CiD6bC8t2Y<...encrypted blob...> - and reference it within stacker (NOTE: the path should be relative to - the stacker config file): + and reference it within stacker (NOTE: the path should be relative + to the stacker config file): conf_key: ${kms file://kms_value.txt} diff --git a/stacker/lookups/handlers/rxref.py b/stacker/lookups/handlers/rxref.py index 14fdb7f93..858a13a3d 100644 --- a/stacker/lookups/handlers/rxref.py +++ b/stacker/lookups/handlers/rxref.py @@ -28,8 +28,8 @@ def handle(cls, value, provider=None, context=None, **kwargs): Args: value (str): string with the following format: ::, ie. some-stack::SomeOutput - provider (:class:`stacker.provider.base.BaseProvider`): subclass of the - base provider + provider (:class:`stacker.provider.base.BaseProvider`): subclass of + the base provider context (:class:`stacker.context.Context`): stacker context Returns: diff --git a/stacker/lookups/handlers/split.py b/stacker/lookups/handlers/split.py index 4dc175155..8908c7002 100644 --- a/stacker/lookups/handlers/split.py +++ b/stacker/lookups/handlers/split.py @@ -22,10 +22,11 @@ def handle(cls, value, **kwargs): ["subnet-1", "subnet-2", "subnet-3"] - This is particularly useful when getting an output from another stack that - contains a list. For example, the standard vpc blueprint outputs the list - of Subnets it creates as a pair of Outputs (PublicSubnets, PrivateSubnets) - that are comma separated, so you could use this in your config: + This is particularly useful when getting an output from another stack + that contains a list. For example, the standard vpc blueprint outputs + the list of Subnets it creates as a pair of Outputs (PublicSubnets, + PrivateSubnets) that are comma separated, so you could use this in your + config: Subnets: ${split ,::${output vpc::PrivateSubnets}} """ diff --git a/stacker/lookups/handlers/ssmstore.py b/stacker/lookups/handlers/ssmstore.py index 28e94fa4f..2da724d30 100644 --- a/stacker/lookups/handlers/ssmstore.py +++ b/stacker/lookups/handlers/ssmstore.py @@ -33,8 +33,8 @@ def handle(cls, value, **kwargs): ssmstore_value.txt us-east-1@ssmkey - and reference it within stacker (NOTE: the path should be relative to - the stacker config file): + and reference it within stacker (NOTE: the path should be relative + to the stacker config file): conf_key: ${ssmstore file://ssmstore_value.txt} @@ -58,5 +58,5 @@ def handle(cls, value, **kwargs): if 'Parameters' in response: return str(response['Parameters'][0]['Value']) - raise ValueError('SSMKey "{}" does not exist in region {}'.format(value, - region)) + raise ValueError('SSMKey "{}" does not exist in region {}'.format( + value, region)) diff --git a/stacker/lookups/handlers/xref.py b/stacker/lookups/handlers/xref.py index 9364f3620..a318d252b 100644 --- a/stacker/lookups/handlers/xref.py +++ b/stacker/lookups/handlers/xref.py @@ -27,8 +27,8 @@ def handle(cls, value, provider=None, **kwargs): Args: value (str): string with the following format: ::, ie. some-stack::SomeOutput - provider (:class:`stacker.provider.base.BaseProvider`): subclass of the - base provider + provider (:class:`stacker.provider.base.BaseProvider`): subclass of + the base provider Returns: str: output from the specified stack diff --git a/stacker/lookups/registry.py b/stacker/lookups/registry.py index 88b14555e..7d0fab46d 100644 --- a/stacker/lookups/registry.py +++ b/stacker/lookups/registry.py @@ -41,8 +41,8 @@ def register_lookup_handler(lookup_type, handler_or_path): if type(handler) != type: # Hander is a not a new-style handler logger = logging.getLogger(__name__) - logger.warning("Registering lookup `%s`: Please upgrade to use the new " - "style of Lookups." % lookup_type) + logger.warning("Registering lookup `%s`: Please upgrade to use the " + "new style of Lookups." % lookup_type) warnings.warn( # For some reason, this does not show up... # Leaving it in anyway