diff options
-rw-r--r-- | lib/chef/chef_fs/chef_fs_data_store.rb | 4 | ||||
-rw-r--r-- | lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb | 4 | ||||
-rw-r--r-- | lib/chef/provider/package/windows/exe.rb | 4 | ||||
-rw-r--r-- | lib/chef/provider/package/windows/msi.rb | 2 | ||||
-rw-r--r-- | spec/functional/resource/windows_certificate_spec.rb | 6 | ||||
-rw-r--r-- | spec/unit/policy_builder/policyfile_spec.rb | 4 | ||||
-rw-r--r-- | spec/unit/provider/systemd_unit_spec.rb | 292 | ||||
-rw-r--r-- | spec/unit/run_list/run_list_expansion_spec.rb | 2 |
8 files changed, 159 insertions, 159 deletions
diff --git a/lib/chef/chef_fs/chef_fs_data_store.rb b/lib/chef/chef_fs/chef_fs_data_store.rb index 6b0cb4630a..b74f76cab3 100644 --- a/lib/chef/chef_fs/chef_fs_data_store.rb +++ b/lib/chef/chef_fs/chef_fs_data_store.rb @@ -544,8 +544,8 @@ class Chef result = with_entry([ path[0] ]) do |entry| # list /cookbooks/name = filter /cookbooks/name-version down to name entry.children.map { |child| split_name_version(child.name) } - .select { |name, version| name == path[1] } - .map { |name, version| version } + .select { |name, version| name == path[1] } + .map { |name, version| version } end if result.empty? raise ChefZero::DataStore::DataNotFoundError.new(path) diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb index 7a0dc80f79..a68277d567 100644 --- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb +++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb @@ -53,8 +53,8 @@ class Chef def children entries = Dir.entries(file_path).sort - .map { |child_name| make_child_entry(child_name) } - .select { |child| child && can_have_child?(child.name, child.dir?) } + .map { |child_name| make_child_entry(child_name) } + .select { |child| child && can_have_child?(child.name, child.dir?) } entries.select { |entry| !(entry.dir? && entry.children.size == 0 ) } rescue Errno::ENOENT raise Chef::ChefFS::FileSystem::NotFoundError.new(self, $!) diff --git a/lib/chef/provider/package/windows/exe.rb b/lib/chef/provider/package/windows/exe.rb index 7663bf0ad4..c7460f938e 100644 --- a/lib/chef/provider/package/windows/exe.rb +++ b/lib/chef/provider/package/windows/exe.rb @@ -1,7 +1,7 @@ # # Author:: Seth Chisamore (<schisamo@chef.io>) # Author:: Matt Wrock <matt@mattwrock.com> -# Copyright:: Copyright 2011-2016, Chef Software, Inc. +# Copyright:: Copyright 2011-2019, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -71,7 +71,7 @@ class Chef def remove_package uninstall_version = new_resource.version || current_installed_version uninstall_entries.select { |entry| [uninstall_version].flatten.include?(entry.display_version) } - .map(&:uninstall_string).uniq.each do |uninstall_string| + .map(&:uninstall_string).uniq.each do |uninstall_string| logger.trace("Registry provided uninstall string for #{new_resource} is '#{uninstall_string}'") shell_out!(uninstall_command(uninstall_string), timeout: new_resource.timeout, returns: new_resource.returns) end diff --git a/lib/chef/provider/package/windows/msi.rb b/lib/chef/provider/package/windows/msi.rb index c034d9d31b..0298ad17c5 100644 --- a/lib/chef/provider/package/windows/msi.rb +++ b/lib/chef/provider/package/windows/msi.rb @@ -81,7 +81,7 @@ class Chef else uninstall_version = new_resource.version || installed_version uninstall_entries.select { |entry| [uninstall_version].flatten.include?(entry.display_version) } - .map(&:uninstall_string).uniq.each do |uninstall_string| + .map(&:uninstall_string).uniq.each do |uninstall_string| uninstall_string = "msiexec /x #{uninstall_string.match(/{.*}/)}" uninstall_string += expand_options(new_resource.options) uninstall_string += " /q" unless uninstall_string.downcase =~ / \/q/ diff --git a/spec/functional/resource/windows_certificate_spec.rb b/spec/functional/resource/windows_certificate_spec.rb index 79b3cd890b..9b79de6a77 100644 --- a/spec/functional/resource/windows_certificate_spec.rb +++ b/spec/functional/resource/windows_certificate_spec.rb @@ -81,9 +81,9 @@ describe Chef::Resource::WindowsCertificate, :windows_only, :appveyor_only do # Byepassing the validation so that we may create a custom store allow_any_instance_of(Chef::Mixin::ParamsValidate) - .to receive(:_pv_equal_to) - .with(opts, key, to_be) - .and_return(true) + .to receive(:_pv_equal_to) + .with(opts, key, to_be) + .and_return(true) # Creating a custom store for the testing create_store(store) diff --git a/spec/unit/policy_builder/policyfile_spec.rb b/spec/unit/policy_builder/policyfile_spec.rb index f22e2a74b3..d08a9f5b33 100644 --- a/spec/unit/policy_builder/policyfile_spec.rb +++ b/spec/unit/policy_builder/policyfile_spec.rb @@ -403,9 +403,9 @@ describe Chef::PolicyBuilder::Policyfile do before do allow(policy_builder).to receive(:run_list) - .and_return(run_list) + .and_return(run_list) allow(policy_builder).to receive(:cookbook_lock_for) - .and_return(version_hash) + .and_return(version_hash) end it "sends the run_list_expanded event" do diff --git a/spec/unit/provider/systemd_unit_spec.rb b/spec/unit/provider/systemd_unit_spec.rb index 00f39d0fd9..899d3dc87e 100644 --- a/spec/unit/provider/systemd_unit_spec.rb +++ b/spec/unit/provider/systemd_unit_spec.rb @@ -75,8 +75,8 @@ describe Chef::Provider::SystemdUnit do before(:each) do allow(Etc).to receive(:getpwnam).and_return(OpenStruct.new(uid: 1000)) allow(Chef::Resource::SystemdUnit).to receive(:new) - .with(unit_name) - .and_return(current_resource) + .with(unit_name) + .and_return(current_resource) end describe "define_resource_requirements" do @@ -113,8 +113,8 @@ describe Chef::Provider::SystemdUnit do it "should create a current resource with the name of the new resource" do expect(Chef::Resource::SystemdUnit).to receive(:new) - .with(unit_name) - .and_return(current_resource) + .with(unit_name) + .and_return(current_resource) provider.load_current_resource end @@ -188,26 +188,26 @@ describe Chef::Provider::SystemdUnit do it "loads the system unit content if the file exists and user is not set" do allow(File).to receive(:exist?) - .with(unit_path_system) - .and_return(true) + .with(unit_path_system) + .and_return(true) allow(File).to receive(:read) - .with(unit_path_system) - .and_return(unit_content_string) + .with(unit_path_system) + .and_return(unit_content_string) expect(File).to receive(:exist?) - .with(unit_path_system) + .with(unit_path_system) expect(File).to receive(:read) - .with(unit_path_system) + .with(unit_path_system) provider.load_current_resource expect(current_resource.content).to eq(unit_content_string) end it "does not load the system unit content if the unit file is not present and the user is not set" do allow(File).to receive(:exist?) - .with(unit_path_system) - .and_return(false) + .with(unit_path_system) + .and_return(false) expect(File).to_not receive(:read) - .with(unit_path_system) + .with(unit_path_system) provider.load_current_resource expect(current_resource.content).to eq(nil) end @@ -215,15 +215,15 @@ describe Chef::Provider::SystemdUnit do it "loads the user unit content if the file exists and user is set" do new_resource.user("joe") allow(File).to receive(:exist?) - .with(unit_path_user) - .and_return(true) + .with(unit_path_user) + .and_return(true) allow(File).to receive(:read) - .with(unit_path_user) - .and_return(unit_content_string) + .with(unit_path_user) + .and_return(unit_content_string) expect(File).to receive(:exist?) - .with(unit_path_user) + .with(unit_path_user) expect(File).to receive(:read) - .with(unit_path_user) + .with(unit_path_user) provider.load_current_resource expect(current_resource.content).to eq(unit_content_string) end @@ -231,10 +231,10 @@ describe Chef::Provider::SystemdUnit do it "does not load the user unit if the file does not exist and user is set" do new_resource.user("joe") allow(File).to receive(:exist?) - .with(unit_path_user) - .and_return(false) + .with(unit_path_user) + .and_return(false) expect(File).to_not receive(:read) - .with(unit_path_user) + .with(unit_path_user) provider.load_current_resource expect(current_resource.content).to eq(nil) end @@ -245,27 +245,27 @@ describe Chef::Provider::SystemdUnit do before(:each) do provider.current_resource = current_resource allow(provider).to receive(:which) - .with("systemctl") - .and_return(systemctl_path) + .with("systemctl") + .and_return(systemctl_path) end describe "creates/deletes/presets/reverts the unit" do it "creates the unit file when it does not exist" do allow(provider).to receive(:manage_unit_file) - .with(:create) - .and_return(true) + .with(:create) + .and_return(true) allow(provider).to receive(:daemon_reload) - .and_return(true) + .and_return(true) expect(provider).to receive(:manage_unit_file).with(:create) provider.action_create end it "creates the file when the unit content is different" do allow(provider).to receive(:manage_unit_file) - .with(:create) - .and_return(true) + .with(:create) + .and_return(true) allow(provider).to receive(:daemon_reload) - .and_return(true) + .and_return(true) expect(provider).to receive(:manage_unit_file).with(:create) provider.action_create end @@ -274,7 +274,7 @@ describe Chef::Provider::SystemdUnit do current_resource.content(unit_content_string) allow(provider).to receive(:manage_unit_file).with(:create) allow(provider).to receive(:daemon_reload) - .and_return(true) + .and_return(true) expect(provider).to_not receive(:manage_unit_file) provider.action_create end @@ -286,20 +286,20 @@ describe Chef::Provider::SystemdUnit do expect(new_resource.triggers_reload).to eq true allow(provider).to receive(:shell_out_compacted!) expect(provider).to receive(:shell_out_compacted!) - .with(systemctl_path, "--user", "daemon-reload", **user_cmd_opts, default_env: false) + .with(systemctl_path, "--user", "daemon-reload", **user_cmd_opts, default_env: false) provider.action_create end it "triggers a daemon-reload when deleting a unit with triggers_reload" do new_resource.user("joe") allow(File).to receive(:exist?) - .with(unit_path_user) - .and_return(true) + .with(unit_path_user) + .and_return(true) allow(provider).to receive(:manage_unit_file).with(:delete) expect(new_resource.triggers_reload).to eq true allow(provider).to receive(:shell_out_compacted!) expect(provider).to receive(:shell_out_compacted!) - .with(systemctl_path, "--user", "daemon-reload", **user_cmd_opts, default_env: false) + .with(systemctl_path, "--user", "daemon-reload", **user_cmd_opts, default_env: false) provider.action_delete end @@ -309,7 +309,7 @@ describe Chef::Provider::SystemdUnit do allow(provider).to receive(:manage_unit_file).with(:create) allow(provider).to receive(:shell_out_compacted!) expect(provider).to_not receive(:shell_out_compacted!) - .with(systemctl_path, "--user", "daemon-reload", **user_cmd_opts, default_env: false) + .with(systemctl_path, "--user", "daemon-reload", **user_cmd_opts, default_env: false) provider.action_create end @@ -317,23 +317,23 @@ describe Chef::Provider::SystemdUnit do new_resource.user("joe") new_resource.triggers_reload(false) allow(File).to receive(:exist?) - .with(unit_path_user) - .and_return(true) + .with(unit_path_user) + .and_return(true) allow(provider).to receive(:manage_unit_file).with(:delete) allow(provider).to receive(:shell_out_compacted!) expect(provider).to_not receive(:shell_out_compacted!) - .with(systemctl_path, "--user", "daemon-reload", **user_cmd_opts, default_env: false) + .with(systemctl_path, "--user", "daemon-reload", **user_cmd_opts, default_env: false) provider.action_delete end it "deletes the file when it exists" do new_resource.user("joe") allow(File).to receive(:exist?) - .with(unit_path_user) - .and_return(true) + .with(unit_path_user) + .and_return(true) allow(provider).to receive(:manage_unit_file) - .with(:delete) - .and_return(true) + .with(:delete) + .and_return(true) allow(provider).to receive(:daemon_reload) expect(provider).to receive(:manage_unit_file).with(:delete) provider.action_delete @@ -342,8 +342,8 @@ describe Chef::Provider::SystemdUnit do it "does not delete the file when it is absent" do new_resource.user("joe") allow(File).to receive(:exist?) - .with(unit_path_user) - .and_return(false) + .with(unit_path_user) + .and_return(false) allow(provider).to receive(:manage_unit_file).with(:delete) expect(provider).to_not receive(:manage_unit_file) provider.action_delete @@ -352,16 +352,16 @@ describe Chef::Provider::SystemdUnit do it "presets the unit" do new_resource.user("joe") expect(provider).to receive(:shell_out_compacted!) - .with(systemctl_path, "--user", "preset", unit_name, **user_cmd_opts) - .and_return(shell_out_success) + .with(systemctl_path, "--user", "preset", unit_name, **user_cmd_opts) + .and_return(shell_out_success) provider.action_preset end it "reverts the unit" do new_resource.user("joe") expect(provider).to receive(:shell_out_compacted!) - .with(systemctl_path, "--user", "revert", unit_name, **user_cmd_opts) - .and_return(shell_out_success) + .with(systemctl_path, "--user", "revert", unit_name, **user_cmd_opts) + .and_return(shell_out_success) provider.action_revert end end @@ -372,19 +372,19 @@ describe Chef::Provider::SystemdUnit do expect(new_resource.triggers_reload).to eq true allow(provider).to receive(:shell_out_compacted!) expect(provider).to receive(:shell_out_compacted!) - .with(systemctl_path, "--system", "daemon-reload", default_env: false) + .with(systemctl_path, "--system", "daemon-reload", default_env: false) provider.action_create end it "triggers a daemon-reload when deleting a unit with triggers_reload" do allow(File).to receive(:exist?) - .with(unit_path_system) - .and_return(true) + .with(unit_path_system) + .and_return(true) allow(provider).to receive(:manage_unit_file).with(:delete) expect(new_resource.triggers_reload).to eq true allow(provider).to receive(:shell_out_compacted!) expect(provider).to receive(:shell_out_compacted!) - .with(systemctl_path, "--system", "daemon-reload", default_env: false) + .with(systemctl_path, "--system", "daemon-reload", default_env: false) provider.action_delete end @@ -393,27 +393,27 @@ describe Chef::Provider::SystemdUnit do allow(provider).to receive(:manage_unit_file).with(:create) allow(provider).to receive(:shell_out_compacted!) expect(provider).to_not receive(:shell_out_compacted!) - .with(systemctl_path, "--system", "daemon-reload", default_env: false) + .with(systemctl_path, "--system", "daemon-reload", default_env: false) provider.action_create end it "does not trigger a daemon-reload when deleting a unit without triggers_reload" do new_resource.triggers_reload(false) allow(File).to receive(:exist?) - .with(unit_path_system) - .and_return(true) + .with(unit_path_system) + .and_return(true) allow(provider).to receive(:manage_unit_file).with(:delete) allow(provider).to receive(:shell_out_compacted!) expect(provider).to_not receive(:shell_out_compacted!) - .with(systemctl_path, "--system", "daemon-reload", default_env: false) + .with(systemctl_path, "--system", "daemon-reload", default_env: false) provider.action_delete end it "deletes the file when it exists" do allow(File).to receive(:exist?) - .with(unit_path_system) - .and_return(true) + .with(unit_path_system) + .and_return(true) allow(provider).to receive(:manage_unit_file) - .with(:delete) + .with(:delete) allow(provider).to receive(:daemon_reload) expect(provider).to receive(:manage_unit_file).with(:delete) provider.action_delete @@ -421,8 +421,8 @@ describe Chef::Provider::SystemdUnit do it "does not delete the file when it is absent" do allow(File).to receive(:exist?) - .with(unit_path_system) - .and_return(false) + .with(unit_path_system) + .and_return(false) allow(provider).to receive(:manage_unit_file).with(:delete) allow(provider).to receive(:daemon_reload) expect(provider).to_not receive(:manage_unit_file) @@ -431,15 +431,15 @@ describe Chef::Provider::SystemdUnit do it "presets the unit" do expect(provider).to receive(:shell_out_compacted!) - .with(systemctl_path, "--system", "preset", unit_name) - .and_return(shell_out_success) + .with(systemctl_path, "--system", "preset", unit_name) + .and_return(shell_out_success) provider.action_preset end it "reverts the unit" do expect(provider).to receive(:shell_out_compacted!) - .with(systemctl_path, "--system", "revert", unit_name) - .and_return(shell_out_success) + .with(systemctl_path, "--system", "revert", unit_name) + .and_return(shell_out_success) provider.action_revert end end @@ -450,8 +450,8 @@ describe Chef::Provider::SystemdUnit do it "reenables the unit" do current_resource.user(user_name) expect(provider).to receive(:shell_out_compacted!) - .with(systemctl_path, "--user", "reenable", unit_name, **user_cmd_opts) - .and_return(shell_out_success) + .with(systemctl_path, "--user", "reenable", unit_name, **user_cmd_opts) + .and_return(shell_out_success) provider.action_reenable end @@ -459,8 +459,8 @@ describe Chef::Provider::SystemdUnit do current_resource.user(user_name) current_resource.enabled(false) expect(provider).to receive(:shell_out_compacted!) - .with(systemctl_path, "--user", "enable", unit_name, **user_cmd_opts) - .and_return(shell_out_success) + .with(systemctl_path, "--user", "enable", unit_name, **user_cmd_opts) + .and_return(shell_out_success) provider.action_enable end @@ -482,8 +482,8 @@ describe Chef::Provider::SystemdUnit do current_resource.user(user_name) current_resource.enabled(true) expect(provider).to receive(:shell_out_compacted!) - .with(systemctl_path, "--user", "disable", unit_name, **user_cmd_opts) - .and_return(shell_out_success) + .with(systemctl_path, "--user", "disable", unit_name, **user_cmd_opts) + .and_return(shell_out_success) provider.action_disable end @@ -505,16 +505,16 @@ describe Chef::Provider::SystemdUnit do context "when no user is specified" do it "reenables the unit" do expect(provider).to receive(:shell_out_compacted!) - .with(systemctl_path, "--system", "reenable", unit_name) - .and_return(shell_out_success) + .with(systemctl_path, "--system", "reenable", unit_name) + .and_return(shell_out_success) provider.action_reenable end it "enables the unit when it is disabled" do current_resource.enabled(false) expect(provider).to receive(:shell_out_compacted!) - .with(systemctl_path, "--system", "enable", unit_name) - .and_return(shell_out_success) + .with(systemctl_path, "--system", "enable", unit_name) + .and_return(shell_out_success) provider.action_enable end @@ -533,8 +533,8 @@ describe Chef::Provider::SystemdUnit do it "disables the unit when it is enabled" do current_resource.enabled(true) expect(provider).to receive(:shell_out_compacted!) - .with(systemctl_path, "--system", "disable", unit_name) - .and_return(shell_out_success) + .with(systemctl_path, "--system", "disable", unit_name) + .and_return(shell_out_success) provider.action_disable end @@ -559,8 +559,8 @@ describe Chef::Provider::SystemdUnit do current_resource.user(user_name) current_resource.masked(false) expect(provider).to receive(:shell_out_compacted!) - .with(systemctl_path, "--user", "mask", unit_name, **user_cmd_opts) - .and_return(shell_out_success) + .with(systemctl_path, "--user", "mask", unit_name, **user_cmd_opts) + .and_return(shell_out_success) provider.action_mask end @@ -575,8 +575,8 @@ describe Chef::Provider::SystemdUnit do current_resource.user(user_name) current_resource.masked(true) expect(provider).to receive(:shell_out_compacted!) - .with(systemctl_path, "--user", "unmask", unit_name, **user_cmd_opts) - .and_return(shell_out_success) + .with(systemctl_path, "--user", "unmask", unit_name, **user_cmd_opts) + .and_return(shell_out_success) provider.action_unmask end @@ -592,8 +592,8 @@ describe Chef::Provider::SystemdUnit do it "masks the unit when it is unmasked" do current_resource.masked(false) expect(provider).to receive(:shell_out_compacted!) - .with(systemctl_path, "--system", "mask", unit_name) - .and_return(shell_out_success) + .with(systemctl_path, "--system", "mask", unit_name) + .and_return(shell_out_success) provider.action_mask end @@ -606,8 +606,8 @@ describe Chef::Provider::SystemdUnit do it "unmasks the unit when it is masked" do current_resource.masked(true) expect(provider).to receive(:shell_out_compacted!) - .with(systemctl_path, "--system", "unmask", unit_name) - .and_return(shell_out_success) + .with(systemctl_path, "--system", "unmask", unit_name) + .and_return(shell_out_success) provider.action_unmask end @@ -625,8 +625,8 @@ describe Chef::Provider::SystemdUnit do current_resource.user(user_name) current_resource.active(false) expect(provider).to receive(:shell_out_compacted!) - .with(systemctl_path, "--user", "start", unit_name, **user_cmd_opts, default_env: false) - .and_return(shell_out_success) + .with(systemctl_path, "--user", "start", unit_name, **user_cmd_opts, default_env: false) + .and_return(shell_out_success) provider.action_start end @@ -641,8 +641,8 @@ describe Chef::Provider::SystemdUnit do current_resource.user(user_name) current_resource.active(true) expect(provider).to receive(:shell_out_compacted!) - .with(systemctl_path, "--user", "stop", unit_name, **user_cmd_opts, default_env: false) - .and_return(shell_out_success) + .with(systemctl_path, "--user", "stop", unit_name, **user_cmd_opts, default_env: false) + .and_return(shell_out_success) provider.action_stop end @@ -658,8 +658,8 @@ describe Chef::Provider::SystemdUnit do it "starts the unit when it is inactive" do current_resource.active(false) expect(provider).to receive(:shell_out_compacted!) - .with(systemctl_path, "--system", "start", unit_name, default_env: false) - .and_return(shell_out_success) + .with(systemctl_path, "--system", "start", unit_name, default_env: false) + .and_return(shell_out_success) provider.action_start end @@ -672,8 +672,8 @@ describe Chef::Provider::SystemdUnit do it "stops the unit when it is active" do current_resource.active(true) expect(provider).to receive(:shell_out_compacted!) - .with(systemctl_path, "--system", "stop", unit_name, default_env: false) - .and_return(shell_out_success) + .with(systemctl_path, "--system", "stop", unit_name, default_env: false) + .and_return(shell_out_success) provider.action_stop end @@ -690,8 +690,8 @@ describe Chef::Provider::SystemdUnit do it "restarts the unit" do current_resource.user(user_name) expect(provider).to receive(:shell_out_compacted!) - .with(systemctl_path, "--user", "restart", unit_name, **user_cmd_opts, default_env: false) - .and_return(shell_out_success) + .with(systemctl_path, "--user", "restart", unit_name, **user_cmd_opts, default_env: false) + .and_return(shell_out_success) provider.action_restart end @@ -699,8 +699,8 @@ describe Chef::Provider::SystemdUnit do current_resource.user(user_name) current_resource.active(true) expect(provider).to receive(:shell_out_compacted!) - .with(systemctl_path, "--user", "reload", unit_name, **user_cmd_opts, default_env: false) - .and_return(shell_out_success) + .with(systemctl_path, "--user", "reload", unit_name, **user_cmd_opts, default_env: false) + .and_return(shell_out_success) provider.action_reload end @@ -715,16 +715,16 @@ describe Chef::Provider::SystemdUnit do context "when no user is specified" do it "restarts the unit" do expect(provider).to receive(:shell_out_compacted!) - .with(systemctl_path, "--system", "restart", unit_name, default_env: false) - .and_return(shell_out_success) + .with(systemctl_path, "--system", "restart", unit_name, default_env: false) + .and_return(shell_out_success) provider.action_restart end it "reloads the unit if active" do current_resource.active(true) expect(provider).to receive(:shell_out_compacted!) - .with(systemctl_path, "--system", "reload", unit_name, default_env: false) - .and_return(shell_out_success) + .with(systemctl_path, "--system", "reload", unit_name, default_env: false) + .and_return(shell_out_success) provider.action_reload end @@ -741,8 +741,8 @@ describe Chef::Provider::SystemdUnit do it "try-restarts the unit" do current_resource.user(user_name) expect(provider).to receive(:shell_out_compacted!) - .with(systemctl_path, "--user", "try-restart", unit_name, **user_cmd_opts, default_env: false) - .and_return(shell_out_success) + .with(systemctl_path, "--user", "try-restart", unit_name, **user_cmd_opts, default_env: false) + .and_return(shell_out_success) provider.action_try_restart end end @@ -750,8 +750,8 @@ describe Chef::Provider::SystemdUnit do context "when no user is specified" do it "try-restarts the unit" do expect(provider).to receive(:shell_out_compacted!) - .with(systemctl_path, "--system", "try-restart", unit_name, default_env: false) - .and_return(shell_out_success) + .with(systemctl_path, "--system", "try-restart", unit_name, default_env: false) + .and_return(shell_out_success) provider.action_try_restart end end @@ -762,8 +762,8 @@ describe Chef::Provider::SystemdUnit do it "reload-or-restarts the unit" do current_resource.user(user_name) expect(provider).to receive(:shell_out_compacted!) - .with(systemctl_path, "--user", "reload-or-restart", unit_name, **user_cmd_opts, default_env: false) - .and_return(shell_out_success) + .with(systemctl_path, "--user", "reload-or-restart", unit_name, **user_cmd_opts, default_env: false) + .and_return(shell_out_success) provider.action_reload_or_restart end end @@ -771,8 +771,8 @@ describe Chef::Provider::SystemdUnit do context "when no user is specified" do it "reload-or-restarts the unit" do expect(provider).to receive(:shell_out_compacted!) - .with(systemctl_path, "--system", "reload-or-restart", unit_name, default_env: false) - .and_return(shell_out_success) + .with(systemctl_path, "--system", "reload-or-restart", unit_name, default_env: false) + .and_return(shell_out_success) provider.action_reload_or_restart end end @@ -783,8 +783,8 @@ describe Chef::Provider::SystemdUnit do it "reload-or-try-restarts the unit" do current_resource.user(user_name) expect(provider).to receive(:shell_out_compacted!) - .with(systemctl_path, "--user", "reload-or-try-restart", unit_name, **user_cmd_opts, default_env: false) - .and_return(shell_out_success) + .with(systemctl_path, "--user", "reload-or-try-restart", unit_name, **user_cmd_opts, default_env: false) + .and_return(shell_out_success) provider.action_reload_or_try_restart end end @@ -792,8 +792,8 @@ describe Chef::Provider::SystemdUnit do context "when no user is specified" do it "reload-or-try-restarts the unit" do expect(provider).to receive(:shell_out_compacted!) - .with(systemctl_path, "--system", "reload-or-try-restart", unit_name, default_env: false) - .and_return(shell_out_success) + .with(systemctl_path, "--system", "reload-or-try-restart", unit_name, default_env: false) + .and_return(shell_out_success) provider.action_reload_or_try_restart end end @@ -809,16 +809,16 @@ describe Chef::Provider::SystemdUnit do it "returns true when unit is active" do current_resource.user(user_name) expect(provider).to receive(:shell_out_compacted) - .with(systemctl_path, "--user", "is-active", unit_name, user_cmd_opts) - .and_return(shell_out_success) + .with(systemctl_path, "--user", "is-active", unit_name, user_cmd_opts) + .and_return(shell_out_success) expect(provider.active?).to be true end it "returns false when unit is inactive" do current_resource.user(user_name) expect(provider).to receive(:shell_out_compacted) - .with(systemctl_path, "--user", "is-active", unit_name, user_cmd_opts) - .and_return(shell_out_failure) + .with(systemctl_path, "--user", "is-active", unit_name, user_cmd_opts) + .and_return(shell_out_failure) expect(provider.active?).to be false end end @@ -826,15 +826,15 @@ describe Chef::Provider::SystemdUnit do context "when no user is specified" do it "returns true when unit is active" do expect(provider).to receive(:shell_out_compacted) - .with(systemctl_path, "--system", "is-active", unit_name) - .and_return(shell_out_success) + .with(systemctl_path, "--system", "is-active", unit_name) + .and_return(shell_out_success) expect(provider.active?).to be true end it "returns false when unit is not active" do expect(provider).to receive(:shell_out_compacted) - .with(systemctl_path, "--system", "is-active", unit_name) - .and_return(shell_out_failure) + .with(systemctl_path, "--system", "is-active", unit_name) + .and_return(shell_out_failure) expect(provider.active?).to be false end end @@ -850,16 +850,16 @@ describe Chef::Provider::SystemdUnit do it "returns true when unit is enabled" do current_resource.user(user_name) expect(provider).to receive(:shell_out_compacted) - .with(systemctl_path, "--user", "is-enabled", unit_name, user_cmd_opts) - .and_return(shell_out_success) + .with(systemctl_path, "--user", "is-enabled", unit_name, user_cmd_opts) + .and_return(shell_out_success) expect(provider.enabled?).to be true end it "returns false when unit is not enabled" do current_resource.user(user_name) expect(provider).to receive(:shell_out_compacted) - .with(systemctl_path, "--user", "is-enabled", unit_name, user_cmd_opts) - .and_return(shell_out_failure) + .with(systemctl_path, "--user", "is-enabled", unit_name, user_cmd_opts) + .and_return(shell_out_failure) expect(provider.enabled?).to be false end end @@ -867,15 +867,15 @@ describe Chef::Provider::SystemdUnit do context "when no user is specified" do it "returns true when unit is enabled" do expect(provider).to receive(:shell_out_compacted) - .with(systemctl_path, "--system", "is-enabled", unit_name) - .and_return(shell_out_success) + .with(systemctl_path, "--system", "is-enabled", unit_name) + .and_return(shell_out_success) expect(provider.enabled?).to be true end it "returns false when unit is not enabled" do expect(provider).to receive(:shell_out_compacted) - .with(systemctl_path, "--system", "is-enabled", unit_name) - .and_return(shell_out_failure) + .with(systemctl_path, "--system", "is-enabled", unit_name) + .and_return(shell_out_failure) expect(provider.enabled?).to be false end end @@ -891,16 +891,16 @@ describe Chef::Provider::SystemdUnit do it "returns true when the unit is masked" do current_resource.user(user_name) expect(provider).to receive(:shell_out_compacted) - .with(systemctl_path, "--user", "status", unit_name, user_cmd_opts) - .and_return(shell_out_masked) + .with(systemctl_path, "--user", "status", unit_name, user_cmd_opts) + .and_return(shell_out_masked) expect(provider.masked?).to be true end it "returns false when the unit is not masked" do current_resource.user(user_name) expect(provider).to receive(:shell_out_compacted) - .with(systemctl_path, "--user", "status", unit_name, user_cmd_opts) - .and_return(shell_out_static) + .with(systemctl_path, "--user", "status", unit_name, user_cmd_opts) + .and_return(shell_out_static) expect(provider.masked?).to be false end end @@ -908,15 +908,15 @@ describe Chef::Provider::SystemdUnit do context "when no user is specified" do it "returns true when the unit is masked" do expect(provider).to receive(:shell_out_compacted) - .with(systemctl_path, "--system", "status", unit_name) - .and_return(shell_out_masked) + .with(systemctl_path, "--system", "status", unit_name) + .and_return(shell_out_masked) expect(provider.masked?).to be true end it "returns false when the unit is not masked" do expect(provider).to receive(:shell_out_compacted) - .with(systemctl_path, "--system", "status", unit_name) - .and_return(shell_out_static) + .with(systemctl_path, "--system", "status", unit_name) + .and_return(shell_out_static) expect(provider.masked?).to be false end end @@ -932,16 +932,16 @@ describe Chef::Provider::SystemdUnit do it "returns true when the unit is static" do current_resource.user(user_name) expect(provider).to receive(:shell_out_compacted) - .with(systemctl_path, "--user", "is-enabled", unit_name, user_cmd_opts) - .and_return(shell_out_static) + .with(systemctl_path, "--user", "is-enabled", unit_name, user_cmd_opts) + .and_return(shell_out_static) expect(provider.static?).to be true end it "returns false when the unit is not static" do current_resource.user(user_name) expect(provider).to receive(:shell_out_compacted) - .with(systemctl_path, "--user", "is-enabled", unit_name, user_cmd_opts) - .and_return(shell_out_masked) + .with(systemctl_path, "--user", "is-enabled", unit_name, user_cmd_opts) + .and_return(shell_out_masked) expect(provider.static?).to be false end end @@ -949,15 +949,15 @@ describe Chef::Provider::SystemdUnit do context "when no user is specified" do it "returns true when the unit is static" do expect(provider).to receive(:shell_out_compacted) - .with(systemctl_path, "--system", "is-enabled", unit_name) - .and_return(shell_out_static) + .with(systemctl_path, "--system", "is-enabled", unit_name) + .and_return(shell_out_static) expect(provider.static?).to be true end it "returns false when the unit is not static" do expect(provider).to receive(:shell_out_compacted) - .with(systemctl_path, "--system", "is-enabled", unit_name) - .and_return(shell_out_masked) + .with(systemctl_path, "--system", "is-enabled", unit_name) + .and_return(shell_out_masked) expect(provider.static?).to be false end end diff --git a/spec/unit/run_list/run_list_expansion_spec.rb b/spec/unit/run_list/run_list_expansion_spec.rb index 3a39bc79cc..42018a07ba 100644 --- a/spec/unit/run_list/run_list_expansion_spec.rb +++ b/spec/unit/run_list/run_list_expansion_spec.rb @@ -94,7 +94,7 @@ describe Chef::RunList::RunListExpansion do allow(@expansion).to receive(:fetch_role).and_return(@first_role, @second_role) @expansion.expand @json = '{"id":"_default","run_list":[{"type":"recipe","name":"lobster::mastercookbook","version":"0.1.0",' - .concat( + .concat( '"skipped":false},{"type":"role","name":"rage","children":[{"type":"role","name":"mollusk","children":[],"missing":null,' .concat( '"error":null,"skipped":null},{"type":"recipe","name":"crabrevenge","version":null,"skipped":false}],"missing":null,' |