Problem:
I am trying to get foreman, chef and SUSE all playing together nicely. I got it all setup following the git installation method (as the installer doesn’t like SUSE) and everything is kind of working, but when I looked at the hostlist once a server has checked in using chef-handler-foreman in the chef client there was no information about operating system and platform etc showing. I tracked that down to an error where the foreman_chef plugin was falling back to the generic type Operatingsystem class instead of using the suse class. This was due to the fact that lsb::id is being used for os_name and is set to “SUSE” in capitals which the plugin doesn’t take account off (it needs to be “Suse” I will raise a bug for this shortly.)
If I change the foreman_chef plugin fact_parser.rb to fix the above I then get a new host created every time a server checks with the FQDN as the host name instead of the hostname devoid of the domain (as it was before I fixed it) and I cannot work out why. Basically I either have it erroring in the logs and dropping to the generic os class or I get a constant stream of duplicate hosts if I fix it. It feels like something to do with report import and fact import now doing different things if I fix it.
Expected outcome:
Report and Facts are set against the same host each chef run, duplicate hosts are not created.
Foreman and Proxy versions:
Foreman 1.16, smart_proxy 1.16
Foreman and Proxy plugin versions:
foreman_chef 0.6, smart_proxy_chef 0.2.0
case os_name
when 'CentOS'
if major.to_i >= 7
# get the minor.build number, e.g. 7.2.1511 -> 2.1511
minor = release[2..-1]
end
when 'SUSE'
os_name = os_name.capitalize
end
Do avoid the exception occurring at line 35 which was:
Which in itself causes foreman to end up with 2 nodes named the same in the hostlist one which ends up being the one that works and the other just sitting there never updating. Strange thing is the osname capitalised in chef-handler-foreman during fact processing, so I’m not sure what’s going on there.