Skip to content

Instantly share code, notes, and snippets.

@Phelms215
Created July 18, 2014 19:43
Show Gist options
  • Save Phelms215/654280dfb51f2a391e62 to your computer and use it in GitHub Desktop.
Save Phelms215/654280dfb51f2a391e62 to your computer and use it in GitHub Desktop.
updateList = node["UPDATES"]
updateList.each do |(key,x)|
puts x['Name']
updateTime = Time.at( x["Time"].to_i / 1000 )
t1 = Time.now
now = Time.at(t1.to_i)
puts updateTime
if now > updateTime
if platform?("redhat", "centos", "fedora")
yum_package "#{x['Name']}" do
version "#{x['Version']}"
allow_downgrade true
action :upgrade
end
end #end platform redhat
#
# Run if platform is debian or ubuntu
#
if platform?("ubuntu", "debian")
apt_package "#{x['Name']}" do
version "#{x['Version']}"
allow_downgrade true
action :upgrade
end
end #end of if platform deb
node.delete("UPDATES[#{key}]")
node.save
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment