summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Zachariasen <thewyzard@hotmail.com>2018-02-14 13:30:27 -0700
committerGitHub <noreply@github.com>2018-02-14 13:30:27 -0700
commit54303a1260a7bdab12af4e65a8a2b4e6d3f0585a (patch)
tree108a16db92388065fb377ecd1794ac1c2cbc9e4c
parentf8186448672814136420365252a5ab75ffe6f655 (diff)
parentf2b345a4314a19929fe7271bd3eaee1f590a695f (diff)
downloadohai-54303a1260a7bdab12af4e65a8a2b4e6d3f0585a.tar.gz
Merge branch 'master' into lxd-update
-rw-r--r--CHANGELOG.md14
-rw-r--r--VERSION2
-rw-r--r--lib/ohai/plugins/aix/uptime.rb2
-rw-r--r--lib/ohai/version.rb2
-rw-r--r--spec/unit/plugins/aix/uptime_spec.rb14
5 files changed, 23 insertions, 11 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 99135448..d3d99162 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,9 +1,17 @@
# Change Log
-<!-- latest_release -->
+<!-- latest_release 14.0.2 -->
+## [v14.0.2](https://github.com/chef/ohai/tree/v14.0.2) (2018-02-12)
+
+#### Merged Pull Requests
+- adds whitespace stripping for the shellout stdout [#1132](https://github.com/chef/ohai/pull/1132) ([rmcleod8](https://github.com/rmcleod8))
<!-- latest_release -->
-<!-- release_rollup -->
+<!-- release_rollup since=13.7.1 -->
+### Changes since 13.7.1 release
+
+#### Merged Pull Requests
+- adds whitespace stripping for the shellout stdout [#1132](https://github.com/chef/ohai/pull/1132) ([rmcleod8](https://github.com/rmcleod8)) <!-- 14.0.2 -->
<!-- release_rollup -->
<!-- latest_stable_release -->
@@ -715,4 +723,4 @@
- Normalize cloud attributes for Azure (OHAI-554)
- Capture FreeBSD osreldate for comparison purposes (OHAI-557)
-<http://www.chef.io/blog/2014/04/09/release-chef-client-11-12-2/>
+<http://www.chef.io/blog/2014/04/09/release-chef-client-11-12-2/> \ No newline at end of file
diff --git a/VERSION b/VERSION
index 8d2e58b4..112969d1 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-14.0.1 \ No newline at end of file
+14.0.2 \ No newline at end of file
diff --git a/lib/ohai/plugins/aix/uptime.rb b/lib/ohai/plugins/aix/uptime.rb
index 85537ba7..ec515aa2 100644
--- a/lib/ohai/plugins/aix/uptime.rb
+++ b/lib/ohai/plugins/aix/uptime.rb
@@ -27,7 +27,7 @@ Ohai.plugin(:Uptime) do
# 1148-20:54:50
# 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
+ so = shell_out("LC_ALL=POSIX ps -o etime= -p 1").stdout.strip
# 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
diff --git a/lib/ohai/version.rb b/lib/ohai/version.rb
index 4848dc3f..b363dc4e 100644
--- a/lib/ohai/version.rb
+++ b/lib/ohai/version.rb
@@ -18,5 +18,5 @@
module Ohai
OHAI_ROOT = File.expand_path(File.dirname(__FILE__))
- VERSION = "14.0.1"
+ VERSION = "14.0.2"
end
diff --git a/spec/unit/plugins/aix/uptime_spec.rb b/spec/unit/plugins/aix/uptime_spec.rb
index f9bf2368..d3cf47c8 100644
--- a/spec/unit/plugins/aix/uptime_spec.rb
+++ b/spec/unit/plugins/aix/uptime_spec.rb
@@ -24,15 +24,19 @@ describe Ohai::System, "Aix plugin uptime" do
@plugin = get_plugin("aix/uptime")
allow(@plugin).to receive(:collect_os).and_return(:aix)
allow(@plugin).to receive(:shell_out).and_call_original
- 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
- it "should set uptime_seconds to uptime with days" do
+ it "should set uptime_seconds and uptime standard case" do
+ 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
expect(@plugin[:uptime_seconds]).to eq(99262490)
+ expect(@plugin[:uptime]).to eq("1148 days 20 hours 54 minutes 50 seconds")
end
- it "should set uptime to a human readable date with days" do
- expect(@plugin[:uptime]).to eq("1148 days 20 hours 54 minutes 50 seconds")
+ it "should set uptime_seconds and uptime in the whitespace case" do
+ allow(@plugin).to receive(:shell_out).with("LC_ALL=POSIX ps -o etime= -p 1").and_return(mock_shell_out(0, " 2-20:54:50", nil))
+ @plugin.run
+ expect(@plugin[:uptime_seconds]).to eq(248090)
+ expect(@plugin[:uptime]).to eq("2 days 20 hours 54 minutes 50 seconds")
end
end