From 4228b9dc6f40cd293da99c5da7bc59a13d190828 Mon Sep 17 00:00:00 2001 From: Joseph Pisciotta Date: Thu, 25 Jan 2018 17:05:47 -0500 Subject: [PATCH] Added the ability for Location to be passed as an option with skip Foreman remove location fact after registration Made suggested revisions RFE for location without foreman --- AUTHORS | 1 + bootstrap.py | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 041fc49..dd89bf4 100644 --- a/AUTHORS +++ b/AUTHORS @@ -10,6 +10,7 @@ Evgeni Golov François Cami Johan Bergström Johan Swensson +Joseph Pisciotta karmab Lukas Zapletal Marcelo Moreira de Mello diff --git a/bootstrap.py b/bootstrap.py index 6faf865..2ae135a 100755 --- a/bootstrap.py +++ b/bootstrap.py @@ -420,13 +420,20 @@ def generate_katello_facts(): """ Write katello_facts file based on FQDN. Done after installation of katello-ca-consumer RPM in case the script is overriding the - FQDN + FQDN. Place the location if the location option is included """ + print_generic("Writing FQDN katello-fact") katellofacts = open('/etc/rhsm/facts/katello.facts', 'w') katellofacts.write('{"network.hostname-override":"%s"}\n' % (FQDN)) katellofacts.close() + if options.location and 'foreman' in options.skip: + print_generic("Writing LOCATION RHSM fact") + locationfacts = open('/etc/rhsm/facts/location.facts', 'w') + locationfacts.write('{"foreman_location":"%s"}\n' % (options.location)) + locationfacts.close() + def install_puppet_agent(): """Install and configure, then enable and start the Puppet Agent""" @@ -1250,6 +1257,9 @@ def exec_service(service, command, failonerror=True): if options.enablerepos: enable_repos() + if options.location and 'foreman' in options.skip: + delete_file('/etc/rhsm/facts/location.facts') + if not options.remove and not options.new_capsule: # > IF not removing, install Katello agent, optionally update host, # > optionally clean and install Puppet agent