Project

General

Profile

Bug #15524

Updated by Ivan Necas over 8 years ago

When importing facts, Foreman checks the last_compile time Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1348266  
  Description of problem: 
 Setting facts foreman_location or foreman_organiation are not recognized anymore when provisioning a new host. The same process worked in Sat6.1 and prevents importing facts Sat6.0: 

 [crash] root@li-lc-1589:~# sudo facter -p foreman_organization 
 if that even appeared within previous minute https://github.com/theforeman/foreman/blob/1.11.3/app/models/host/base.rb#L142 Hilti 
 [crash] root@li-lc-1589:~# sudo facter -p foreman_location 
 HAG 

 This means importing [crash] root@li-lc-1589:~# sudo puppet agent -t -v --noop 
 Info: Creating a new SSL key for li-lc-1589.hag.hilti.com 
 Info: Caching certificate for ca 
 Info: csr_attributes file loading from /etc/puppet/csr_attributes.yaml 
 Info: Creating a new SSL certificate request for li-lc-1589.hag.hilti.com 
 Info: Certificate Request fingerprint (SHA256): 33:C...:99 
 Info: Caching certificate for li-lc-1589.hag.hilti.com 
 Info: Caching certificate_revocation_list for ca 
 Info: Caching certificate for ca 
 Warning: Unable to fetch my node definition, but the subscription-manager facts agent run will break loading puppet facts, if done too quickly continue: 
 (which Warning: Error 400 on SERVER: Failed to find li-lc-1589.hag.hilti.com via exec: Execution of '/etc/puppet/node.rb li-lc-1589.hag.hilti.com' returned 1: 
 Info: Retrieving plugin 
 Info: Loading facts in /var/lib/puppet/lib/facter/service_provider.rb 
 Info: Loading facts in /var/lib/puppet/lib/facter/hilti_oracle.rb 
 Info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb 
 Info: Loading facts in /var/lib/puppet/lib/facter/pe_version.rb 
 Info: Loading facts in /var/lib/puppet/lib/facter/package_provider.rb 
 Info: Loading facts in /var/lib/puppet/lib/facter/hilti_provisioning.rb 
 Info: Loading facts in /var/lib/puppet/lib/facter/hilti_hardware.rb 
 Info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb 
 Info: Loading facts in /var/lib/puppet/lib/facter/hilti_aws.rb 
 Info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb 
 Info: Loading facts in /var/lib/puppet/lib/facter/hilti_os.rb 
 Info: Caching catalog for li-lc-1589.hag.hilti.com 
 Info: Applying configuration version '1466436636' 
 Notice: Finished catalog run in 0.06 seconds 


 The host is usually added to Sat6, but the case when provisioning) location and organization fields are empty: 

 [crash] root@li-lc-1578:~# curl -K /opt/hoici/etc/sat6/curl-hoici.conf "-HContent-Type: application/json" "-d{\"per_page\":9999,\"search\":\"name=li-lc-1589.hag.hilti.com\"}" -XGET https://localhost/api/v2/hosts | jq . | egrep '(organization|location)' 
       "location_name": null, 
       "location_id": null, 
       "organization_name": null, 
       "organization_id": null, 

 The settings with the fact name to use are set: 

 [crash] root@li-lc-1578:~# curl -K /opt/hoici/etc/sat6/curl-hoici.conf "-HContent-Type: application/json" "-d{\"per_page\":9999}" -XGET https://localhost/api/v2/settings | jq . | grep -A1 tion_fact 
       "name": "location_fact", 
       "value": "foreman_location", 
 -- 
       "name": "organization_fact", 
       "value": "foreman_organization", 


 Version-Release number of selected component (if applicable): 


 How reproducible: 


 Steps to Reproduce: 
 1. Make sure the default location and orgianzation settings are kept empty (defaults after installation) 
 1. Create org A and B 
 2. Create location A and B 
 3. Goto a new host the and create facts foreman_location and foreman_organization, set both to B 
 4. Register a new host 
 5. Check location and organization association 

 Actual results: 
 location and organization not set 

 Expected results: 
 host associated with location B and organization B 


 Additional info:

Back