Add user-data compression info, add warning when templates exceed max. size

This commit is contained in:
Stefan Reimer 2019-09-11 11:42:49 +00:00
parent b3eb7e3719
commit 2579636d08
2 changed files with 4 additions and 0 deletions

View File

@ -62,6 +62,8 @@ def include_raw_gz(context, files=None, gz=True):
f.write(output.encode())
f.close()
# MaxSize is 21847
logger.info("Compressed user-data from {} to {}".format(len(output), len(buf.getvalue())))
return base64.b64encode(buf.getvalue()).decode('utf-8')

View File

@ -227,6 +227,8 @@ class Stack(object):
with open(yaml_file, 'w') as yaml_contents:
yaml_contents.write(self.cfn_template)
logger.info('Wrote %s to %s', self.template, yaml_file)
if len(self.cfn_template) > 51200:
logger.warning("Rendered template exceeds maximum allowed size of 51200, actual size: {} !".format(len(self.cfn_template)))
else:
logger.error('No cfn template rendered yet for stack {}.'.format(self.stackname))