Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- __virtualname__ = 'puppet_mgmt'
- __author__ = "Dan Finn"
- __version__ = "0.1"
- import subprocess
- '''
- This module is used to restart puppet. We were seeing an issue on ubuntu servers where if you just ran cmd.run service restart puppet you would end up with puppet running under the same environment variables as the salt minion. This causes some issues for puppet so we need to specify the environment variable when we start it up.
- You can run this module like so:
- salt 'hostname' puppet_mgmt.restart
- salt 'hostname' puppet_mgmt.stop
- salt 'hostname' puppet_mgmt.start
- '''
- __virtualname = 'puppet_mgmt'
- def __virtual__():
- return __virtualname__
- def restart():
- '''
- restarts puppet
- '''
- #return_code = subprocess.call(['env', 'LC_ALL=en_US.UTF-8', 'service', 'puppet', 'restart'])
- # cmd = '{0} {1} {2} {3} {4}'.format('env', 'LC_ALL=en_US.UTF-8', 'service', 'puppet', 'restart')
- # ret = salt['cmd.run'](cmd)
- #__salt__['cmd.run'](run='service puppet restart',env=[{"LC_ALL":"en_US.UTF-8"}])
- #__salt__['cmd.run']('service puppet restart',env='{LC_ALL: en_US.UTF-8"}')
- #__salt__['cmd.run']('/bin/bash service puppet restart')
- __salt__['cmd.run']('service puppet restart',reset_system_locale=False)
- return "Restarting puppet"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement