Skip to content

Instantly share code, notes, and snippets.

@coderforhire
Created May 8, 2013 22:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coderforhire/5544159 to your computer and use it in GitHub Desktop.
Save coderforhire/5544159 to your computer and use it in GitHub Desktop.
def version
Puppet.info("Entering Version")
package = resource[:package_list].first
package = package.to_s
version = `rpm -q --qf #{NEVRAFORMAT} #{package}`
Puppet.info("Resource: #{resource[:version]}")
Puppet.info("Current: #{version}")
return version
end
def version=(value)
Puppet.info("Entering Version=#{value}")
Puppet.info("#{resource[:version]}")
if value == resource[:version]
Puppet.info("current: #{value} is == to wanted #{resource[:version]}")
return -1
end
end
info: Entering Version
info: Resource: 3.1.9-49562.10263
info: Current: 3.1.9.49562.10263
info: Entering Version=3.1.9-49562.10263
info: 3.1.9-49562.10263
info: current: 3.1.9-49562.10263 is == to wanted 3.1.9-49562.10263
notice: /Stage[main]/Exegy::Xrole::Core/Xpack[core-sw]/version: version changed '3.1.9.49562.10263' to '3.1.9-49562.10263'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment