Adjust ansible-role-requirements-editor file open options

This implements more correct file open options. While this is
not strictly required it does appear to make the script behave
more consistently across different platforms.

The patch also renames the file name and related content to
ensure that the tool is correctly spelled.

Change-Id: Idde0141691e1008bead802bd6f3759c12e37b02b
This commit is contained in:
Jesse Pretorius 2016-04-15 11:33:25 +01:00
parent 6fcf238fac
commit 60603c3213
2 changed files with 4 additions and 4 deletions

View File

@ -47,7 +47,7 @@ def main():
# Setup argument parsing
parser = argparse.ArgumentParser(
description='ansible-role-requirements.yml CLI editer',
description='ansible-role-requirements.yml CLI editor',
epilog='Licensed "Apache 2.0"')
parser.add_argument(
@ -82,7 +82,7 @@ def main():
args = parser.parse_args()
# Read the ansible-role-requirements.yml file into memory
with open(args.file, "r+") as role_req_file:
with open(args.file, "r") as role_req_file:
reqs = yaml.safe_load(role_req_file)
# Loop through the list to find the applicable role
@ -94,7 +94,7 @@ def main():
role_data['src'] = args.src
# Write out the resulting file
with open(args.file, "r+") as role_req_file:
with open(args.file, "w") as role_req_file:
try:
yaml.dump(reqs, role_req_file, default_flow_style=False)
except yaml.YAMLError as exc:

View File

@ -212,7 +212,7 @@ if [[ "${OSA_BRANCH}" != "master" ]]; then
fi
# Now use the information we have to update the ansible-role-requirements file
$(dirname ${0})/ansible-role-requirements-editer.py -f ansible-role-requirements.yml -n "${role_name}" -v "${role_version}"
$(dirname ${0})/ansible-role-requirements-editor.py -f ansible-role-requirements.yml -n "${role_name}" -v "${role_version}"
done
echo "Completed updating ansible-role-requirements.yml"
else