puppet-mcollective icon indicating copy to clipboard operation
puppet-mcollective copied to clipboard

refresh-mcollective-metadata produces invalid fact file

Open alexjfisher opened this issue 7 years ago • 2 comments

Following PRs https://github.com/voxpupuli/puppet-mcollective/pull/346 https://github.com/voxpupuli/puppet-mcollective/pull/353 and https://github.com/voxpupuli/puppet-mcollective/pull/358 the refresh-mcollective-metadata cronjob still produces a file that mcollective is not able to correctly parse.

Mcollective assumes all the facts will be top level keys. Instead they are now all nested under values. See https://github.com/voxpupuli/puppet-mcollective/pull/346#issuecomment-351820746

A few options I could think of...

  1. Revert the PRs.
  2. Have the cron somehow parse the output of puppet facts to extract the values hash.
  3. Submit a PR to mcollective (patching this)

alexjfisher avatar Dec 15 '17 09:12 alexjfisher

argh :) and I first thought my mco facter filters are wrong.. I workaround this with an ugly sed:

  1. remove the 3rd line (values:)
  2. remove the two spaces of the yaml at the beginning of every line

|sed '3d' | sed 's/^ //'

khaefeli avatar Feb 27 '18 14:02 khaefeli

I just change the command for refresh-mcollective-metadata cron in modules/mcollective/manifests/server/config/factsource/yaml.pp as follows:

  cron { 'refresh-mcollective-metadata':
    command => "facter -p --yaml >${yaml_fact_path_real} 2>&1",
    ....

akomakom avatar Feb 27 '18 16:02 akomakom