Skip to content

Commit 612b990

Browse files
authored
Merge pull request #71 from homebysix/1.14.1
1.14.1 merge to main
2 parents 26bd432 + ee23677 commit 612b990

7 files changed

Lines changed: 24 additions & 20 deletions

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ All notable changes to this project will be documented in this file. This projec
1414

1515
Nothing yet.
1616

17+
## [1.14.1] - 2023-11-20
18+
19+
### Fixed
20+
21+
- Fixed a bug that would cause a Python traceback when checking Munki repos that use `nopkg` type items.
22+
1723
## [1.14.0] - 2023-11-19
1824

1925
### Added
@@ -318,7 +324,9 @@ Nothing yet.
318324

319325
- Initial release
320326

321-
[Unreleased]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.13.0...HEAD
327+
[Unreleased]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.14.1...HEAD
328+
[1.14.1]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.14.0...v1.14.1
329+
[1.14.0]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.13.0...v1.14.0
322330
[1.13.0]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.12.4...v1.13.0
323331
[1.12.4]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.12.3...v1.12.4
324332
[1.12.3]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.12.2...v1.12.3

pre_commit_hooks/check_autopkg_recipe_list.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def main(argv=None):
3737
for filename in args.filenames:
3838
recipe_list = None
3939
if filename.endswith(".txt"):
40-
with open(filename, "r") as openfile:
40+
with open(filename, "r", encoding="utf-8") as openfile:
4141
recipe_list = [
4242
line
4343
for line in openfile.read().splitlines()
@@ -54,7 +54,7 @@ def main(argv=None):
5454
# AutoPkg does not support YAML recipe lists, but AutoPkg users
5555
# may have developed custom tooling for this.
5656
try:
57-
with open(filename, "r") as openfile:
57+
with open(filename, "r", encoding="utf-8") as openfile:
5858
recipe_list = yaml.load(openfile)
5959
except Exception as err:
6060
print("{}: yaml parsing error: {}".format(filename, err))
@@ -63,7 +63,7 @@ def main(argv=None):
6363
# AutoPkg does not support JSON recipe lists, but AutoPkg users
6464
# may have developed custom tooling for this.
6565
try:
66-
with open(filename, "r") as openfile:
66+
with open(filename, "r", encoding="utf-8") as openfile:
6767
recipe_list = json.load(openfile)
6868
except Exception as err:
6969
print("{}: json parsing error: {}".format(filename, err))

pre_commit_hooks/check_autopkg_recipes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# Import AutoPkg libraries, but ignore any warnings generated by the import.
2121
@contextmanager
2222
def suppress_stdout():
23-
with open(os.devnull, "w") as devnull:
23+
with open(os.devnull, "w", encoding="utf-8") as devnull:
2424
old_stdout = sys.stdout
2525
sys.stdout = devnull
2626
try:
@@ -100,7 +100,7 @@ def validate_comments(filename, strict):
100100
plutil -convert xml1."""
101101

102102
passed = True
103-
with open(filename, "r") as openfile:
103+
with open(filename, "r", encoding="utf-8") as openfile:
104104
recipe_text = openfile.read()
105105
if "<!--" in recipe_text and "-->" in recipe_text:
106106
if strict:
@@ -548,7 +548,7 @@ def main(argv=None):
548548
break # No need to continue checking this file
549549

550550
# For future implementation of validate_unused_input_vars()
551-
# with open(filename, "r") as openfile:
551+
# with open(filename, "r", encoding='utf-8') as openfile:
552552
# recipe_text = openfile.read()
553553

554554
# Top level keys that all AutoPkg recipes should contain.

pre_commit_hooks/check_jamf_extension_attributes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def main(argv=None):
2525

2626
retval = 0
2727
for filename in args.filenames:
28-
with open(filename, "r") as openfile:
28+
with open(filename, "r", encoding="utf-8") as openfile:
2929
ea_content = openfile.read()
3030

3131
if "<result>" not in ea_content or "</result>" not in ea_content:

pre_commit_hooks/check_jamf_scripts.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"""Check Jamf scripts for common issues."""
44

55
import argparse
6-
import os
76

87

98
def build_argument_parser():
@@ -25,7 +24,7 @@ def main(argv=None):
2524

2625
retval = 0
2726
for filename in args.filenames:
28-
with open(filename, "r") as openfile:
27+
with open(filename, "r", encoding="utf-8") as openfile:
2928
script_content = openfile.read()
3029

3130
# Ensure script starts with a shebang of some sort.

pre_commit_hooks/check_munki_pkgsinfo.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ def build_argument_parser():
3939

4040

4141
def _check_case_sensitive_path(path):
42+
"""Check whether a path exists, and on case-sensitive filesystems check
43+
that there is no case conflict."""
4244
# Return immediately if the file does not exist
4345
if not os.path.exists(path):
4446
return False
@@ -131,14 +133,9 @@ def main(argv=None):
131133
)
132134
retval = 1
133135

134-
# Check for missing installer items
135-
if all(
136-
(
137-
"installer_item_location" in pkginfo,
138-
not _check_case_sensitive_path(
139-
os.path.join("pkgs", pkginfo.get("installer_item_location"))
140-
),
141-
)
136+
# Check for missing or case-conflicted installer items
137+
if not _check_case_sensitive_path(
138+
os.path.join("pkgs", pkginfo.get("installer_item_location", ""))
142139
):
143140
print(
144141
"{}: installer item does not exist or path is not case sensitive".format(

pre_commit_hooks/check_munkipkg_buildinfo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,15 @@ def main(argv=None):
8989
break # no need to continue testing this file
9090
elif filename.endswith((".yaml", ".yml")):
9191
try:
92-
with open(filename, "r") as openfile:
92+
with open(filename, "r", encoding="utf-8") as openfile:
9393
buildinfo = yaml.load(openfile)
9494
except Exception as err:
9595
print("{}: yaml parsing error: {}".format(filename, err))
9696
retval = 1
9797
break # no need to continue testing this file
9898
elif filename.endswith(".json"):
9999
try:
100-
with open(filename, "r") as openfile:
100+
with open(filename, "r", encoding="utf-8") as openfile:
101101
buildinfo = json.load(openfile)
102102
except Exception as err:
103103
print("{}: json parsing error: {}".format(filename, err))

0 commit comments

Comments
 (0)