Merge "Add detailed-exitcodes to launch_node"
This commit is contained in:
commit
33b22208b2
@ -119,11 +119,14 @@ def bootstrap_server(server, admin_pass, key, cert, environment, name,
|
||||
ssh_client.scp("/var/lib/puppet/ssl/certs/ca.pem",
|
||||
"/var/lib/puppet/ssl/certs/ca.pem")
|
||||
|
||||
ssh_client.ssh("puppet agent "
|
||||
"--environment %s "
|
||||
"--server %s "
|
||||
"--no-daemonize --verbose --onetime --pluginsync true "
|
||||
"--certname %s" % (environment, puppetmaster, certname))
|
||||
(rc, output) = ssh_client.ssh(
|
||||
"puppet agent "
|
||||
"--environment %s "
|
||||
"--server %s "
|
||||
"--detailed-exitcodes "
|
||||
"--no-daemonize --verbose --onetime --pluginsync true "
|
||||
"--certname %s" % (environment, puppetmaster, certname))
|
||||
utils.interpret_puppet_exitcodes(rc, output)
|
||||
|
||||
ssh_client.ssh("reboot")
|
||||
|
||||
|
@ -205,3 +205,24 @@ def delete_server(server):
|
||||
|
||||
print "Deleting server", server.id
|
||||
server.delete()
|
||||
|
||||
|
||||
def interpret_puppet_exitcodes(rc, output):
|
||||
if rc == 0:
|
||||
# success
|
||||
return
|
||||
elif rc == 1:
|
||||
# rc==1 could be because it's disabled
|
||||
# rc==1 could also mean there was a compilation failure
|
||||
disabled = "administratively disabled" in output
|
||||
if disabled:
|
||||
msg = "puppet is disabled"
|
||||
else:
|
||||
msg = "puppet did not run"
|
||||
raise Exception(msg)
|
||||
elif rc == 2:
|
||||
# success with changes
|
||||
return
|
||||
elif rc == 124:
|
||||
# timeout
|
||||
raise Exception("Puppet timed out")
|
||||
|
Loading…
x
Reference in New Issue
Block a user