Skip to content

Commit 5c86896

Browse files
committed
feat: add --warn-on-missing-installer-items option
1 parent 2d7f7c4 commit 5c86896

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

pre_commit_hooks/check_munki_pkgsinfo.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ def build_argument_parser():
4646
action="store_true",
4747
default=False,
4848
)
49+
parser.add_argument(
50+
"--warn-on-missing-installer-items",
51+
help="If added, this will only warn on missing installer items.",
52+
action="store_true",
53+
default=False,
54+
)
4955
parser.add_argument(
5056
"--warn-on-duplicate-imports",
5157
help="If added, this will only warn if pkginfo/pkg files end with a __1 suffix.",
@@ -144,10 +150,12 @@ def main(argv=None):
144150
args.munki_repo, "pkgs", pkginfo.get("installer_item_location", "")
145151
)
146152
):
147-
print(
148-
f"{filename}: installer item does not exist or path is not case sensitive"
149-
)
150-
retval = 1
153+
msg = "installer item does not exist or path is not case sensitive"
154+
if args.warn_on_missing_installer_items:
155+
print(f"{filename}: WARNING: {msg}")
156+
else:
157+
print(f"{filename}: {msg}")
158+
retval = 1
151159

152160
# Check for pkg filenames showing signs of duplicate imports.
153161
if pkginfo.get("installer_item_location", "").endswith(tuple(dupe_suffixes)):

0 commit comments

Comments
 (0)