Skip to content

Commit 56f985d

Browse files
committed
Add --require-pkg-blocking-apps option for pkginfo checking
1 parent 79a449b commit 56f985d

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ All notable changes to this project will be documented in this file. This projec
1515
### Added
1616

1717
- Added compatibility checks for MunkiOptionalReceiptEditor processor, included in AutoPkg 2.7+.
18+
- Added a `--require-pkg-blocking-apps` argument for the `check-munki-pkgsinfo` hook. If specified, tests will fail for any pkg installer that does not have a `blocking_applications` array (even an empty one). This change maintains the alignment with Munki's design established in 1.12.3 while allowing Munki repo admins flexibility to be stricter in their own environments.
1819

1920
### Changed
2021

pre_commit_hooks/check_munki_pkgsinfo.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ def build_argument_parser():
2828
default=["description", "name"],
2929
help="List of required top-level keys.",
3030
)
31+
parser.add_argument(
32+
"--require-pkg-blocking-apps",
33+
action="store_true",
34+
help="Require a blocking_applications array for pkg installers.",
35+
)
3136
parser.add_argument("filenames", nargs="*", help="Filenames to check.")
3237
return parser
3338

@@ -120,7 +125,7 @@ def main(argv=None):
120125

121126
# Checking for the absence of blocking_applications for pkg installers.
122127
# If a pkg doesn't require blocking_applications, use empty "<array/>" in pkginfo.
123-
if all(
128+
if args.require_pkg_blocking_apps and all(
124129
(
125130
"blocking_applications" not in pkginfo,
126131
pkginfo.get("installer_item_location", "").endswith(".pkg"),
@@ -129,10 +134,11 @@ def main(argv=None):
129134
)
130135
):
131136
print(
132-
"WARNING: {}: contains a pkg installer but has no blocking applications".format(
137+
"{}: contains a pkg installer but missing a blocking applications array".format(
133138
filename
134139
)
135140
)
141+
retval = 1
136142

137143
# Ensure an icon exists for the item.
138144
if not any(

0 commit comments

Comments
 (0)