summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Harney <eharney@redhat.com>2015-09-03 07:52:37 -0400
committerEric Harney <eharney@redhat.com>2015-09-03 07:56:22 -0400
commitfb24f1d113c03cf4d542331428e63f58a80eef71 (patch)
treedff912a2a6208bff14bbd0621d69466faddbf864
parent2726843ee54a3c9f061b9ed2451d080f459e4f38 (diff)
downloados-client-config-fb24f1d113c03cf4d542331428e63f58a80eef71.tar.gz
Handle empty defaults.yaml file
If defaults.yaml is empty, a TypeError is thrown because the result of yaml.load is not iterable. Change-Id: Ic3283ebaf9dd325e4f430e70bce08c6d716f60bc
-rw-r--r--os_client_config/defaults.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/os_client_config/defaults.py b/os_client_config/defaults.py
index a274767..897cff5 100644
--- a/os_client_config/defaults.py
+++ b/os_client_config/defaults.py
@@ -35,6 +35,8 @@ def get_defaults():
key=None,
)
with open(_yaml_path, 'r') as yaml_file:
- _defaults.update(yaml.load(yaml_file.read()))
+ updates = yaml.load(yaml_file.read())
+ if updates is not None:
+ _defaults.update(updates)
return _defaults.copy()