Skip to content

Commit f093f23

Browse files
authored
Merge pull request #63 from kbrewersq/flexible_munki_repo
making munki repo more flexible
2 parents 664524b + 8a7e4fb commit f093f23

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

.pre-commit-hooks.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
description: This hook checks Munki pkginfo files to ensure they are valid.
6767
entry: check-munki-pkgsinfo
6868
language: python
69-
files: "^pkgsinfo/"
69+
files: "pkgsinfo/"
7070
types: [text]
7171

7272
- id: check-munkiadmin-scripts

pre_commit_hooks/munki_makecatalogs.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,17 @@ def build_argument_parser():
1414
parser = argparse.ArgumentParser(
1515
description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter
1616
)
17+
parser.add_argument("--munki_repo", default='.',
18+
help="path to local munki repo defaults to '.'")
1719
# TODO: Support makecatalogs options, ideally with kwargs for flexibility.
1820
return parser
1921

2022

2123
def main(argv=None):
2224
"""Main process."""
2325

24-
# Path to Python 2.
25-
python = "/usr/bin/python"
26+
# Path to munki's python.
27+
python = "/usr/local/munki/munki-python"
2628

2729
# Path to makecatalogs.
2830
makecatalogs = "/usr/local/munki/makecatalogs"
@@ -32,7 +34,7 @@ def main(argv=None):
3234
args = argparser.parse_args(argv)
3335

3436
retval = 0
35-
if not os.path.isdir("pkgsinfo"):
37+
if not os.path.isdir(os.path.join(args.munki_repo, "pkgsinfo")):
3638
print("Could not find pkgsinfo folder.")
3739
retval = 1
3840
elif not os.path.isfile(python):
@@ -42,7 +44,7 @@ def main(argv=None):
4244
print("{} does not exist.".format(makecatalogs))
4345
retval = 1
4446
else:
45-
retval = subprocess.call([python, makecatalogs, "."])
47+
retval = subprocess.call([makecatalogs, args.munki_repo])
4648

4749
return retval
4850

0 commit comments

Comments
 (0)