summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2016-06-30 11:30:04 -0700
committerTim Smith <tsmith@chef.io>2016-06-30 11:30:04 -0700
commitce2d661ce7b1aa13f7d2bc6cacb4e1b1f0785e73 (patch)
tree1c381f822d60a3b2f342839168a8d3daa1cfd206
parentbcff227735417f78184ddad70771d369d62bbc5d (diff)
downloadohai-time.tar.gz
Move timezone value under timetime
This prevents us from breaking the various timezone cookbooks that already use that namespace. Attributes are hard. Good thing lamont is going to fix this all ;) Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/ohai/plugins/timezone.rb5
-rw-r--r--spec/unit/plugins/timezone_spec.rb2
2 files changed, 4 insertions, 3 deletions
diff --git a/lib/ohai/plugins/timezone.rb b/lib/ohai/plugins/timezone.rb
index fb35987d..26a63e42 100644
--- a/lib/ohai/plugins/timezone.rb
+++ b/lib/ohai/plugins/timezone.rb
@@ -15,9 +15,10 @@
# limitations under the License.
Ohai.plugin(:Timezone) do
- provides "timezone"
+ provides "time/timezone"
collect_data(:default) do
- timezone Time.now.getlocal.zone
+ time Mash.new unless time
+ time[:timezone] = Time.now.getlocal.zone
end
end
diff --git a/spec/unit/plugins/timezone_spec.rb b/spec/unit/plugins/timezone_spec.rb
index 770dc838..62fcb0ef 100644
--- a/spec/unit/plugins/timezone_spec.rb
+++ b/spec/unit/plugins/timezone_spec.rb
@@ -25,6 +25,6 @@ describe Ohai::System, "timezone plugin" do
it "should get the local timezone" do
@plugin.run
- expect(@plugin["timezone"]).to eq("ZZZ")
+ expect(@plugin["time"]["timezone"]).to eq("ZZZ")
end
end