cloud-init/cloud-init-0.6.2-puppetenable.patch

33 lines
1.4 KiB
Diff
Raw Normal View History

2011-09-23 17:44:26 +00:00
Index: cloud-init/cloudinit/CloudConfig/cc_puppet.py
===================================================================
--- cloud-init.orig/cloudinit/CloudConfig/cc_puppet.py
+++ cloud-init/cloudinit/CloudConfig/cc_puppet.py
@@ -16,6 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
+import os.path
import pwd
import socket
import subprocess
@@ -91,10 +92,15 @@ def handle(name,cfg,cloud,log,args):
puppet_config.write(configfile)
if HAVE_LIBSELINUX and selinux.is_selinux_enabled():
selinux.restorecon('/etc/puppet/puppet.conf')
- # Set puppet default file to automatically start
- subprocess.check_call(['sed', '-i',
- '-e', 's/^START=.*/START=yes/',
- '/etc/default/puppet'])
+ # Set puppet to automatically start
+ if os.path.exists('/etc/default/puppet'):
+ subprocess.check_call(['sed', '-i',
+ '-e', 's/^START=.*/START=yes/',
+ '/etc/default/puppet'])
+ elif os.path.exists('/bin/systemctl'):
+ subprocess.check_call(['/bin/systemctl', 'enable', 'puppet.service'])
+ elif os.path.exists('/sbin/chkconfig'):
+ subprocess.check_call(['/sbin/chkconfig', 'puppet', 'on'])
# Start puppetd
subprocess.check_call(['service', 'puppet', 'start'])