summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2011-10-30 17:41:01 -0400
committerScott Moser <smoser@ubuntu.com>2011-10-30 17:41:01 -0400
commited672bb70d07de292a01bd41ed3b02770fb5748b (patch)
tree6be6034e26a17b432e351d250ea28c9eff33320f /cloudinit
parent9033696575e0754c351fc6620ae70e9a3afdfccc (diff)
downloadvyos-cloud-init-ed672bb70d07de292a01bd41ed3b02770fb5748b.tar.gz
vyos-cloud-init-ed672bb70d07de292a01bd41ed3b02770fb5748b.zip
Make enabling puppet service work on Fedora
configure puppet service to start on fedora based on one of: * presence of /etc/default/puppet (Ubuntu) * /bin/systemctl * /sbin/chkconfig taken from git://pkgs.fedoraproject.org/cloud-init.git commit 87f33190f43d2b26cced4597e7298835024466c2 Author: Garrett Holmstrom <gholms@fedoraproject.org> Patch7: cloud-init-0.6.2-puppetenable.patch
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/CloudConfig/cc_puppet.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/cloudinit/CloudConfig/cc_puppet.py b/cloudinit/CloudConfig/cc_puppet.py
index 1dcd6a75..3dc40873 100644
--- a/cloudinit/CloudConfig/cc_puppet.py
+++ b/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
@@ -84,10 +85,15 @@ def handle(name,cfg,cloud,log,args):
with open('/etc/puppet/puppet.conf', 'wb') as configfile:
puppet_config.write(configfile)
util.restorecon_if_possible('/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'])