diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/node/mixin/immutablize_array.rb | 6 | ||||
-rw-r--r-- | lib/chef/node/mixin/immutablize_hash.rb | 5 | ||||
-rw-r--r-- | lib/chef/platform/priority_map.rb | 10 | ||||
-rw-r--r-- | lib/chef/property.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider.rb | 4 | ||||
-rw-r--r-- | lib/chef/provider/service/systemd.rb | 26 | ||||
-rw-r--r-- | lib/chef/resource.rb | 2 |
7 files changed, 31 insertions, 24 deletions
diff --git a/lib/chef/node/mixin/immutablize_array.rb b/lib/chef/node/mixin/immutablize_array.rb index 36b8c33528..4401c91067 100644 --- a/lib/chef/node/mixin/immutablize_array.rb +++ b/lib/chef/node/mixin/immutablize_array.rb @@ -1,5 +1,5 @@ #-- -# Copyright:: Copyright 2016-2019, Chef Software Inc. +# Copyright:: Copyright 2016-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -43,6 +43,7 @@ class Chef compact count cycle + deconstruct detect difference dig @@ -59,6 +60,7 @@ class Chef entries fetch filter + filter_map find find_all find_index @@ -71,6 +73,7 @@ class Chef include? index inject + intersection join last lazy @@ -113,6 +116,7 @@ class Chef sum take take_while + tally to_a to_ary to_csv diff --git a/lib/chef/node/mixin/immutablize_hash.rb b/lib/chef/node/mixin/immutablize_hash.rb index 6ffa42a4f3..5e12f88d8e 100644 --- a/lib/chef/node/mixin/immutablize_hash.rb +++ b/lib/chef/node/mixin/immutablize_hash.rb @@ -1,5 +1,5 @@ #-- -# Copyright:: Copyright 2016-2019, Chef Software Inc. +# Copyright:: Copyright 2016-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -40,6 +40,7 @@ class Chef compare_by_identity? count cycle + deconstruct_keys default default_proc detect @@ -60,6 +61,7 @@ class Chef fetch fetch_values filter + filter_map find find_all find_index @@ -109,6 +111,7 @@ class Chef sum take take_while + tally to_a to_h to_hash diff --git a/lib/chef/platform/priority_map.rb b/lib/chef/platform/priority_map.rb index 08b1a2a9fc..45d67731e2 100644 --- a/lib/chef/platform/priority_map.rb +++ b/lib/chef/platform/priority_map.rb @@ -1,6 +1,6 @@ # # Author:: John Keiser (<jkeiser@chef.io>) -# Copyright:: Copyright 2015-2016, Chef Software Inc. +# Copyright:: Copyright 2015-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,8 +21,8 @@ require_relative "../node_map" class Chef class Platform class PriorityMap < Chef::NodeMap - def priority(resource_name, priority_array, *filter) - set_priority_array(resource_name.to_sym, priority_array, *filter) + def priority(resource_name, priority_array, **filter) + set_priority_array(resource_name.to_sym, priority_array, **filter) end # @api private @@ -31,9 +31,9 @@ class Chef end # @api private - def set_priority_array(key, priority_array, *filter, &block) + def set_priority_array(key, priority_array, **filter, &block) priority_array = Array(priority_array) - set(key, priority_array, *filter, &block) + set(key, priority_array, **filter, &block) priority_array end end diff --git a/lib/chef/property.rb b/lib/chef/property.rb index 7fa62442a0..34fde05020 100644 --- a/lib/chef/property.rb +++ b/lib/chef/property.rb @@ -543,7 +543,7 @@ class Chef modified_options.key?(:default) options = options.reject { |k, v| k == :name_attribute || k == :name_property || k == :default } end - self.class.new(options.merge(modified_options)) + self.class.new(**options.merge(modified_options)) end # diff --git a/lib/chef/provider.rb b/lib/chef/provider.rb index 93d2578414..3fa097ce38 100644 --- a/lib/chef/provider.rb +++ b/lib/chef/provider.rb @@ -1,7 +1,7 @@ # # Author:: Adam Jacob (<adam@chef.io>) # Author:: Christopher Walters (<cw@chef.io>) -# Copyright:: Copyright 2008-2016, 2009-2019, Chef Software Inc. +# Copyright:: Copyright 2008-2016, 2009-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -334,7 +334,7 @@ class Chef end def self.provides(short_name, opts = {}, &block) - Chef.provider_handler_map.set(short_name, self, opts, &block) + Chef.provider_handler_map.set(short_name, self, **opts, &block) end def self.provides?(node, resource) diff --git a/lib/chef/provider/service/systemd.rb b/lib/chef/provider/service/systemd.rb index c19a3166a4..f7591c06c3 100644 --- a/lib/chef/provider/service/systemd.rb +++ b/lib/chef/provider/service/systemd.rb @@ -1,7 +1,7 @@ # # Author:: Stephen Haynes (<sh@nomitor.com>) # Author:: Davide Cavalca (<dcavalca@fb.com>) -# Copyright:: Copyright 2011-2019, Chef Software Inc. +# Copyright:: Copyright 2011-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -104,7 +104,7 @@ class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple super else options, args = get_systemctl_options_args - shell_out!("#{systemctl_path} #{args} start #{Shellwords.escape(new_resource.service_name)}", default_env: false, **options) + shell_out!(systemctl_path, args, "start", new_resource.service_name, default_env: false, **options) end end end @@ -117,7 +117,7 @@ class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple super else options, args = get_systemctl_options_args - shell_out!("#{systemctl_path} #{args} stop #{Shellwords.escape(new_resource.service_name)}", default_env: false, **options) + shell_out!(systemctl_path, args, "stop", new_resource.service_name, default_env: false, **options) end end end @@ -127,7 +127,7 @@ class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple super else options, args = get_systemctl_options_args - shell_out!("#{systemctl_path} #{args} restart #{Shellwords.escape(new_resource.service_name)}", default_env: false, **options) + shell_out!(systemctl_path, args, "restart", new_resource.service_name, default_env: false, **options) end end @@ -137,7 +137,7 @@ class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple else if current_resource.running options, args = get_systemctl_options_args - shell_out!("#{systemctl_path} #{args} reload #{Shellwords.escape(new_resource.service_name)}", default_env: false, **options) + shell_out!(systemctl_path, args, "reload", new_resource.service_name, default_env: false, **options) else start_service end @@ -150,7 +150,7 @@ class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple return end options, args = get_systemctl_options_args - shell_out!("#{systemctl_path} #{args} enable #{Shellwords.escape(new_resource.service_name)}", **options) + shell_out!(systemctl_path, args, "enable", new_resource.service_name, **options) end def disable_service @@ -159,38 +159,38 @@ class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple return end options, args = get_systemctl_options_args - shell_out!("#{systemctl_path} #{args} disable #{Shellwords.escape(new_resource.service_name)}", **options) + shell_out!(systemctl_path, args, "disable", new_resource.service_name, **options) end def mask_service options, args = get_systemctl_options_args - shell_out!("#{systemctl_path} #{args} mask #{Shellwords.escape(new_resource.service_name)}", **options) + shell_out!(systemctl_path, args, "mask", new_resource.service_name, **options) end def unmask_service options, args = get_systemctl_options_args - shell_out!("#{systemctl_path} #{args} unmask #{Shellwords.escape(new_resource.service_name)}", **options) + shell_out!(systemctl_path, args, "unmask", new_resource.service_name, **options) end def is_active? options, args = get_systemctl_options_args - shell_out("#{systemctl_path} #{args} is-active #{Shellwords.escape(new_resource.service_name)} --quiet", **options).exitstatus == 0 + shell_out(systemctl_path, args, "is-active", new_resource.service_name, "--quiet", **options).exitstatus == 0 end def is_enabled? options, args = get_systemctl_options_args - shell_out("#{systemctl_path} #{args} is-enabled #{Shellwords.escape(new_resource.service_name)} --quiet", **options).exitstatus == 0 + shell_out(systemctl_path, args, "is-enabled", new_resource.service_name, "--quiet", **options).exitstatus == 0 end def is_indirect? options, args = get_systemctl_options_args - s = shell_out("#{systemctl_path} #{args} is-enabled #{Shellwords.escape(new_resource.service_name)}", **options) + s = shell_out(systemctl_path, args, "is-enabled", new_resource.service_name, **options) s.stdout.include?("indirect") end def is_masked? options, args = get_systemctl_options_args - s = shell_out("#{systemctl_path} #{args} is-enabled #{Shellwords.escape(new_resource.service_name)}", **options) + s = shell_out(systemctl_path, args, "is-enabled", new_resource.service_name, **options) s.exitstatus != 0 && s.stdout.include?("masked") end diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb index 6c7214fdd9..15d9fec12d 100644 --- a/lib/chef/resource.rb +++ b/lib/chef/resource.rb @@ -1376,7 +1376,7 @@ class Chef options[:chef_version] = @chef_version_for_provides end - result = Chef.resource_handler_map.set(name, self, options, &block) + result = Chef.resource_handler_map.set(name, self, **options, &block) Chef::DSL::Resources.add_resource_dsl(name) result end |