Skip to content

Commit

Permalink
fix: make converter compatible with older PyYAML
Browse files Browse the repository at this point in the history
CentOS 8 ship with PyYAML 3.12 while I used some features introduced
with 5.1, which are incompatible. See yaml/pyyaml#265.
  • Loading branch information
btravouillon committed Jul 1, 2020
1 parent 7be74d5 commit 4ecaccb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/inventory-converter-1.3-network_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ def main():

with open(hostsfile, 'r') as fd:
try:
inventory = yaml.load(fd, Loader=yaml.FullLoader)
inventory = yaml.load(fd, Loader=yaml.SafeLoader)
new_inventory = search_network_interfaces(inventory)
except yaml.YAMLError as exc:
print(exc)

with open(outfile, 'w') as fd:
fd.write(yaml.dump(new_inventory, Dumper=MyDumper))
fd.write(yaml.dump(new_inventory, Dumper=MyDumper, default_flow_style=False))

print(f'''Next steps:
$ diff -u {hostsfile} {outfile} | less
Expand Down

0 comments on commit 4ecaccb

Please sign in to comment.