Using the exists? method

The exists? method retrieves the ensure state of the resource. A Boolean is returned, as shown in the following code:

Puppet::Type.type(:mynewtype).provide(:yum) do
...
confine :osfamily => :redhat
defaultfor: osfamily => :redhat
...
def exists?
begin
rpm('-q', resource[:name])
rescue Puppet::ExecutionFailure => e

       false
end
end
...
end
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.14.168.56