change propose-library-branches to use yamlutils
We now have a way to preserve the order and other general formatting settings when rewriting a YAML file, so use it instead of tacking a blob of text onto the end of the file. Change-Id: Icd3a6a4d75e3e86acbec66503f4b99951460c2f7 Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
@@ -26,13 +26,6 @@ from openstack_releases import defaults
|
|||||||
from openstack_releases import yamlutils
|
from openstack_releases import yamlutils
|
||||||
|
|
||||||
|
|
||||||
BRANCH_TEMPLATE = """
|
|
||||||
branches:
|
|
||||||
- name: stable/{series}
|
|
||||||
location: {version}
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
@@ -125,11 +118,9 @@ def main():
|
|||||||
continue
|
continue
|
||||||
latest_release = releases[-1]
|
latest_release = releases[-1]
|
||||||
|
|
||||||
# NOTE(dhellmann): PyYAML doesn't preserve layout when you
|
deliverable_data['branches'].append({
|
||||||
# write the data back out, so do the formatting ourselves.
|
'name': 'stable/' + args.series,
|
||||||
new_block = BRANCH_TEMPLATE.format(
|
'location': latest_release['version'],
|
||||||
version=latest_release['version'],
|
})
|
||||||
series=args.series,
|
with open(filename, 'w', encoding='utf-8') as f:
|
||||||
).strip() + '\n'
|
f.write(yamlutils.dumps(deliverable_data))
|
||||||
with open(filename, 'a') as f:
|
|
||||||
f.write(new_block)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user