Skip to content

Commit

Permalink
Closes-Bug: #1615170
Browse files Browse the repository at this point in the history
Use correct command for starting and stopping puppet on centos target.

Change-Id: I1815adffc8d86878d3d4195931b567410d8fa63b
  • Loading branch information
kamleshp committed Aug 20, 2016
1 parent 9c4b4ab commit 39ad62e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/server_mgr_mon_base_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,13 +758,22 @@ def gevent_puppet_agent_action(self,server, serverDb, sm_args, action,access_met
tries += 1
sshclient = ServerMgrSSHClient(serverdb=serverDb)
sshclient.connect(str(server['ip_address']), str(server['id']), access_method)
op = sshclient.exec_command('python -c "import platform; print platform.linux_distribution()"')
self._smgr_log.log("debug", "OP is %s" %op)
os_type = 'centos' if 'centos' in op.lower() else 'ubuntu'
if os_type == 'centos':
enable_puppet_svc_cmd = "chkconfig puppet on"
disable_puppet_svc_cmd = "chkconfig puppet off"
else:
enable_puppet_svc_cmd = "sed -i 's/START=.*$/START=yes/' /etc/default/puppet"
disable_puppet_svc_cmd = "sed -i 's/START=.*$/START=no/' /etc/default/puppet"
if action == "start":
output = sshclient.exec_command("sed -i 's/START=.*$/START=yes/' /etc/default/puppet")
output = sshclient.exec_command(enable_puppet_svc_cmd)
output = sshclient.exec_command("service puppet start")
self._smgr_log.log("debug", "Successfully started the puppet agent on the server " + str(server['id']))
self._provision_immediately_after_reimage = False
else:
output = sshclient.exec_command("sed -i 's/START=.*$/START=no/' /etc/default/puppet")
output = sshclient.exec_command(disable_puppet_svc_cmd)
output = sshclient.exec_command("service puppet stop")
self._smgr_log.log("debug", "Successfully stopped the puppet agent on the server " + str(server['id']))
success = True
Expand Down

0 comments on commit 39ad62e

Please sign in to comment.