Last active
June 14, 2016 19:44
-
-
Save arubdesu/8cd7e5bae7c190ccedac82f0092439aa to your computer and use it in GitHub Desktop.
Via outset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
"""bootstraps puppet, which gets munki ready for SSL, | |
and runs the munki function that shoves puppet's CA into the sys keychain. | |
Assumes this is at /Library/MMCSupport/bootstrap_puppet.py, | |
and called by outset(github.com/chilcote/outset)'s boot-every option""" | |
import os | |
import shutil | |
import subprocess | |
import sys | |
import time | |
sys.path.append('/usr/local/munki/munkilib') | |
import keychain | |
def main(): | |
"""gimme some main""" | |
print "Starting puppet bootstrap process\n" | |
munkipath = '/Users/Shared/.com.googlecode.munki.checkandinstallatstartup' | |
puppet_cmd = ['/opt/puppetlabs/bin/puppet', 'agent', '-t'] | |
while True: | |
if os.path.exists(munkipath): | |
print 'Sleeping another 15...' | |
time.sleep(15) | |
else: | |
break | |
print "Enough sleep, running puppet bootstrap" | |
code = subprocess.check_call(puppet_cmd) | |
print "\nPuppet bootstrap should be complete, seeding certs" | |
# Uses munkilib's keychain module to inject into system keychain using puppet-set prefs | |
keychain.add_ca_certs_to_system_keychain() | |
shutil.move(sys.argv[0], '/Library/MMCSupport/bootstrap_puppet.py') | |
sys.exit(code) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment