Skip to content

Instantly share code, notes, and snippets.

@raphink
Last active December 15, 2015 18:59
Show Gist options
  • Select an option

  • Save raphink/5308437 to your computer and use it in GitHub Desktop.

Select an option

Save raphink/5308437 to your computer and use it in GitHub Desktop.
require 'puppet'
require 'puppet/type/user'
resource = Puppet::Type::User.new(:name => 'rpinson', :uid => '1502')
# resource = Puppet::Type::Exec.new(:name => '/bin/test', :unless => '/bin/true')
# resource = Puppet::Type::Service.new(:name => 'ssh', :ensure => 'running', :enable => 'false')
# Ensurable
if resource.provider.respond_to?(:exists?) and ! resource.provider.exists?
return false
end
return resource.insync?(resource.retrieve) # Catch exceptions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment