summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-10-30 10:46:36 -0700
committerGitHub <noreply@github.com>2018-10-30 10:46:36 -0700
commit6179cc8fa63e6c321e7dfd9ddc486e8cbf449816 (patch)
treecf5fe6b322944848eb44290b4ad1c1796be17098
parent283c94226f3a262debc5dfc162ee744705a79cbf (diff)
parente2611579caa7b8d904ee840c0d4af20bfdfc4d79 (diff)
downloadohai-6179cc8fa63e6c321e7dfd9ddc486e8cbf449816.tar.gz
Merge pull request #1287 from chef/configs
Fix provided relative paths to the config file
-rw-r--r--lib/ohai/application.rb12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/ohai/application.rb b/lib/ohai/application.rb
index 3b648e9a..55ef9b67 100644
--- a/lib/ohai/application.rb
+++ b/lib/ohai/application.rb
@@ -66,14 +66,6 @@ class Ohai::Application
:proc => lambda { |v| puts "Ohai: #{::Ohai::VERSION}" },
:exit => 0
- def initialize
- super
-
- # Always switch to a readable directory. Keeps subsequent Dir.chdir() {}
- # from failing due to permissions when launched as a less privileged user.
- Dir.chdir("/")
- end
-
def run
elapsed = Benchmark.measure do
configure_ohai
@@ -92,6 +84,10 @@ class Ohai::Application
end
def run_application
+ # Always switch to a readable directory. Keeps subsequent Dir.chdir() {}
+ # from failing due to permissions when launched as a less privileged user.
+ Dir.chdir("/")
+
config[:invoked_from_cli] = true
ohai = Ohai::System.new(config)
ohai.all_plugins(@attributes)