summaryrefslogtreecommitdiff
path: root/lib/chef/provider
diff options
context:
space:
mode:
author007lva <007.lva@gmail.com>2020-09-24 23:08:12 +0200
committer007lva <007.lva@gmail.com>2020-09-24 23:08:52 +0200
commit6ecacec32423b116e64fdcc11be0e8e18ce94706 (patch)
treeea00b3aa4389335922f42b6e22aa6921f64ad070 /lib/chef/provider
parenta1e8747af72cf91a7b5a729db647e158f46ad01f (diff)
downloadchef-6ecacec32423b116e64fdcc11be0e8e18ce94706.tar.gz
Use Ruby 2.6 endless Range syntax
Signed-off-by: Luigi <007.lva@gmail.com>
Diffstat (limited to 'lib/chef/provider')
-rw-r--r--lib/chef/provider/service/redhat.rb2
-rw-r--r--lib/chef/provider/user/dscl.rb4
-rw-r--r--lib/chef/provider/user/mac.rb4
3 files changed, 5 insertions, 5 deletions
diff --git a/lib/chef/provider/service/redhat.rb b/lib/chef/provider/service/redhat.rb
index 3ef7110002..14b55bef85 100644
--- a/lib/chef/provider/service/redhat.rb
+++ b/lib/chef/provider/service/redhat.rb
@@ -84,7 +84,7 @@ class Chef
chkconfig = shell_out!("/sbin/chkconfig --list #{current_resource.service_name}", returns: [0, 1])
unless run_levels.nil? || run_levels.empty?
all_levels_match = true
- chkconfig.stdout.split(/\s+/)[1..-1].each do |level|
+ chkconfig.stdout.split(/\s+/)[1..].each do |level|
index = level.split(":").first
status = level.split(":").last
if CHKCONFIG_ON.match?(level)
diff --git a/lib/chef/provider/user/dscl.rb b/lib/chef/provider/user/dscl.rb
index 2a7300c017..7b266b8d62 100644
--- a/lib/chef/provider/user/dscl.rb
+++ b/lib/chef/provider/user/dscl.rb
@@ -584,7 +584,7 @@ in 'password', with the associated 'salt' and 'iterations'.")
#
def run_dscl(*args)
- result = shell_out("dscl", ".", "-#{args[0]}", args[1..-1])
+ result = shell_out("dscl", ".", "-#{args[0]}", args[1..])
return "" if ( args.first =~ /^delete/ ) && ( result.exitstatus != 0 )
raise(Chef::Exceptions::DsclCommandFailed, "dscl error: #{result.inspect}") unless result.exitstatus == 0
raise(Chef::Exceptions::DsclCommandFailed, "dscl error: #{result.inspect}") if result.stdout.include?("No such key: ")
@@ -593,7 +593,7 @@ in 'password', with the associated 'salt' and 'iterations'.")
end
def run_plutil(*args)
- result = shell_out("plutil", "-#{args[0]}", args[1..-1])
+ result = shell_out("plutil", "-#{args[0]}", args[1..])
raise(Chef::Exceptions::PlistUtilCommandFailed, "plutil error: #{result.inspect}") unless result.exitstatus == 0
if result.stdout.encoding == Encoding::ASCII_8BIT
diff --git a/lib/chef/provider/user/mac.rb b/lib/chef/provider/user/mac.rb
index a738fa4aa0..a3980aa12f 100644
--- a/lib/chef/provider/user/mac.rb
+++ b/lib/chef/provider/user/mac.rb
@@ -608,7 +608,7 @@ class Chef
end
def run_dscl(*args)
- result = shell_out("dscl", "-plist", ".", "-#{args[0]}", args[1..-1])
+ result = shell_out("dscl", "-plist", ".", "-#{args[0]}", args[1..])
return "" if ( args.first =~ /^delete/ ) && ( result.exitstatus != 0 )
raise(Chef::Exceptions::DsclCommandFailed, "dscl error: #{result.inspect}") unless result.exitstatus == 0
raise(Chef::Exceptions::DsclCommandFailed, "dscl error: #{result.inspect}") if /No such key: /.match?(result.stdout)
@@ -617,7 +617,7 @@ class Chef
end
def run_plutil(*args)
- result = shell_out("plutil", "-#{args[0]}", args[1..-1])
+ result = shell_out("plutil", "-#{args[0]}", args[1..])
raise(Chef::Exceptions::PlistUtilCommandFailed, "plutil error: #{result.inspect}") unless result.exitstatus == 0
result.stdout