diff options
Diffstat (limited to 'lib/chef/provider')
-rw-r--r-- | lib/chef/provider/git.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/group/groupmod.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/mount/mount.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/osx_profile.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/package/pacman.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/package/rpm.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/package/windows.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/package/windows/registry_uninstall_entry.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/package/yum.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/service.rb | 4 | ||||
-rw-r--r-- | lib/chef/provider/service/aixinit.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/service/freebsd.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/template.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/user/dscl.rb | 10 | ||||
-rw-r--r-- | lib/chef/provider/user/useradd.rb | 2 |
15 files changed, 20 insertions, 20 deletions
diff --git a/lib/chef/provider/git.rb b/lib/chef/provider/git.rb index f8a8dabb46..600da540e5 100644 --- a/lib/chef/provider/git.rb +++ b/lib/chef/provider/git.rb @@ -126,7 +126,7 @@ class Chef end def add_remotes - if (@new_resource.additional_remotes.length > 0) + if @new_resource.additional_remotes.length > 0 @new_resource.additional_remotes.each_pair do |remote_name, remote_url| converge_by("add remote #{remote_name} from #{remote_url}") do Chef::Log.info "#{@new_resource} adding git remote #{remote_name} = #{remote_url}" diff --git a/lib/chef/provider/group/groupmod.rb b/lib/chef/provider/group/groupmod.rb index 379d00e286..98846aa418 100644 --- a/lib/chef/provider/group/groupmod.rb +++ b/lib/chef/provider/group/groupmod.rb @@ -25,7 +25,7 @@ class Chef def load_current_resource super - [ "group", "user" ].each do |binary| + %w(group user).each do |binary| raise Chef::Exceptions::Group, "Could not find binary /usr/sbin/#{binary} for #{@new_resource}" unless ::File.exists?("/usr/sbin/#{binary}") end end diff --git a/lib/chef/provider/mount/mount.rb b/lib/chef/provider/mount/mount.rb index f8b8684a1b..8f9f8b05d4 100644 --- a/lib/chef/provider/mount/mount.rb +++ b/lib/chef/provider/mount/mount.rb @@ -42,7 +42,7 @@ class Chef def mountable? # only check for existence of non-remote devices - if (device_should_exist? && !::File.exists?(device_real) ) + if device_should_exist? && !::File.exists?(device_real) raise Chef::Exceptions::Mount, "Device #{@new_resource.device} does not exist" elsif( @new_resource.mount_point != "none" && !::File.exists?(@new_resource.mount_point) ) raise Chef::Exceptions::Mount, "Mount point #{@new_resource.mount_point} does not exist" diff --git a/lib/chef/provider/osx_profile.rb b/lib/chef/provider/osx_profile.rb index e93d29bd1f..1bef30d53b 100644 --- a/lib/chef/provider/osx_profile.rb +++ b/lib/chef/provider/osx_profile.rb @@ -234,7 +234,7 @@ class Chef end def read_plist(xml_file) - Plist::parse_xml(xml_file) + Plist.parse_xml(xml_file) end def profile_installed? diff --git a/lib/chef/provider/package/pacman.rb b/lib/chef/provider/package/pacman.rb index 22fa9c2307..460f4c4ea2 100644 --- a/lib/chef/provider/package/pacman.rb +++ b/lib/chef/provider/package/pacman.rb @@ -52,7 +52,7 @@ class Chef def candidate_version return @candidate_version if @candidate_version - repos = ["extra", "core", "community"] + repos = %w(extra core community) if(::File.exists?("/etc/pacman.conf")) pacman = ::File.read("/etc/pacman.conf") diff --git a/lib/chef/provider/package/rpm.rb b/lib/chef/provider/package/rpm.rb index c72c9559c8..c00f0ebbd4 100644 --- a/lib/chef/provider/package/rpm.rb +++ b/lib/chef/provider/package/rpm.rb @@ -25,7 +25,7 @@ class Chef class Package class Rpm < Chef::Provider::Package - provides :rpm_package, os: [ "linux", "aix" ] + provides :rpm_package, os: %w(linux aix) include Chef::Mixin::GetSourceFromPackage diff --git a/lib/chef/provider/package/windows.rb b/lib/chef/provider/package/windows.rb index dc22de7ad5..f0c60db29e 100644 --- a/lib/chef/provider/package/windows.rb +++ b/lib/chef/provider/package/windows.rb @@ -105,7 +105,7 @@ class Chef return :nsis end - if (io.tell() < filesize) + if io.tell() < filesize io.seek(io.tell() - overlap) end end diff --git a/lib/chef/provider/package/windows/registry_uninstall_entry.rb b/lib/chef/provider/package/windows/registry_uninstall_entry.rb index 952a0f76b9..3fa00b6081 100644 --- a/lib/chef/provider/package/windows/registry_uninstall_entry.rb +++ b/lib/chef/provider/package/windows/registry_uninstall_entry.rb @@ -17,7 +17,7 @@ # limitations under the License. # -require "win32/registry" if (RUBY_PLATFORM =~ /mswin|mingw32|windows/) +require "win32/registry" if RUBY_PLATFORM =~ /mswin|mingw32|windows/ class Chef class Provider diff --git a/lib/chef/provider/package/yum.rb b/lib/chef/provider/package/yum.rb index aeecf3869e..858b430abe 100644 --- a/lib/chef/provider/package/yum.rb +++ b/lib/chef/provider/package/yum.rb @@ -128,7 +128,7 @@ class Chef y_pos_max = y.length - 1 y_comp = nil - while (x_pos <= x_pos_max and y_pos <= y_pos_max) + while x_pos <= x_pos_max and y_pos <= y_pos_max # first we skip over anything non alphanumeric while (x_pos <= x_pos_max) and (isalnum(x[x_pos]) == false) x_pos += 1 # +1 over pos_max if end of string diff --git a/lib/chef/provider/service.rb b/lib/chef/provider/service.rb index 390330aed2..3b78cb4afc 100644 --- a/lib/chef/provider/service.rb +++ b/lib/chef/provider/service.rb @@ -50,10 +50,10 @@ class Chef # XXX?: the #nil? check below will likely fail if this is a cloned resource or if # we just run multiple actions. def load_new_resource_state - if ( @new_resource.enabled.nil? ) + if @new_resource.enabled.nil? @new_resource.enabled(@current_resource.enabled) end - if ( @new_resource.running.nil? ) + if @new_resource.running.nil? @new_resource.running(@current_resource.running) end end diff --git a/lib/chef/provider/service/aixinit.rb b/lib/chef/provider/service/aixinit.rb index 6b451d649a..0234673474 100644 --- a/lib/chef/provider/service/aixinit.rb +++ b/lib/chef/provider/service/aixinit.rb @@ -97,7 +97,7 @@ class Chef priority = {} files.each do |file| - if (RC_D_SCRIPT_NAME =~ file) + if RC_D_SCRIPT_NAME =~ file priority[2] = [($1 == "S" ? :start : :stop), ($2.empty? ? "" : $2.to_i)] if $1 == "S" is_enabled = true diff --git a/lib/chef/provider/service/freebsd.rb b/lib/chef/provider/service/freebsd.rb index 7e475fc878..e556eccf22 100644 --- a/lib/chef/provider/service/freebsd.rb +++ b/lib/chef/provider/service/freebsd.rb @@ -27,7 +27,7 @@ class Chef attr_reader :enabled_state_found - provides :service, os: [ "freebsd", "netbsd" ] + provides :service, os: %w(freebsd netbsd) include Chef::Mixin::ShellOut diff --git a/lib/chef/provider/template.rb b/lib/chef/provider/template.rb index e12d465353..3c46a6eb7d 100644 --- a/lib/chef/provider/template.rb +++ b/lib/chef/provider/template.rb @@ -45,7 +45,7 @@ class Chef super requirements.assert(:create, :create_if_missing) do |a| - a.assertion { ::File::exists?(content.template_location) } + a.assertion { ::File.exists?(content.template_location) } a.failure_message "Template source #{content.template_location} could not be found." a.whyrun "Template source #{content.template_location} does not exist. Assuming it would have been created." a.block_action! diff --git a/lib/chef/provider/user/dscl.rb b/lib/chef/provider/user/dscl.rb index e81a01c764..8c282b0d7e 100644 --- a/lib/chef/provider/user/dscl.rb +++ b/lib/chef/provider/user/dscl.rb @@ -130,7 +130,7 @@ user password using shadow hash.") # Calling shell_out directly since we want to give an input stream shadow_hash_xml = convert_binary_plist_to_xml(shadow_hash_binary.string) - shadow_hash = Plist::parse_xml(shadow_hash_xml) + shadow_hash = Plist.parse_xml(shadow_hash_xml) if shadow_hash["SALTED-SHA512"] # Convert the shadow value from Base64 encoding to hex before consuming them @@ -212,7 +212,7 @@ user password using shadow hash.") # def dscl_set_uid # XXX: mutates the new resource - new_resource.uid(get_free_uid) if (new_resource.uid.nil? || new_resource.uid == "") + new_resource.uid(get_free_uid) if new_resource.uid.nil? || new_resource.uid == "" if uid_used?(new_resource.uid) raise(Chef::Exceptions::RequestedUIDUnavailable, "uid #{new_resource.uid} is already in use") @@ -410,7 +410,7 @@ user password using shadow hash.") salt = OpenSSL::Random.random_bytes(32) iterations = new_resource.iterations # Use the default if not specified by the user - entropy = OpenSSL::PKCS5::pbkdf2_hmac( + entropy = OpenSSL::PKCS5.pbkdf2_hmac( new_resource.password, salt, iterations, @@ -589,7 +589,7 @@ user password using shadow hash.") begin user_plist_file = "#{USER_PLIST_DIRECTORY}/#{new_resource.username}.plist" user_plist_info = run_plutil("convert xml1 -o - #{user_plist_file}") - user_info = Plist::parse_xml(user_plist_info) + user_info = Plist.parse_xml(user_plist_info) rescue Chef::Exceptions::PlistUtilCommandFailed end @@ -695,7 +695,7 @@ user password using shadow hash.") def salted_sha512_pbkdf2_password_match? salt = convert_to_binary(current_resource.salt) - OpenSSL::PKCS5::pbkdf2_hmac( + OpenSSL::PKCS5.pbkdf2_hmac( new_resource.password, salt, current_resource.iterations, diff --git a/lib/chef/provider/user/useradd.rb b/lib/chef/provider/user/useradd.rb index aabd4b5f68..708631e4ab 100644 --- a/lib/chef/provider/user/useradd.rb +++ b/lib/chef/provider/user/useradd.rb @@ -75,7 +75,7 @@ class Chef unless passwd_s.exitstatus == 0 raise_lock_error = false - if ["redhat", "centos"].include?(node[:platform]) + if %w(redhat centos).include?(node[:platform]) passwd_version_check = shell_out!("rpm -q passwd") passwd_version = passwd_version_check.stdout.chomp |