Bug #24658
closedForeman out of sync with puppet
Description
Hi,
I am new to foreman and I installed foreman on puppet server in starting of August. Since 14th August, Foreman UI is showing configuration as out of sync.
I could see that puppet.conf file (/etc/puppetlabs/puppet/puppet.conf) was modified on 14th Aug,
[main]
basemodulepath = /etc/puppetlabs/code/environments/common:/etc/puppetlabs/code/modules:/opt/puppetlabs/puppet/modules
environmentpath = /etc/puppetlabs/code/environments
hiera_config = $confdir/hiera.yaml
hostprivkey = $privatekeydir/$certname.pem { mode = 640 }
logdir = /var/log/puppetlabs/puppet
pluginfactsource = puppet:///pluginfacts
pluginsource = puppet:///plugins
privatekeydir = $ssldir/private_keys { group = service }
reports = foreman
rundir = /var/run/puppetlabs
show_diff = false
ssldir = /etc/puppetlabs/puppet/ssl
vardir = /opt/puppetlabs/puppet/cache
Can you tell how this change happened? To what it is linked to? (As a workaround I changed it to reports =log, foreman, but it changed again today to reports = foreman.)
I checked with foreman-rake console command and below are my findings -
[root@puppet ~]# foreman-rake console
Successfully encrypted field for Setting::Auth oauth_consumer_key
Successfully decrypted field for Setting::Auth oauth_consumer_key
Successfully decrypted field for Setting::Auth oauth_consumer_key
Successfully decrypted field for Setting::Auth oauth_consumer_key
Successfully encrypted field for Setting::Auth oauth_consumer_secret
Successfully decrypted field for Setting::Auth oauth_consumer_secret
Successfully decrypted field for Setting::Auth oauth_consumer_secret
Successfully decrypted field for Setting::Auth oauth_consumer_secret
/usr/share/foreman/lib/tasks/console.rake:6: warning: already initialized constant ARGV
For some operations a user must be set, try User.current = User.first
Loading production environment (Rails 4.2.5.1)
Failed to load console gems, starting anyway
irb(main):001:0> Setting[:outofsync_interval]
=> 5
irb(main):002:0> Setting[:puppet_interval]
=> 30
irb(main):001:0> Host.find_by_name('puppet.com').get_status(HostStatus::ConfigurationStatus)
=> #<HostStatus::ConfigurationStatus id: 2, type: "HostStatus::ConfigurationStatus", status: 0, host_id: 1, reported_at: "2018-08-14 11:43:08">
irb(main):002:0> Host.find_by_name('puppet.com').last_report_object.attributes
=> {"id"=>332346, "host_id"=>1, "reported_at"=>Tue, 14 Aug 2018 11:43:08 UTC +00:00, "created_at"=>Tue, 14 Aug 2018 11:43:22 UTC +00:00, "updated_at"=>Tue, 14 Aug 2018 11:43:22 UTC +00:00, "status"=>0, "metrics"=>"--- !ruby/hash:ActionController::Parameters\nresources: !ruby/hash:ActionController::Parameters\n changed: 0\n corrective_change: 0\n failed: 0\n failed_to_restart: 0\n out_of_sync: 0\n restarted: 0\n scheduled: 0\n skipped: 0\n total: 2485\ntime: !ruby/hash:ActionController::Parameters\n config_retrieval: 1.460990565\n file: 0.84233457\n filebucket: 8.8639e-05\n total: 4.788416825\n vcsrepo: 2.485003051\nchanges: !ruby/hash:ActionController::Parameters\n total: 0\nevents: !ruby/hash:ActionController::Parameters\n failure: 0\n success: 0\n total: 0\n", "type"=>"ConfigReport"}
irb(main):003:0> Host.find_by_name('puppet.com').get_status(HostStatus::ConfigurationStatus)
=> #<HostStatus::ConfigurationStatus id: 2, type: "HostStatus::ConfigurationStatus", status: 0, host_id: 1, reported_at: "2018-08-14 11:43:08">
irb(main):004:0> Host.find_by_name('puppet.com').get_status(HostStatus::ConfigurationStatus).relevant?
=> true
irb(main):005:0> Host.find_by_name('puppet.com').refresh_statuses
=> true
irb(main):009:0> Host.find_by_name('puppet.com').get_status(HostStatus::ConfigurationStatus).refresh
=> 0
irb(main):010:0> HostStatus.status_registry
=> #<Set: {HostStatus::ConfigurationStatus(id: integer, type: string, status: integer, host_id: integer, reported_at: datetime), HostStatus::BuildStatus(id: integer, type: string, status: integer, host_id: integer, reported_at: datetime)}>
irb(main):012:0> Report.where(:host_id => 4).limit(2).order('created_at DESC')
=> #<ActiveRecord::Relation []>
What does status = 0 means? Can someone please guide me?
Foreman server is not syncing with puppet server and I need to correct it after knowing the root cause. I am keenly interested in knowing more about foreman so kindly guide me through once.