Add warning for additional parameters

This commit is contained in:
Stefan Reimer 2020-07-16 23:56:09 +01:00
parent eea8bc6254
commit 3c4044cdb8
5 changed files with 17 additions and 2 deletions

View File

@ -1,5 +1,9 @@
# Changelog
## 0.9.3
- Improved bash minify for user-data
- Unused additional parameters are now printed as a warning to catch potential typos early
## 0.9.2
- Bug fix release only

View File

@ -2,7 +2,7 @@ import logging
__author__ = "Stefan Reimer"
__email__ = "stefan@zero-downtimet.net"
__version__ = "0.9.2"
__version__ = "0.9.3"
# Set up logging to ``/dev/null`` like a library is supposed to.

View File

@ -51,6 +51,9 @@ def option(context, attribute, default_value=u'', source='options'):
def include_raw_gz(context, files=None, gz=True, remove_comments=False):
jenv = context.environment
output = ''
# For shell script we can even remove whitespaces so treat them individually
# sed -e '2,$ {/^ *$/d ; /^ *#/d ; /^[ \t] *#/d ; /*^/d ; s/^[ \t]*// ; s/*[ \t]$// ; s/ $//}'
for name in files:
output = output + jinja2.Markup(jenv.loader.get_source(jenv, name)[0])

View File

@ -452,8 +452,17 @@ class Stack(object):
if _errors:
raise ParameterNotFound('Cannot find value for parameters: {0}'.format(_errors))
# Warning of excessive parameters, might be useful to spot typos early
_warnings = []
for p in self.parameters.keys():
if p not in self.cfn_data['Parameters']:
_warnings.append(p)
logger.info('{} {} set parameters:\n{}'.format(self.region, self.stackname, pprint.pformat(_found, indent=2)))
if _warnings:
logger.warning('Ignored additional parameters: {}.'.format(_warnings))
# Return dict of explicitly set parameters
return _found

View File

@ -1,7 +1,6 @@
import os
import copy
import logging
import boto3
logger = logging.getLogger(__name__)