Skip to content

Commit

Permalink
Added the ability for Location to be passed as an option with skip Fo…
Browse files Browse the repository at this point in the history
…reman

remove location fact after registration

Made suggested revisions

RFE for location without foreman
  • Loading branch information
josephpisciotta authored and Joseph Pisciotta committed Mar 12, 2018
1 parent ec6c2ce commit 4228b9d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Evgeni Golov <evgeni@golov.de>
François Cami <fcami@fedoraproject.org>
Johan Bergström <bergsjoh@gmail.com>
Johan Swensson <jswensso@redhat.com>
Joseph Pisciotta <jpisciotta@redhat.com>
karmab <karimboumedhel@gmail.com>
Lukas Zapletal <lzap+git@redhat.com>
Marcelo Moreira de Mello <mmello@redhat.com>
Expand Down
12 changes: 11 additions & 1 deletion bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4228b9d

Please sign in to comment.