Skip to content

Commit 4228b9d

Browse files
josephpisciottaJoseph Pisciotta
authored andcommitted
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
1 parent ec6c2ce commit 4228b9d

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Evgeni Golov <[email protected]>
1010
François Cami <[email protected]>
1111
Johan Bergström <[email protected]>
1212
Johan Swensson <[email protected]>
13+
Joseph Pisciotta <[email protected]>
1314
1415
Lukas Zapletal <[email protected]>
1516
Marcelo Moreira de Mello <[email protected]>

bootstrap.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,13 +420,20 @@ def generate_katello_facts():
420420
"""
421421
Write katello_facts file based on FQDN. Done after installation
422422
of katello-ca-consumer RPM in case the script is overriding the
423-
FQDN
423+
FQDN. Place the location if the location option is included
424424
"""
425+
425426
print_generic("Writing FQDN katello-fact")
426427
katellofacts = open('/etc/rhsm/facts/katello.facts', 'w')
427428
katellofacts.write('{"network.hostname-override":"%s"}\n' % (FQDN))
428429
katellofacts.close()
429430

431+
if options.location and 'foreman' in options.skip:
432+
print_generic("Writing LOCATION RHSM fact")
433+
locationfacts = open('/etc/rhsm/facts/location.facts', 'w')
434+
locationfacts.write('{"foreman_location":"%s"}\n' % (options.location))
435+
locationfacts.close()
436+
430437

431438
def install_puppet_agent():
432439
"""Install and configure, then enable and start the Puppet Agent"""
@@ -1250,6 +1257,9 @@ def exec_service(service, command, failonerror=True):
12501257
if options.enablerepos:
12511258
enable_repos()
12521259

1260+
if options.location and 'foreman' in options.skip:
1261+
delete_file('/etc/rhsm/facts/location.facts')
1262+
12531263
if not options.remove and not options.new_capsule:
12541264
# > IF not removing, install Katello agent, optionally update host,
12551265
# > optionally clean and install Puppet agent

0 commit comments

Comments
 (0)