Skip to content

Commit

Permalink
Adapt puppet configuration for different versions of puppet
Browse files Browse the repository at this point in the history
Signed-off-by: Saurabh Badhwar <sbadhwar@redhat.com>
  • Loading branch information
Saurabh Badhwar committed Jan 10, 2018
1 parent 2a9f066 commit 4af76eb
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion bootstrap.py
Expand Up @@ -382,6 +382,8 @@ def clean_puppet():
print_generic("Cleaning old Puppet Agent")
call_yum("erase", "puppet")
delete_directory("/var/lib/puppet/")
delete_directory("/opt/puppetlabs/puppet/cache")
delete_directory("/etc/puppetlabs/puppet/ssl")


def clean_environment():
Expand Down Expand Up @@ -421,12 +423,26 @@ def install_puppet_agent():
print_error("Unsupported puppet version")
sys.exit(1)
puppet_conf = open(puppet_conf_file, 'wb')
puppet_conf.write("""
if puppet_major_version == 3:
puppet_conf.write("""
[main]
vardir = /var/lib/puppet
logdir = /var/log/puppet
rundir = /var/run/puppet
ssldir = $vardir/ssl
""")
elif puppet_major_version in [4, 5]:
puppet_conf.write("""
[main]
vardir = /opt/puppetlabs/puppet/cache
logdir = /var/log/puppetlabs/puppet
rundir = /var/run/puppet
ssldir = /etc/puppetlabs/puppet/ssl
""")
else:
print_error("Unsupported puppet version")
sys.exit(0)
puppet_conf.write("""
[agent]
pluginsync = true
report = true
Expand Down

0 comments on commit 4af76eb

Please sign in to comment.