Sha256: bad3ab67e446c07a43075c3c28bd468bde20a4c0b086cf7649229c53d699942f
Contents?: true
Size: 832 Bytes
Versions: 2
Compression:
Stored size: 832 Bytes
Contents
require 'rubygems' require 'json' class Sfp::Module::OS include Sfp::Resource def update_state @state['running'] = true #@state['auto_upgrade'] = @model['auto_upgrade'] # get memory info if `which free`.strip != '' mem = `free`.split("\n")[1].split(" ") @state["memory_total"] = mem[1].to_i @state["memory_free"] = mem[3].to_i else @state["memory_total"] = @state["memory_free"] = -1 end # get platform, architecture, kernel version @state["type"] = `uname -s`.strip @state["version"] = `uname -r`.strip @state["arch"] = `uname -p`.strip @state["platform"] = RUBY_PLATFORM end def apply(p={}) self.upgrade if @model['auto_upgrade'] end def upgrade(p={}) return !!system('apt-get update; apt-get upgrade -y') end def stop(p={}) return !!system('/sbin/shutdown -h now') end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nuri-0.5.5 | modules/os/os.rb |
nuri-0.5.4 | modules/os/os.rb |