chef 17.7.29 → 17.8.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/chef/application/base.rb +1 -1
- data/lib/chef/compliance/default_attributes.rb +12 -2
- data/lib/chef/compliance/runner.rb +51 -5
- data/lib/chef/mixin/powershell_exec.rb +6 -5
- data/lib/chef/mixin/why_run.rb +8 -2
- data/lib/chef/powershell.rb +8 -6
- data/lib/chef/provider/mount/linux.rb +16 -2
- data/lib/chef/provider/mount/mount.rb +1 -1
- data/lib/chef/provider/package/dnf.rb +1 -1
- data/lib/chef/provider/package/powershell.rb +13 -10
- data/lib/chef/provider/package/zypper.rb +2 -0
- data/lib/chef/provider/package.rb +58 -23
- data/lib/chef/provider.rb +1 -1
- data/lib/chef/pwsh.rb +3 -2
- data/lib/chef/resource/chef_client_config.rb +22 -1
- data/lib/chef/resource/chef_client_launchd.rb +1 -1
- data/lib/chef/resource/dnf_package.rb +4 -6
- data/lib/chef/resource/dpkg_package.rb +5 -0
- data/lib/chef/resource/execute.rb +1 -4
- data/lib/chef/resource/launchd.rb +0 -3
- data/lib/chef/resource/macos_userdefaults.rb +5 -7
- data/lib/chef/resource/rhsm_register.rb +31 -0
- data/lib/chef/resource/support/client.erb +7 -0
- data/lib/chef/resource/windows_feature_powershell.rb +7 -7
- data/lib/chef/resource.rb +1 -1
- data/lib/chef/version.rb +1 -1
- data/spec/functional/resource/dnf_package_spec.rb +34 -20
- data/spec/functional/resource/dpkg_package_spec.rb +16 -0
- data/spec/functional/resource/macos_userdefaults_spec.rb +20 -0
- data/spec/functional/resource/zypper_package_spec.rb +7 -0
- data/spec/integration/client/client_spec.rb +31 -0
- data/spec/unit/application/base_spec.rb +40 -0
- data/spec/unit/compliance/runner_spec.rb +62 -1
- data/spec/unit/file_access_control_spec.rb +1 -1
- data/spec/unit/mixin/why_run_spec.rb +53 -0
- data/spec/unit/provider/group/groupadd_spec.rb +1 -0
- data/spec/unit/provider/group/usermod_spec.rb +2 -2
- data/spec/unit/provider/ifconfig_spec.rb +2 -0
- data/spec/unit/provider/mount/linux_spec.rb +16 -3
- data/spec/unit/provider/package/bff_spec.rb +1 -0
- data/spec/unit/provider/package/powershell_spec.rb +114 -114
- data/spec/unit/provider/package/rubygems_spec.rb +3 -0
- data/spec/unit/provider/package/solaris_spec.rb +1 -0
- data/spec/unit/provider/service/arch_service_spec.rb +2 -2
- data/spec/unit/provider/service/debian_service_spec.rb +1 -0
- data/spec/unit/provider/service/gentoo_service_spec.rb +1 -0
- data/spec/unit/provider/service/macosx_spec.rb +1 -0
- data/spec/unit/provider/service/redhat_spec.rb +4 -1
- data/spec/unit/provider/service/simple_service_spec.rb +6 -4
- data/spec/unit/provider/user_spec.rb +2 -0
- data/spec/unit/resource/dpkg_package_spec.rb +12 -0
- data/spec/unit/resource/rhsm_register_spec.rb +42 -0
- metadata +9 -7
| @@ -50,6 +50,7 @@ describe Chef::Provider::Service::Debian do | |
| 50 50 | 
             
                it "ensures /usr/sbin/update-rc.d is available" do
         | 
| 51 51 | 
             
                  expect(File).to receive(:exist?).with("/usr/sbin/update-rc.d").and_return(false)
         | 
| 52 52 |  | 
| 53 | 
            +
                  @provider.action = :start
         | 
| 53 54 | 
             
                  @provider.define_resource_requirements
         | 
| 54 55 | 
             
                  expect do
         | 
| 55 56 | 
             
                    @provider.process_resource_requirements
         | 
| @@ -42,6 +42,7 @@ describe Chef::Provider::Service::Gentoo do | |
| 42 42 | 
             
              describe "load_current_resource" do
         | 
| 43 43 | 
             
                it "should raise Chef::Exceptions::Service if /sbin/rc-update does not exist" do
         | 
| 44 44 | 
             
                  expect(File).to receive(:exist?).with("/sbin/rc-update").and_return(false)
         | 
| 45 | 
            +
                  @provider.action = :start
         | 
| 45 46 | 
             
                  @provider.define_resource_requirements
         | 
| 46 47 | 
             
                  expect { @provider.process_resource_requirements }.to raise_error(Chef::Exceptions::Service)
         | 
| 47 48 | 
             
                end
         | 
| @@ -237,6 +237,7 @@ describe Chef::Provider::Service::Macosx do | |
| 237 237 | 
             
                              allow(Dir).to receive(:glob).and_return([(plist).to_s,
         | 
| 238 238 | 
             
                                                          "/Users/wtf/something.plist"])
         | 
| 239 239 | 
             
                              provider.load_current_resource
         | 
| 240 | 
            +
                              provider.action = :enable
         | 
| 240 241 | 
             
                              provider.define_resource_requirements
         | 
| 241 242 | 
             
                              expect { provider.process_resource_requirements }.to raise_error(Chef::Exceptions::Service)
         | 
| 242 243 | 
             
                            end
         | 
| @@ -34,6 +34,7 @@ shared_examples_for "define_resource_requirements_common" do | |
| 34 34 | 
             
                expect(@provider).to receive(:shell_out).with("/sbin/service chef status").and_return(status)
         | 
| 35 35 | 
             
                chkconfig = double("Chkconfig", exitstatus: 0, stdout: "", stderr: "service chef supports chkconfig, but is not referenced in any runlevel (run 'chkconfig --add chef')")
         | 
| 36 36 | 
             
                expect(@provider).to receive(:shell_out!).with("/sbin/chkconfig --list chef", returns: [0, 1]).and_return(chkconfig)
         | 
| 37 | 
            +
                @provider.action = :start
         | 
| 37 38 | 
             
                @provider.load_current_resource
         | 
| 38 39 | 
             
                @provider.define_resource_requirements
         | 
| 39 40 | 
             
                expect { @provider.process_resource_requirements }.not_to raise_error
         | 
| @@ -147,12 +148,12 @@ describe "Chef::Provider::Service::Redhat" do | |
| 147 148 | 
             
                      chkconfig = double("Chkconfig", existatus: 1, stdout: "", stderr: "error reading information on service chef: No such file or directory")
         | 
| 148 149 | 
             
                      expect(@provider).to receive(:shell_out!).with("/sbin/chkconfig --list chef", returns: [0, 1]).and_return(chkconfig)
         | 
| 149 150 | 
             
                      @provider.load_current_resource
         | 
| 150 | 
            -
                      @provider.define_resource_requirements
         | 
| 151 151 | 
             
                    end
         | 
| 152 152 |  | 
| 153 153 | 
             
                    %w{start reload restart enable}.each do |action|
         | 
| 154 154 | 
             
                      it "should raise an error when the action is #{action}" do
         | 
| 155 155 | 
             
                        @provider.action = action
         | 
| 156 | 
            +
                        @provider.define_resource_requirements
         | 
| 156 157 | 
             
                        expect { @provider.process_resource_requirements }.to raise_error(Chef::Exceptions::Service)
         | 
| 157 158 | 
             
                      end
         | 
| 158 159 | 
             
                    end
         | 
| @@ -161,12 +162,14 @@ describe "Chef::Provider::Service::Redhat" do | |
| 161 162 | 
             
                      it "should not raise an error when the action is #{action} and init_command is set" do
         | 
| 162 163 | 
             
                        @new_resource.init_command("/etc/init.d/chef")
         | 
| 163 164 | 
             
                        @provider.action = action
         | 
| 165 | 
            +
                        @provider.define_resource_requirements
         | 
| 164 166 | 
             
                        expect { @provider.process_resource_requirements }.not_to raise_error
         | 
| 165 167 | 
             
                      end
         | 
| 166 168 |  | 
| 167 169 | 
             
                      it "should not raise an error when the action is #{action} and #{action}_command is set" do
         | 
| 168 170 | 
             
                        @new_resource.send("#{action}_command", "/etc/init.d/chef #{action}")
         | 
| 169 171 | 
             
                        @provider.action = action
         | 
| 172 | 
            +
                        @provider.define_resource_requirements
         | 
| 170 173 | 
             
                        expect { @provider.process_resource_requirements }.not_to raise_error
         | 
| 171 174 | 
             
                      end
         | 
| 172 175 | 
             
                    end
         | 
| @@ -52,12 +52,14 @@ describe Chef::Provider::Service::Simple, "load_current_resource" do | |
| 52 52 |  | 
| 53 53 | 
             
              it "should raise error if the node has a nil ps property and no other means to get status" do
         | 
| 54 54 | 
             
                @node.automatic_attrs[:command] = { ps: nil }
         | 
| 55 | 
            +
                @provider.action = :start
         | 
| 55 56 | 
             
                @provider.define_resource_requirements
         | 
| 56 57 | 
             
                expect { @provider.process_resource_requirements }.to raise_error(Chef::Exceptions::Service)
         | 
| 57 58 | 
             
              end
         | 
| 58 59 |  | 
| 59 60 | 
             
              it "should raise error if the node has an empty ps property and no other means to get status" do
         | 
| 60 61 | 
             
                @node.automatic_attrs[:command] = { ps: "" }
         | 
| 62 | 
            +
                @provider.action = :start
         | 
| 61 63 | 
             
                @provider.define_resource_requirements
         | 
| 62 64 | 
             
                expect { @provider.process_resource_requirements }.to raise_error(Chef::Exceptions::Service)
         | 
| 63 65 | 
             
              end
         | 
| @@ -112,8 +114,8 @@ describe Chef::Provider::Service::Simple, "load_current_resource" do | |
| 112 114 | 
             
                end
         | 
| 113 115 |  | 
| 114 116 | 
             
                it "should raise an exception if no start command is specified" do
         | 
| 115 | 
            -
                  @provider.define_resource_requirements
         | 
| 116 117 | 
             
                  @provider.action = :start
         | 
| 118 | 
            +
                  @provider.define_resource_requirements
         | 
| 117 119 | 
             
                  expect { @provider.process_resource_requirements }.to raise_error(Chef::Exceptions::Service)
         | 
| 118 120 | 
             
                end
         | 
| 119 121 | 
             
              end
         | 
| @@ -126,8 +128,8 @@ describe Chef::Provider::Service::Simple, "load_current_resource" do | |
| 126 128 | 
             
                end
         | 
| 127 129 |  | 
| 128 130 | 
             
                it "should raise an exception if no stop command is specified" do
         | 
| 129 | 
            -
                  @provider.define_resource_requirements
         | 
| 130 131 | 
             
                  @provider.action = :stop
         | 
| 132 | 
            +
                  @provider.define_resource_requirements
         | 
| 131 133 | 
             
                  expect { @provider.process_resource_requirements }.to raise_error(Chef::Exceptions::Service)
         | 
| 132 134 | 
             
                end
         | 
| 133 135 | 
             
              end
         | 
| @@ -140,8 +142,8 @@ describe Chef::Provider::Service::Simple, "load_current_resource" do | |
| 140 142 | 
             
                end
         | 
| 141 143 |  | 
| 142 144 | 
             
                it "should raise an exception if the resource doesn't support restart, no restart command is provided, and no stop command is provided" do
         | 
| 143 | 
            -
                  @provider.define_resource_requirements
         | 
| 144 145 | 
             
                  @provider.action = :restart
         | 
| 146 | 
            +
                  @provider.define_resource_requirements
         | 
| 145 147 | 
             
                  expect { @provider.process_resource_requirements }.to raise_error(Chef::Exceptions::Service)
         | 
| 146 148 | 
             
                end
         | 
| 147 149 |  | 
| @@ -155,8 +157,8 @@ describe Chef::Provider::Service::Simple, "load_current_resource" do | |
| 155 157 |  | 
| 156 158 | 
             
              describe Chef::Provider::Service::Simple, "reload_service" do
         | 
| 157 159 | 
             
                it "should raise an exception if reload is requested but no command is specified" do
         | 
| 158 | 
            -
                  @provider.define_resource_requirements
         | 
| 159 160 | 
             
                  @provider.action = :reload
         | 
| 161 | 
            +
                  @provider.define_resource_requirements
         | 
| 160 162 | 
             
                  expect { @provider.process_resource_requirements }.to raise_error(Chef::Exceptions::UnsupportedAction)
         | 
| 161 163 | 
             
                end
         | 
| 162 164 |  | 
| @@ -170,6 +170,7 @@ describe Chef::Provider::User do | |
| 170 170 | 
             
                                                                sp_warn: 7, sp_inact: -1, sp_expire: -1, sp_flag: -1)
         | 
| 171 171 | 
             
                          expect(Shadow::Passwd).to receive(:getspnam).with("notarealuser").and_return(passwd_info)
         | 
| 172 172 | 
             
                          @provider.load_current_resource
         | 
| 173 | 
            +
                          @provider.action = :create
         | 
| 173 174 | 
             
                          @provider.define_resource_requirements
         | 
| 174 175 | 
             
                          @provider.process_resource_requirements
         | 
| 175 176 | 
             
                        end
         | 
| @@ -180,6 +181,7 @@ describe Chef::Provider::User do | |
| 180 181 | 
             
                  it "should fail assertions when ruby-shadow cannot be loaded" do
         | 
| 181 182 | 
             
                    expect(@provider).to receive(:require).with("shadow") { raise LoadError }
         | 
| 182 183 | 
             
                    @provider.load_current_resource
         | 
| 184 | 
            +
                    @provider.action = :create
         | 
| 183 185 | 
             
                    @provider.define_resource_requirements
         | 
| 184 186 | 
             
                    expect { @provider.process_resource_requirements }.to raise_error Chef::Exceptions::MissingLibrary
         | 
| 185 187 | 
             
                  end
         | 
| @@ -57,4 +57,16 @@ describe Chef::Resource::DpkgPackage, "initialize" do | |
| 57 57 | 
             
                end
         | 
| 58 58 | 
             
              end
         | 
| 59 59 |  | 
| 60 | 
            +
              describe Chef::Resource::DpkgPackage, "allow_downgrade" do
         | 
| 61 | 
            +
                before(:each) do
         | 
| 62 | 
            +
                  @resource = Chef::Resource::DpkgPackage.new("fakey_fakerton")
         | 
| 63 | 
            +
                end
         | 
| 64 | 
            +
             | 
| 65 | 
            +
                it "should allow you to specify whether allow_downgrade is true or false" do
         | 
| 66 | 
            +
                  expect { @resource.allow_downgrade true }.not_to raise_error
         | 
| 67 | 
            +
                  expect { @resource.allow_downgrade false }.not_to raise_error
         | 
| 68 | 
            +
                  expect { @resource.allow_downgrade "something" }.to raise_error(ArgumentError)
         | 
| 69 | 
            +
                end
         | 
| 70 | 
            +
              end
         | 
| 71 | 
            +
             | 
| 60 72 | 
             
            end
         | 
| @@ -158,6 +158,48 @@ describe Chef::Resource::RhsmRegister do | |
| 158 158 | 
             
                    end
         | 
| 159 159 | 
             
                  end
         | 
| 160 160 |  | 
| 161 | 
            +
                  context "when a server_url is provided" do
         | 
| 162 | 
            +
                    it "returns a command containing the server url" do
         | 
| 163 | 
            +
                      allow(resource).to receive(:server_url).and_return("https://fqdn.example")
         | 
| 164 | 
            +
                      expect(provider.register_command).to match("--serverurl=https://fqdn.example")
         | 
| 165 | 
            +
                    end
         | 
| 166 | 
            +
                  end
         | 
| 167 | 
            +
             | 
| 168 | 
            +
                  context "when a base_url is provided" do
         | 
| 169 | 
            +
                    it "returns a command containing the base url" do
         | 
| 170 | 
            +
                      allow(resource).to receive(:base_url).and_return("https://fqdn.example")
         | 
| 171 | 
            +
                      expect(provider.register_command).to match("--baseurl=https://fqdn.example")
         | 
| 172 | 
            +
                    end
         | 
| 173 | 
            +
                  end
         | 
| 174 | 
            +
             | 
| 175 | 
            +
                  context "when a service_level is provided" do
         | 
| 176 | 
            +
                    it "returns a command containing the service level" do
         | 
| 177 | 
            +
                      allow(resource).to receive(:service_level).and_return("None")
         | 
| 178 | 
            +
                      allow(resource).to receive(:auto_attach).and_return(true)
         | 
| 179 | 
            +
                      expect(provider.register_command).to match("--servicelevel=None")
         | 
| 180 | 
            +
                    end
         | 
| 181 | 
            +
             | 
| 182 | 
            +
                    it "raises an exception if auto_attach is not set" do
         | 
| 183 | 
            +
                      allow(resource).to receive(:service_level).and_return("None")
         | 
| 184 | 
            +
                      allow(resource).to receive(:auto_attach).and_return(nil)
         | 
| 185 | 
            +
                      expect { provider.register_command }.to raise_error(RuntimeError)
         | 
| 186 | 
            +
                    end
         | 
| 187 | 
            +
                  end
         | 
| 188 | 
            +
             | 
| 189 | 
            +
                  context "when a release is provided" do
         | 
| 190 | 
            +
                    it "returns a command containing the release" do
         | 
| 191 | 
            +
                      allow(resource).to receive(:release).and_return("8.4")
         | 
| 192 | 
            +
                      allow(resource).to receive(:auto_attach).and_return(true)
         | 
| 193 | 
            +
                      expect(provider.register_command).to match("--release=8.4")
         | 
| 194 | 
            +
                    end
         | 
| 195 | 
            +
             | 
| 196 | 
            +
                    it "raises an exception if auto_attach is not set" do
         | 
| 197 | 
            +
                      allow(resource).to receive(:release).and_return("8.4")
         | 
| 198 | 
            +
                      allow(resource).to receive(:auto_attach).and_return(nil)
         | 
| 199 | 
            +
                      expect { provider.register_command }.to raise_error(RuntimeError)
         | 
| 200 | 
            +
                    end
         | 
| 201 | 
            +
                  end
         | 
| 202 | 
            +
             | 
| 161 203 | 
             
                  context "when a system_name is not provided" do
         | 
| 162 204 | 
             
                    it "returns a command containing the system name" do
         | 
| 163 205 | 
             
                      allow(resource).to receive(:system_name).and_return(nil)
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: chef
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 17. | 
| 4 | 
            +
              version: 17.8.25
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Adam Jacob
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2021- | 
| 11 | 
            +
            date: 2021-12-01 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: chef-config
         | 
| @@ -16,28 +16,28 @@ dependencies: | |
| 16 16 | 
             
                requirements:
         | 
| 17 17 | 
             
                - - '='
         | 
| 18 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            -
                    version: 17. | 
| 19 | 
            +
                    version: 17.8.25
         | 
| 20 20 | 
             
              type: :runtime
         | 
| 21 21 | 
             
              prerelease: false
         | 
| 22 22 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 23 | 
             
                requirements:
         | 
| 24 24 | 
             
                - - '='
         | 
| 25 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            -
                    version: 17. | 
| 26 | 
            +
                    version: 17.8.25
         | 
| 27 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 28 | 
             
              name: chef-utils
         | 
| 29 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 30 | 
             
                requirements:
         | 
| 31 31 | 
             
                - - '='
         | 
| 32 32 | 
             
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            -
                    version: 17. | 
| 33 | 
            +
                    version: 17.8.25
         | 
| 34 34 | 
             
              type: :runtime
         | 
| 35 35 | 
             
              prerelease: false
         | 
| 36 36 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 37 | 
             
                requirements:
         | 
| 38 38 | 
             
                - - '='
         | 
| 39 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            -
                    version: 17. | 
| 40 | 
            +
                    version: 17.8.25
         | 
| 41 41 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 42 42 | 
             
              name: train-core
         | 
| 43 43 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -1867,6 +1867,7 @@ files: | |
| 1867 1867 | 
             
            - spec/unit/api_client_v1_spec.rb
         | 
| 1868 1868 | 
             
            - spec/unit/application/agent_spec.rb
         | 
| 1869 1869 | 
             
            - spec/unit/application/apply_spec.rb
         | 
| 1870 | 
            +
            - spec/unit/application/base_spec.rb
         | 
| 1870 1871 | 
             
            - spec/unit/application/client_spec.rb
         | 
| 1871 1872 | 
             
            - spec/unit/application/exit_code_spec.rb
         | 
| 1872 1873 | 
             
            - spec/unit/application/server_spec.rb
         | 
| @@ -2000,6 +2001,7 @@ files: | |
| 2000 2001 | 
             
            - spec/unit/mixin/user_context_spec.rb
         | 
| 2001 2002 | 
             
            - spec/unit/mixin/versioned_api_spec.rb
         | 
| 2002 2003 | 
             
            - spec/unit/mixin/which.rb
         | 
| 2004 | 
            +
            - spec/unit/mixin/why_run_spec.rb
         | 
| 2003 2005 | 
             
            - spec/unit/mixin/windows_architecture_helper_spec.rb
         | 
| 2004 2006 | 
             
            - spec/unit/mixin/xml_escape_spec.rb
         | 
| 2005 2007 | 
             
            - spec/unit/monologger_spec.rb
         | 
| @@ -2388,7 +2390,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 2388 2390 | 
             
                - !ruby/object:Gem::Version
         | 
| 2389 2391 | 
             
                  version: '0'
         | 
| 2390 2392 | 
             
            requirements: []
         | 
| 2391 | 
            -
            rubygems_version: 3.2. | 
| 2393 | 
            +
            rubygems_version: 3.2.32
         | 
| 2392 2394 | 
             
            signing_key: 
         | 
| 2393 2395 | 
             
            specification_version: 4
         | 
| 2394 2396 | 
             
            summary: A systems integration framework, built to bring the benefits of configuration
         |