diff options
author | richard mcleod <rmcleod8@bloomberg.net> | 2017-09-01 15:02:47 -0400 |
---|---|---|
committer | richard mcleod <rmcleod8@bloomberg.net> | 2017-09-01 15:02:47 -0400 |
commit | 484c295cdac610eff383c02d737c116ae96afeac (patch) | |
tree | f276043492f558e13f23fd7624e5d41a307cfb42 | |
parent | ddc09206c30bc9b655db6bfa764379ed41f1d4fc (diff) | |
download | ohai-484c295cdac610eff383c02d737c116ae96afeac.tar.gz |
not sure why these style changes werent saved
Signed-off-by: richard mcleod <rmcleod8@bloomberg.net>
-rw-r--r-- | lib/ohai/plugins/aix/uptime.rb | 4 | ||||
-rw-r--r-- | spec/unit/plugins/aix/uptime_spec.rb | 3 |
2 files changed, 3 insertions, 4 deletions
diff --git a/lib/ohai/plugins/aix/uptime.rb b/lib/ohai/plugins/aix/uptime.rb index d6b7ac1e..85a7e678 100644 --- a/lib/ohai/plugins/aix/uptime.rb +++ b/lib/ohai/plugins/aix/uptime.rb @@ -28,7 +28,7 @@ Ohai.plugin(:Uptime) do # This reads as 1148 days, 20 hours, 54 minutes, 50 seconds since the process was started (elapsed) # who -b does not return the YEAR, so we need something more concrete so = shell_out("LC_ALL=POSIX ps -o etime= -p 1").stdout - + # Here we'll check our shell_out for a dash, which indicates there is a # of days involved # We'll chunk off the days, hours (where applicable), minutes, seconds into seperate vars # We also need to do this because ps -o etime= will not display days if the machine has been up for less than 24 hours @@ -45,7 +45,7 @@ Ohai.plugin(:Uptime) do (m, s) = so.split(/[:]/) end elapsed_seconds = ((d.to_i * 86400) + (h.to_i * 3600) + (m.to_i * 60) + s.to_i) - + uptime_seconds Time.now.to_i - elapsed_seconds uptime seconds_to_human(elapsed_seconds) end diff --git a/spec/unit/plugins/aix/uptime_spec.rb b/spec/unit/plugins/aix/uptime_spec.rb index cabe1d64..018bcf22 100644 --- a/spec/unit/plugins/aix/uptime_spec.rb +++ b/spec/unit/plugins/aix/uptime_spec.rb @@ -25,8 +25,7 @@ describe Ohai::System, "Aix plugin uptime" do allow(@plugin).to receive(:collect_os).and_return(:aix) allow(@plugin).to receive(:shell_out).and_call_original allow(Time).to receive_message_chain(:now, :to_i).and_return(1504287957) - allow(@plugin).to receive(:shell_out).with("LC_ALL=POSIX ps -o etime= -p 1").and_return(mock_shell_out(0,"1148-20:54:50", nil)) - + allow(@plugin).to receive(:shell_out).with("LC_ALL=POSIX ps -o etime= -p 1").and_return(mock_shell_out(0, "1148-20:54:50", nil)) @plugin.run end |