Skip to content

Commit

Permalink
Reformat code to fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
nielslaukens committed Nov 9, 2018
1 parent aead0c4 commit 6fe83ca
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 30 deletions.
6 changes: 4 additions & 2 deletions stacker/lookups/handlers/ami.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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']):
Expand Down
6 changes: 3 additions & 3 deletions stacker/lookups/handlers/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down
3 changes: 2 additions & 1 deletion stacker/lookups/handlers/dynamodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions stacker/lookups/handlers/envvar.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
11 changes: 6 additions & 5 deletions stacker/lookups/handlers/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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:
Expand Down
7 changes: 4 additions & 3 deletions stacker/lookups/handlers/kms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}
Expand Down
4 changes: 2 additions & 2 deletions stacker/lookups/handlers/rxref.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def handle(cls, value, provider=None, context=None, **kwargs):
Args:
value (str): string with the following format:
<stack_name>::<output_name>, 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:
Expand Down
9 changes: 5 additions & 4 deletions stacker/lookups/handlers/split.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
"""
Expand Down
8 changes: 4 additions & 4 deletions stacker/lookups/handlers/ssmstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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))
4 changes: 2 additions & 2 deletions stacker/lookups/handlers/xref.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ def handle(cls, value, provider=None, **kwargs):
Args:
value (str): string with the following format:
<stack_name>::<output_name>, 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
Expand Down
4 changes: 2 additions & 2 deletions stacker/lookups/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6fe83ca

Please sign in to comment.