Skip to content

Commit

Permalink
Attempt to make MakeCatalog.munki work with repo plugins while mainta…
Browse files Browse the repository at this point in the history
…ining some backwards compatibility. Likely to break people still using Munki < 3.0. Oh well!
  • Loading branch information
gregneagle committed May 7, 2018
1 parent 23101ac commit 10494fb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
7 changes: 1 addition & 6 deletions Munki/MakeCatalogs.munki.recipe
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>Description</key>
<string>Rebuilds Munki catalogs in munki_repo_path if any other recipe in the same autopkg run imported something.
<string>Rebuilds Munki catalogs in Munki repo if any other recipe in the same autopkg run imported something.
Use -k force_rebuild=YES to force a rebuild.</string>
<key>Identifier</key>
<string>com.github.autopkg.munki.makecatalogs</string>
Expand All @@ -17,11 +17,6 @@ Use -k force_rebuild=YES to force a rebuild.</string>
<dict>
<key>Processor</key>
<string>MakeCatalogsProcessor</string>
<key>Arguments</key>
<dict>
<key>munki_repo_path</key>
<string>%MUNKI_REPO%</string>
</dict>
</dict>
</array>
</dict>
Expand Down
19 changes: 15 additions & 4 deletions Munki/MakeCatalogsProcessor.py 100644 → 100755
Expand Up @@ -26,10 +26,14 @@
class MakeCatalogsProcessor(Processor):
"""Runs makecatalogs on a munki repo"""
input_variables = {
"munki_repo_path": {
"MUNKI_REPO": {
"required": True,
"description": "Path to the munki repo.",
"description": "Munki repo URL.",
},
"MUNKI_REPO_PLUGIN": {
"required": False,
"description": "Name of a Munki repo plugin. Defaults to FileRepo",
},
"force_rebuild": {
"required": False,
"description":
Expand Down Expand Up @@ -79,9 +83,16 @@ def main(self):
self.env["makecatalogs_stderr"] = ""
else:
# Generate arguments for makecatalogs.
args = ["/usr/local/munki/makecatalogs",
self.env["munki_repo_path"]]
args = ["/usr/local/munki/makecatalogs"]
if self.env["MUNKI_REPO"].startswith('/'):
# looks a file path instead of a URL
args.append(self.env["MUNKI_REPO"])
else:
args.extend(["--repo-url" , self.env["MUNKI_REPO"]])

if self.env.get("MUNKI_REPO_PLUGIN"):
args.extend(["--plugin", self.env["MUNKI_REPO_PLUGIN"]])

# Call makecatalogs.
try:
proc = subprocess.Popen(
Expand Down

0 comments on commit 10494fb

Please sign in to comment.