From 4ecaccb18177ae8c824b92b4cc86722bb6c2f3c5 Mon Sep 17 00:00:00 2001 From: Bruno Travouillon Date: Wed, 1 Jul 2020 20:13:56 +0000 Subject: [PATCH] fix: make converter compatible with older PyYAML CentOS 8 ship with PyYAML 3.12 while I used some features introduced with 5.1, which are incompatible. See yaml/pyyaml#265. --- tools/inventory-converter-1.3-network_interfaces.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/inventory-converter-1.3-network_interfaces.py b/tools/inventory-converter-1.3-network_interfaces.py index c7a512d75..c3448bb9a 100755 --- a/tools/inventory-converter-1.3-network_interfaces.py +++ b/tools/inventory-converter-1.3-network_interfaces.py @@ -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