Skip to content

foreman_config_entry consuming polluted value #989

Closed
@nbarrientos

Description

foreman_config_entry consumes the whole string printed to stdout by foreman-rake -- config -k foo when invoked.

If the apipie cache is not generated, Foreman prints to stdout some text, example:

# foreman-rake -- config -k rss_enable
API controllers newer than Apipie cache! Run apipie:cache rake task to regenerate cache.
false

So, as the requested value via foreman_config_entry does not match the current value, (it does actually, but it's prefixed by the apipie bit) then the setting is incorrectly re-set (making the Puppet run slower and adding rubbish to the audit log, for instance).

puppet-agent[348248]: (/Stage[main]/.../Foreman_config_entry[create_new_host_when_report_is_uploaded]/value) value changed "API controllers newer than Apipie cache! Run apipie:cache rake task to regenerate cache.\nfalse" to 'false' (corrective)

We have this patch locally:

code/lib/puppet/provider/foreman_config_entry/cli.rb | 1 +

modified   code/lib/puppet/provider/foreman_config_entry/cli.rb
@@ -17,6 +17,7 @@ Puppet::Type.type(:foreman_config_entry).provide(:cli) do
           :gid                => 'foreman' }.merge(options)
       )
       status = $?
+      output.slice! "API controllers newer than Apipie cache! Run apipie:cache rake task to regenerate cache.\n"
       output if status.success?
     end
   end

To prevent this from happening but of course it's not the best solution. Ideally the output produced by Foreman should go to stderr instead.

What do you think?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions