Fx st2 key load to not fail on empty yaml/json files
@@ -294,12 +294,16 @@ class KeyValuePairLoadCommand(resource.ResourceCommand):
# load the data (JSON/YAML) from the file
kvps = resource.load_meta_file(file_path)
+ instances = []
+ # bail out if file was empty
+ if not kvps:
+ return instances
+
# if the data is not a list (ie. it's a single entry)
# then make it a list so our process loop is generic
if not isinstance(kvps, list):
kvps = [kvps]
- instances = []
for item in kvps:
# parse required KeyValuePair properties
name = item['name']
