aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbinary <me@rgoncalves.se>2021-02-14 12:01:27 +0100
committerbinary <me@rgoncalves.se>2021-02-14 12:01:27 +0100
commit68e20f54eda6de055adb9bda5969bedf20cf928b (patch)
tree0555e6ea0877f4ff9ffa31a0fbcada0653e860dd
parentbd83904d446597821d613ad2c8710ba7580dfd0d (diff)
downloadinfrastructure-68e20f54eda6de055adb9bda5969bedf20cf928b.tar.gz
Load empty structure on empty yaml input file.
Previously, python used to create an NoneType object when loading an empty yaml input file.
-rwxr-xr-xdynamic.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/dynamic.py b/dynamic.py
index 4b5cde5..908e4d3 100755
--- a/dynamic.py
+++ b/dynamic.py
@@ -35,7 +35,7 @@ class AnsibleInput:
def __init__(self, filepath):
with open(filepath) as file:
- self.data = yaml.load(file, Loader=yaml.FullLoader)
+ self.data = yaml.load(file, Loader=yaml.FullLoader) or {}
self.name = os.path.splitext(os.path.basename(filepath))[0]
remember that computers suck.