Add ability to noop a service

We want also be able to noop_resource('service'). In order to do that we
also add stubs for status, start and stop. Without this it fails with:
[root@controller-0 openstack-puppet]# NET_HOST=true DEBUG=True PROCESS_COUNT=1 CONFIG=/root/bandini.json python3 /var/lib/container-puppet/container-puppet.py 2>&1 | tee /tmp/puppet.log |grep Error:
<13>Oct  4 10:28:26 puppet-user: Error: /Service[rsyncd]: Could not evaluate: undefined method `status' for Service[rsyncd](provider=noop):Puppet::Type::Service::ProviderNoop
<13>Oct  4 10:28:26 puppet-user: Error: /Service[rsyncd]: Failed to call refresh: undefined method `status' for Service[rsyncd](provider=noop):Puppet::Type::Service::ProviderNoop
<13>Oct  4 10:28:26 puppet-user: Error: /Service[rsyncd]: undefined method `status' for Service[rsyncd](provider=noop):Puppet::Type::Service::ProviderNoop
<13>Oct  4 10:28:26 puppet-user: Error: /Service[rsyncd]: Could not evaluate: undefined method `status' for Service[rsyncd](provider=noop):Puppet::Type::Service::ProviderNoop
<13>Oct  4 10:28:26 puppet-user: Error: /Service[rsyncd]: Failed to call refresh: undefined method `status' for Service[rsyncd](provider=noop):Puppet::Type::Service::ProviderNoop
<13>Oct  4 10:28:26 puppet-user: Error: /Service[rsyncd]: undefined method `status' for Service[rsyncd](provider=noop):Puppet::Type::Service::ProviderNoop
[root@controller-0 openstack-puppet]# NET_HOST=true DEBUG=True PROCESS_COUNT=1 CONFIG=/root/bandini.json python3 /var/lib/container-puppet/container-puppet.py 2>&1 | tee /tmp/puppet.log |grep Error:
<13>Oct  4 10:29:03 puppet-user: Error: Could not set 'running' on ensure: undefined method `start' for Service[rsyncd](provider=noop):Puppet::Type::Service::ProviderNoop
<13>Oct  4 10:29:03 puppet-user: Error: Could not set 'running' on ensure: undefined method `start' for Service[rsyncd](provider=noop):Puppet::Type::Service::ProviderNoop

Related-Bug: #1945962

Change-Id: I9ee8108fe749e787b82f8f4c226f44685ab21a99
This commit is contained in:
Michele Baldessari 2021-10-04 12:34:21 +02:00
parent 6ebeed4fe5
commit 8e6e49d28d
1 changed files with 11 additions and 0 deletions

View File

@ -33,6 +33,17 @@ class Puppet::Provider::Noop < Puppet::Provider
false
end
def status
0
end
def start
true
end
def stop
true
end
# some puppet-keystone resources require this
def self.resource_to_name(domain, name, check_for_default = true)
return name