choria-plugins / puppet-agent

Choria Plugin capable of managing the Puppet Agent
https://choria.io
Apache License 2.0
1 stars 8 forks source link

mco puppet resource host functionality no longer works #55

Open rjd1 opened 3 years ago

rjd1 commented 3 years ago

The use of 'mco puppet resource host ...' currently results in an error. For example:

[rjd1@myserver ~]$ mco puppet resource host somehost ensure=absent -I /somenode/

 * [ ============================================================> ] 1 / 1

somenode.domain.com         Unknown Request Status
   undefined method `new' for nil:NilClass

Summary of Changed:

   No Change = 1

Finished processing 1 / 1 hosts in 1525.93 ms

[rjd1@myserver ~]$

From choria-mcorpc.log on the end node:

I, [2021-07-12T11:01:20.057708 #24966]  INFO -- : config.rb:158:in `loadconfig' The Marionette Collective version 2.24.1 started by /usr/bin/choria_mcollective_agent_compat.rb using config file /etc/choria/choria-shim.cfg
E, [2021-07-12T11:01:21.182521 #24966] ERROR -- : agent.rb:102:in `rescue in handlemsg' puppet#resource failed: NoMethodError: undefined method `new' for nil:NilClass
E, [2021-07-12T11:01:21.182650 #24966] ERROR -- : agent.rb:103:in `rescue in handlemsg' /opt/puppetlabs/mcollective/plugins/mcollective/agent/puppet.rb:189:in `block in <class:Puppet>'
    /opt/puppetlabs/puppet/lib/ruby/gems/2.7.0/gems/choria-mcorpc-support-2.24.1/lib/mcollective/rpc/agent.rb:85:in `handlemsg'
    /usr/bin/choria_mcollective_agent_compat.rb:99:in `block in dispatch'
    /opt/puppetlabs/puppet/lib/ruby/2.7.0/timeout.rb:95:in `block in timeout'
    /opt/puppetlabs/puppet/lib/ruby/2.7.0/timeout.rb:33:in `block in catch'
    /opt/puppetlabs/puppet/lib/ruby/2.7.0/timeout.rb:33:in `catch'
    /opt/puppetlabs/puppet/lib/ruby/2.7.0/timeout.rb:33:in `catch'
    /opt/puppetlabs/puppet/lib/ruby/2.7.0/timeout.rb:110:in `timeout'
    /usr/bin/choria_mcollective_agent_compat.rb:94:in `dispatch'
    /usr/bin/choria_mcollective_agent_compat.rb:117:in `<main>'
ripienaar commented 3 years ago

As per slack:

resource = ::Puppet::Type.type(type).new(params)

is where it happens, and the host resource is one of the ones moved out of core recently. I am not sure what we have to do to load external types and providers here tbh.