Skip to content

Commit 2e1b234

Browse files
committed
Ensure catalogs and items_to_copy are never None
1 parent 12718a1 commit 2e1b234

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

pre_commit_hooks/check_munki_pkgsinfo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def main(argv=None):
181181

182182
# Check for rogue catalogs.
183183
if args.catalogs:
184-
for catalog in pkginfo.get("catalogs"):
184+
for catalog in pkginfo.get("catalogs", []):
185185
if catalog not in args.catalogs:
186186
print(f'{filename}: catalog "{catalog}" is not in approved list')
187187
retval = 1
@@ -269,7 +269,7 @@ def main(argv=None):
269269
# Credit to @bruienne for this idea.
270270
# https://gist.github.com/bruienne/9baa958ec6dbe8f09d94#file-munki_fuzzinator-py-L211-L219
271271
if "items_to_copy" in pkginfo:
272-
for item_to_copy in pkginfo.get("items_to_copy"):
272+
for item_to_copy in pkginfo.get("items_to_copy", []):
273273
if item_to_copy.get("destination_path").endswith("/"):
274274
print(
275275
f'{filename}: has an items_to_copy with a trailing slash: "{item_to_copy["destination_path"]}"'

0 commit comments

Comments
 (0)