edingc / munki-enroll

Scripts to automatically enroll clients in Munki, allowing for very flexible manifest structures.
MIT License
74 stars 25 forks source link

Not writing new manifest if in nested folder #13

Closed DP19 closed 8 years ago

DP19 commented 8 years ago

Great script and thanks for all of the hard work. I've been testing this for the past three days and I'm running into a problem. The enroll script will work and create a new manifest if i use the "default" manifest on the root of /manifests/. If i try to give a client an identifier "IT/ITdefault" this is my output from the enroll script.

MunkiClient:Desktop administrator$ sudo ./munki_enroll.sh Computer manifest does not exist. Will create.
Fatal error: Uncaught exception 'CFPropertyList\IOException' with message '../manifests/IT//IT/ITdefault' in /Users/Shared/munki_repo/munki-enroll/cfpropertylist-2.0.1/IOException.php:68 Stack trace:

0 /Users/Shared/munki_repo/munki-enroll/cfpropertylist-2.0.1/CFPropertyList.php(199): CFPropertyList\IOException::notReadable('../manifests/IT...')

1 /Users/Shared/munki_repo/munki-enroll/cfpropertylist-2.0.1/CFPropertyList.php(129): CFPropertyList\CFPropertyList->load()

2 /Users/Shared/munki_repo/munki-enroll/enroll.php(36): CFPropertyList\CFPropertyList->__construct('../manifests/IT...')

3 {main}

thrown in /Users/Shared/munki_repo/munki-enroll/cfpropertylist-2.0.1/IOException.php on line 68

I've checked the server and it is writing the clients folder in the correct location /manifests/IT/clients/ but no manifest will be created for the client. It also updated the client identifier for the host to the correct location as well. Any help would be greatly appreciated

DP19 commented 8 years ago

I figured out the issue, in the enroll.php file on line 36 there is an extra path identifier that's needs to be taken out. $path_identifer and the added '/' are not needed. This works with nested folders and top level manifests now.

edingc commented 8 years ago

I merged your pull request to resolve this. Thank you.

14