Fix uploading of rendered templates, support jinja user-data
This commit is contained in:
parent
381091ec6a
commit
2b2c8e2ea8
@ -1,5 +1,10 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 0.9.6
|
||||||
|
- only upload templates if render is successful
|
||||||
|
- support for jinja user-data
|
||||||
|
- tweak for kubezero output template
|
||||||
|
|
||||||
## 0.9.5
|
## 0.9.5
|
||||||
### New Features
|
### New Features
|
||||||
Support for uploading and retrieving rendered templates from S3!
|
Support for uploading and retrieving rendered templates from S3!
|
||||||
|
@ -61,10 +61,13 @@ def include_raw_gz(context, files=None, gz=True, remove_comments=False):
|
|||||||
# Remove full line comments but not shebang
|
# Remove full line comments but not shebang
|
||||||
_re_comment = re.compile(r'^\s*#[^!]')
|
_re_comment = re.compile(r'^\s*#[^!]')
|
||||||
_re_blank = re.compile(r'^\s*$')
|
_re_blank = re.compile(r'^\s*$')
|
||||||
|
_re_keep = re.compile(r'^## template: jinja$')
|
||||||
stripped_output = ''
|
stripped_output = ''
|
||||||
for curline in output.splitlines():
|
for curline in output.splitlines():
|
||||||
if re.match(_re_blank, curline):
|
if re.match(_re_blank, curline):
|
||||||
continue
|
continue
|
||||||
|
elif re.match(_re_keep, curline):
|
||||||
|
stripped_output = stripped_output + curline + '\n'
|
||||||
elif re.match(_re_comment, curline):
|
elif re.match(_re_comment, curline):
|
||||||
logger.debug("Removed {}".format(curline))
|
logger.debug("Removed {}".format(curline))
|
||||||
else:
|
else:
|
||||||
|
@ -296,9 +296,6 @@ class Stack(object):
|
|||||||
profile=self.profile, region=self.region)
|
profile=self.profile, region=self.region)
|
||||||
logger.debug("Got template from s3://{}/{}".format(bucket, path))
|
logger.debug("Got template from s3://{}/{}".format(bucket, path))
|
||||||
|
|
||||||
except ClientError as e:
|
|
||||||
logger.error("Could not find template file on S3: {}/{}, {}".format(bucket, path, e))
|
|
||||||
|
|
||||||
self.cfn_template = template['Body'].read().decode('utf-8')
|
self.cfn_template = template['Body'].read().decode('utf-8')
|
||||||
|
|
||||||
# Overwrite local copy
|
# Overwrite local copy
|
||||||
@ -306,6 +303,10 @@ class Stack(object):
|
|||||||
ensure_dir(os.path.join(self.ctx['template_path'], self.rel_path))
|
ensure_dir(os.path.join(self.ctx['template_path'], self.rel_path))
|
||||||
with open(yaml_file, 'w') as yaml_contents:
|
with open(yaml_file, 'w') as yaml_contents:
|
||||||
yaml_contents.write(self.cfn_template)
|
yaml_contents.write(self.cfn_template)
|
||||||
|
|
||||||
|
except ClientError as e:
|
||||||
|
logger.error("Could not find template file on S3: {}/{}, {}".format(bucket, path, e))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
yaml_file = os.path.join(self.ctx['template_path'], self.rel_path, self.stackname + ".yaml")
|
yaml_file = os.path.join(self.ctx['template_path'], self.rel_path, self.stackname + ".yaml")
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
# Source: CloudBender for stack {{ stackname }} at {{ timestamp }}
|
# Source: CloudBender for stack {{ stackname }} at {{ timestamp }}
|
||||||
ClusterName: {{ parameters.ClusterName }}
|
ClusterName: {{ parameters.ClusterName }}
|
||||||
Domain: {{ parameters.DnsZone }}
|
Domain: {{ parameters.DnsZone }}
|
||||||
|
HighAvailableControlplane: {{ parameters.HighAvailable }}
|
||||||
|
|
||||||
cert-manager:
|
cert-manager:
|
||||||
IamArn: {{ outputs.CertManagerRoleArn }}
|
IamArn: {{ outputs.CertManagerRoleArn }}
|
||||||
|
Loading…
Reference in New Issue
Block a user