1a48e76
Index: cloud-init-fedora/cloudinit/CloudConfig/cc_puppet.py
4907847
===================================================================
1a48e76
--- cloud-init-fedora.orig/cloudinit/CloudConfig/cc_puppet.py
1a48e76
+++ cloud-init-fedora/cloudinit/CloudConfig/cc_puppet.py
4907847
@@ -16,6 +16,7 @@
4907847
 #    You should have received a copy of the GNU General Public License
4907847
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
4907847
 import os
4907847
+import os.path
4907847
 import pwd
4907847
 import socket
4907847
 import subprocess
a2171c6
@@ -84,10 +85,15 @@ def handle(name,cfg,cloud,log,args):
a2171c6
             with open('/etc/puppet/puppet.conf', 'wb') as configfile:
4907847
                 puppet_config.write(configfile)
a2171c6
             util.restorecon_if_possible('/etc/puppet/puppet.conf')
4907847
-    # Set puppet default file to automatically start
4907847
-    subprocess.check_call(['sed', '-i',
4907847
-                           '-e', 's/^START=.*/START=yes/',
4907847
-                           '/etc/default/puppet'])
4907847
+    # Set puppet to automatically start
4907847
+    if os.path.exists('/etc/default/puppet'):
4907847
+        subprocess.check_call(['sed', '-i',
4907847
+                               '-e', 's/^START=.*/START=yes/',
4907847
+                               '/etc/default/puppet'])
4907847
+    elif os.path.exists('/bin/systemctl'):
4907847
+        subprocess.check_call(['/bin/systemctl', 'enable', 'puppet.service'])
4907847
+    elif os.path.exists('/sbin/chkconfig'):
4907847
+        subprocess.check_call(['/sbin/chkconfig', 'puppet', 'on'])
4907847
     # Start puppetd
4907847
     subprocess.check_call(['service', 'puppet', 'start'])
4907847