Minimum Python >= 3.7, drop oyaml, add support for short intrinsic AWS functions
This commit is contained in:
parent
3a7783acc9
commit
540d4c2faa
@ -1,5 +1,10 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 0.9.7
|
||||||
|
- CloudBender now requires Python >= 3.7
|
||||||
|
- drop oyaml requirement
|
||||||
|
- support for short intrinsic functions like !Ref, !Sub etc. by ignoring custom constructors before sending them to AWS to resolve
|
||||||
|
|
||||||
## 0.9.6
|
## 0.9.6
|
||||||
- only upload templates if render is successful
|
- only upload templates if render is successful
|
||||||
- support for jinja user-data
|
- support for jinja user-data
|
||||||
|
@ -2,7 +2,7 @@ import logging
|
|||||||
|
|
||||||
__author__ = "Stefan Reimer"
|
__author__ = "Stefan Reimer"
|
||||||
__email__ = "stefan@zero-downtimet.net"
|
__email__ = "stefan@zero-downtimet.net"
|
||||||
__version__ = "0.9.6"
|
__version__ = "0.9.7"
|
||||||
|
|
||||||
|
|
||||||
# Set up logging to ``/dev/null`` like a library is supposed to.
|
# Set up logging to ``/dev/null`` like a library is supposed to.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import hashlib
|
import hashlib
|
||||||
import oyaml as yaml
|
import yaml
|
||||||
import time
|
import time
|
||||||
import pathlib
|
import pathlib
|
||||||
import pprint
|
import pprint
|
||||||
@ -32,6 +32,15 @@ import logging
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
# Ignore any !<Constructors> during re-loading of CFN templates
|
||||||
|
class SafeLoaderIgnoreUnknown(yaml.SafeLoader):
|
||||||
|
def ignore_unknown(self, node):
|
||||||
|
return node.tag
|
||||||
|
|
||||||
|
|
||||||
|
SafeLoaderIgnoreUnknown.add_constructor(None, SafeLoaderIgnoreUnknown.ignore_unknown)
|
||||||
|
|
||||||
|
|
||||||
class Stack(object):
|
class Stack(object):
|
||||||
def __init__(self, name, template, path, rel_path, ctx):
|
def __init__(self, name, template, path, rel_path, ctx):
|
||||||
self.stackname = name
|
self.stackname = name
|
||||||
@ -135,7 +144,7 @@ class Stack(object):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
self.cfn_template = template.render(_config)
|
self.cfn_template = template.render(_config)
|
||||||
self.cfn_data = yaml.safe_load(self.cfn_template)
|
self.cfn_data = yaml.load(self.cfn_template, Loader=SafeLoaderIgnoreUnknown)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# In case we rendered invalid yaml this helps to debug
|
# In case we rendered invalid yaml this helps to debug
|
||||||
if self.cfn_template:
|
if self.cfn_template:
|
||||||
@ -184,7 +193,7 @@ class Stack(object):
|
|||||||
logger.info("Piped mode: Added parameters for remote stack references")
|
logger.info("Piped mode: Added parameters for remote stack references")
|
||||||
|
|
||||||
# Re-read updated template
|
# Re-read updated template
|
||||||
self.cfn_data = yaml.safe_load(self.cfn_template)
|
self.cfn_data = yaml.load(self.cfn_template, Loader=SafeLoaderIgnoreUnknown)
|
||||||
|
|
||||||
# Check for empty top level Parameters, Outputs and Conditions and remove
|
# Check for empty top level Parameters, Outputs and Conditions and remove
|
||||||
for key in ['Parameters', 'Outputs', 'Conditions']:
|
for key in ['Parameters', 'Outputs', 'Conditions']:
|
||||||
@ -318,7 +327,7 @@ class Stack(object):
|
|||||||
logger.warn("Could not find template file: {}".format(yaml_file))
|
logger.warn("Could not find template file: {}".format(yaml_file))
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
self.cfn_data = yaml.safe_load(self.cfn_template)
|
self.cfn_data = yaml.load(self.cfn_template, Loader=SafeLoaderIgnoreUnknown)
|
||||||
self._parse_metadata()
|
self._parse_metadata()
|
||||||
else:
|
else:
|
||||||
logger.debug('Using cached cfn template %s.', self.stackname)
|
logger.debug('Using cached cfn template %s.', self.stackname)
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
boto3
|
boto3
|
||||||
Jinja2
|
Jinja2
|
||||||
oyaml
|
|
||||||
click
|
click
|
||||||
pyminifier
|
pyminifier
|
||||||
cfn-lint
|
cfn-lint
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
boto3
|
boto3
|
||||||
Jinja2
|
Jinja2
|
||||||
oyaml
|
|
||||||
click
|
click
|
||||||
pyminifier
|
pyminifier
|
||||||
cfn-lint>=0.34
|
cfn-lint>=0.34
|
||||||
|
3
setup.py
3
setup.py
@ -47,6 +47,7 @@ setup(
|
|||||||
name='cloudbender',
|
name='cloudbender',
|
||||||
version=find_version("cloudbender/__init__.py"),
|
version=find_version("cloudbender/__init__.py"),
|
||||||
description='Toolset to render and manage AWS Cloudformation',
|
description='Toolset to render and manage AWS Cloudformation',
|
||||||
|
python_requires='>=3.7',
|
||||||
long_description=long_description,
|
long_description=long_description,
|
||||||
long_description_content_type="text/markdown",
|
long_description_content_type="text/markdown",
|
||||||
author='Stefan Reimer',
|
author='Stefan Reimer',
|
||||||
@ -56,7 +57,7 @@ setup(
|
|||||||
package_data={ 'cloudbender': ['templates/*.md'], },
|
package_data={ 'cloudbender': ['templates/*.md'], },
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
entry_points={'console_scripts': [ "cloudbender = cloudbender.cli:cli" ]},
|
entry_points={'console_scripts': [ "cloudbender = cloudbender.cli:cli" ]},
|
||||||
install_requires=['boto3', 'Jinja2', 'oyaml', 'click', 'cfn-lint>=0.34', 'pyminifier'],
|
install_requires=['boto3', 'Jinja2', 'click', 'cfn-lint>=0.34', 'pyminifier'],
|
||||||
tests_require=["pytest-cov", "moto", "mock", 'pytest'],
|
tests_require=["pytest-cov", "moto", "mock", 'pytest'],
|
||||||
cmdclass={"test": PyTest},
|
cmdclass={"test": PyTest},
|
||||||
classifiers=[
|
classifiers=[
|
||||||
|
Loading…
Reference in New Issue
Block a user