diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2014-11-03 12:16:38 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2014-11-08 11:24:36 -0800 |
commit | 73302b061284f485c9ec67cc17badc48269dc094 (patch) | |
tree | 0f4436c6eb27b67ffa29c6d2a4dc76b2fbc07acb /lib/chef/util/selinux.rb | |
parent | 161df7e0fc6fc2f5fa4377209d5013c7b5457d6e (diff) | |
download | chef-73302b061284f485c9ec67cc17badc48269dc094.tar.gz |
extract which to a mixin, use for systemctl
Diffstat (limited to 'lib/chef/util/selinux.rb')
-rw-r--r-- | lib/chef/util/selinux.rb | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/lib/chef/util/selinux.rb b/lib/chef/util/selinux.rb index 92d5756552..778da042e3 100644 --- a/lib/chef/util/selinux.rb +++ b/lib/chef/util/selinux.rb @@ -21,6 +21,7 @@ # limitations under the License. require 'chef/mixin/shell_out' +require 'chef/mixin/which' class Chef class Util @@ -32,6 +33,7 @@ class Chef module Selinux include Chef::Mixin::ShellOut + include Chef::Mixin::Which # We want to initialize below variables once during a # chef-client run therefore they are class variables. @@ -67,15 +69,6 @@ class Chef @@selinuxenabled_path end - def which(cmd) - paths = ENV['PATH'].split(File::PATH_SEPARATOR) + [ '/bin', '/usr/bin', '/sbin', '/usr/sbin' ] - paths.each do |path| - filename = File.join(path, cmd) - return filename if File.executable?(filename) - end - false - end - def check_selinux_enabled? if selinuxenabled_path cmd = shell_out!(selinuxenabled_path, :returns => [0,1]) @@ -97,4 +90,3 @@ class Chef end end end - |