@@ -1448,31 +1448,32 @@ def exec_service(service, command, failonerror=True):
14481448 if 'katello-agent' in options .skip :
14491449 print_warning ("Skipping the installation of the Katello Agent is now the default behavior. passing --skip katello-agent is deprecated" )
14501450 API_PORT = get_api_port ()
1451- smart_proxy_id = return_matching_foreman_key ('smart_proxies' , 'name="%s"' % options .foreman_fqdn , 'id' , False )
1452- current_host_id = return_matching_foreman_key ('hosts' , 'name="%s"' % FQDN , 'id' , False )
1453- capsule_features = get_capsule_features (smart_proxy_id )
1454-
1455- # Optionally configure new hostgroup, location
1456- if options .hostgroup :
1457- print_running ("Calling Foreman API to switch hostgroup for %s to %s" % (FQDN , options .hostgroup ))
1458- update_host_config ('hostgroup' , options .hostgroup , current_host_id )
1459- if options .location :
1460- print_running ("Calling Foreman API to switch location for %s to %s" % (FQDN , options .location ))
1461- update_host_config ('location' , options .location , current_host_id )
1462-
1463- # Configure new proxy_id for Puppet (if not skipped), and OpenSCAP (if available and not skipped)
1464- if 'foreman' not in options .skip and 'puppet' not in options .skip :
1465- print_running ("Calling Foreman API to update Puppet master and Puppet CA for %s to %s" % (FQDN , options .foreman_fqdn ))
1466- update_host_capsule_mapping ("puppet_proxy_id" , smart_proxy_id , current_host_id )
1467- update_host_capsule_mapping ("puppet_ca_proxy_id" , smart_proxy_id , current_host_id )
1468- if 'foreman' not in options .skip and 'Openscap' in capsule_features :
1469- print_running ("Calling Foreman API to update OpenSCAP proxy for %s to %s" % (FQDN , options .foreman_fqdn ))
1470- update_host_capsule_mapping ("openscap_proxy_id" , smart_proxy_id , current_host_id )
1471- elif 'foreman' not in options .skip and 'Openscap' not in capsule_features :
1472- print_warning ("New capsule doesn't have OpenSCAP capability, not switching / configuring openscap_proxy_id" )
1473-
1474- print_running ("Calling Foreman API to update content source for %s to %s" % (FQDN , options .foreman_fqdn ))
1475- update_host_capsule_mapping ("content_source_id" , smart_proxy_id , current_host_id )
1451+ if 'foreman' not in options .skip :
1452+ current_host_id = return_matching_foreman_key ('hosts' , 'name="%s"' % FQDN , 'id' , False )
1453+
1454+ # Optionally configure new hostgroup, location
1455+ if options .hostgroup :
1456+ print_running ("Calling Foreman API to switch hostgroup for %s to %s" % (FQDN , options .hostgroup ))
1457+ update_host_config ('hostgroup' , options .hostgroup , current_host_id )
1458+ if options .location :
1459+ print_running ("Calling Foreman API to switch location for %s to %s" % (FQDN , options .location ))
1460+ update_host_config ('location' , options .location , current_host_id )
1461+
1462+ # Configure new proxy_id for Puppet (if not skipped), and OpenSCAP (if available and not skipped)
1463+ smart_proxy_id = return_matching_foreman_key ('smart_proxies' , 'name="%s"' % options .foreman_fqdn , 'id' , False )
1464+ capsule_features = get_capsule_features (smart_proxy_id )
1465+ if 'puppet' not in options .skip :
1466+ print_running ("Calling Foreman API to update Puppet master and Puppet CA for %s to %s" % (FQDN , options .foreman_fqdn ))
1467+ update_host_capsule_mapping ("puppet_proxy_id" , smart_proxy_id , current_host_id )
1468+ update_host_capsule_mapping ("puppet_ca_proxy_id" , smart_proxy_id , current_host_id )
1469+ if 'Openscap' in capsule_features :
1470+ print_running ("Calling Foreman API to update OpenSCAP proxy for %s to %s" % (FQDN , options .foreman_fqdn ))
1471+ update_host_capsule_mapping ("openscap_proxy_id" , smart_proxy_id , current_host_id )
1472+ else :
1473+ print_warning ("New capsule doesn't have OpenSCAP capability, not switching / configuring openscap_proxy_id" )
1474+
1475+ print_running ("Calling Foreman API to update content source for %s to %s" % (FQDN , options .foreman_fqdn ))
1476+ update_host_capsule_mapping ("content_source_id" , smart_proxy_id , current_host_id )
14761477
14771478 enable_rhsmcertd ()
14781479
0 commit comments