chef 14.1.12-universal-mingw32 → 14.2.0-universal-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -6
- data/VERSION +1 -1
- data/chef.gemspec +2 -3
- data/lib/chef/chef_fs/data_handler/data_handler_base.rb +8 -4
- data/lib/chef/cookbook/manifest_v0.rb +2 -2
- data/lib/chef/cookbook_manifest.rb +3 -2
- data/lib/chef/cookbook_version.rb +3 -2
- data/lib/chef/guard_interpreter/default_guard_interpreter.rb +2 -2
- data/lib/chef/http/auth_credentials.rb +5 -3
- data/lib/chef/http/authenticator.rb +6 -3
- data/lib/chef/knife.rb +3 -6
- data/lib/chef/knife/configure.rb +12 -8
- data/lib/chef/knife/raw.rb +6 -1
- data/lib/chef/mixin/shell_out.rb +16 -14
- data/lib/chef/provider/execute.rb +4 -3
- data/lib/chef/provider/git.rb +1 -1
- data/lib/chef/provider/package/dnf.rb +5 -5
- data/lib/chef/provider/package/windows.rb +7 -0
- data/lib/chef/provider/package/yum.rb +7 -7
- data/lib/chef/provider/service/freebsd.rb +3 -3
- data/lib/chef/provider/service/init.rb +5 -5
- data/lib/chef/provider/service/macosx.rb +5 -4
- data/lib/chef/provider/service/simple.rb +4 -4
- data/lib/chef/provider/service/systemd.rb +13 -13
- data/lib/chef/provider/service/upstart.rb +3 -3
- data/lib/chef/provider/service/windows.rb +2 -0
- data/lib/chef/provider/systemd_unit.rb +4 -4
- data/lib/chef/provider/user.rb +18 -1
- data/lib/chef/provider/user/aix.rb +40 -8
- data/lib/chef/provider/user/dscl.rb +7 -14
- data/lib/chef/provider/user/linux.rb +1 -11
- data/lib/chef/provider/user/solaris.rb +57 -26
- data/lib/chef/provider/user/useradd.rb +4 -1
- data/lib/chef/provider/windows_task.rb +1 -0
- data/lib/chef/providers.rb +1 -2
- data/lib/chef/resource/execute.rb +4 -1
- data/lib/chef/resource/gem_package.rb +1 -1
- data/lib/chef/resource/hostname.rb +1 -1
- data/lib/chef/resource/sysctl.rb +3 -1
- data/lib/chef/resource/windows_ad_join.rb +16 -3
- data/lib/chef/resource_inspector.rb +13 -0
- data/lib/chef/run_context/cookbook_compiler.rb +1 -1
- data/lib/chef/server_api.rb +2 -0
- data/lib/chef/version.rb +1 -1
- data/spec/functional/mixin/shell_out_spec.rb +27 -1
- data/spec/functional/resource/execute_spec.rb +2 -2
- data/spec/functional/resource/windows_task_spec.rb +1 -1
- data/spec/support/shared/functional/securable_resource.rb +1 -1
- data/spec/support/shared/unit/execute_resource.rb +1 -1
- data/spec/support/shared/unit/provider/useradd_based_user_provider.rb +3 -3
- data/spec/unit/chef_fs/data_handler/data_handler_base_spec.rb +65 -0
- data/spec/unit/cookbook/manifest_v0_spec.rb +1 -1
- data/spec/unit/cookbook_manifest_spec.rb +2 -0
- data/spec/unit/dsl/recipe_spec.rb +1 -5
- data/spec/unit/http/authenticator_spec.rb +33 -8
- data/spec/unit/mixin/shell_out_spec.rb +61 -1
- data/spec/unit/provider/apt_update_spec.rb +7 -7
- data/spec/unit/provider/execute_spec.rb +16 -15
- data/spec/unit/provider/git_spec.rb +3 -3
- data/spec/unit/provider/package/windows_spec.rb +12 -0
- data/spec/unit/provider/script_spec.rb +2 -2
- data/spec/unit/provider/service/arch_service_spec.rb +9 -9
- data/spec/unit/provider/service/freebsd_service_spec.rb +6 -6
- data/spec/unit/provider/service/init_service_spec.rb +11 -11
- data/spec/unit/provider/service/invokercd_service_spec.rb +9 -9
- data/spec/unit/provider/service/macosx_spec.rb +11 -11
- data/spec/unit/provider/service/openbsd_service_spec.rb +6 -6
- data/spec/unit/provider/service/simple_service_spec.rb +4 -4
- data/spec/unit/provider/service/systemd_service_spec.rb +16 -16
- data/spec/unit/provider/service/upstart_service_spec.rb +12 -12
- data/spec/unit/provider/service/windows_spec.rb +5 -0
- data/spec/unit/provider/systemd_unit_spec.rb +163 -118
- data/spec/unit/provider/user/dscl_spec.rb +2 -9
- data/spec/unit/provider/user/solaris_spec.rb +2 -2
- data/spec/unit/provider/zypper_repository_spec.rb +3 -3
- data/spec/unit/provider_spec.rb +1 -5
- data/spec/unit/resource/apt_package_spec.rb +14 -0
- data/spec/unit/resource/apt_preference_spec.rb +14 -1
- data/spec/unit/resource/apt_repository_spec.rb +12 -3
- data/spec/unit/resource/apt_update_spec.rb +9 -0
- data/spec/unit/resource/bash_spec.rb +8 -0
- data/spec/unit/resource/bff_package_spec.rb +51 -0
- data/spec/unit/resource/breakpoint_spec.rb +4 -4
- data/spec/unit/resource/build_essential_spec.rb +5 -1
- data/spec/unit/resource/cab_package_spec.rb +10 -0
- data/spec/unit/resource/chef_gem_spec.rb +14 -0
- data/spec/unit/resource/chef_handler_spec.rb +9 -4
- data/spec/unit/resource/chocolatey_package_spec.rb +15 -1
- data/spec/unit/resource/conditional_spec.rb +3 -3
- data/spec/unit/resource/cookbook_file_spec.rb +13 -2
- data/spec/unit/resource/cron_spec.rb +2 -7
- data/spec/unit/resource/csh_spec.rb +8 -0
- data/spec/unit/resource/directory_spec.rb +4 -9
- data/spec/unit/resource/dmg_package_spec.rb +8 -4
- data/spec/unit/resource/dnf_package_spec.rb +16 -1
- data/spec/unit/resource/dpkg_package_spec.rb +18 -0
- data/spec/unit/resource/dsc_resource_spec.rb +6 -6
- data/spec/unit/resource/dsc_script_spec.rb +39 -39
- data/spec/unit/resource/execute_spec.rb +20 -12
- data/spec/unit/resource/file_spec.rb +10 -10
- data/spec/unit/resource/freebsd_package_spec.rb +16 -0
- data/spec/unit/resource/gem_package_spec.rb +27 -0
- data/spec/unit/resource/git_spec.rb +17 -2
- data/spec/unit/resource/group_spec.rb +18 -17
- data/spec/unit/resource/homebrew_cask_spec.rb +9 -4
- data/spec/unit/resource/homebrew_package_spec.rb +14 -0
- data/spec/unit/resource/homebrew_tap_spec.rb +8 -3
- data/spec/unit/resource/hostname_spec.rb +10 -6
- data/spec/unit/resource/http_request_spec.rb +14 -0
- data/spec/unit/resource/ips_package_spec.rb +15 -3
- data/spec/unit/resource/ksh_spec.rb +8 -0
- data/spec/unit/resource/launchd_spec.rb +11 -5
- data/spec/unit/resource/link_spec.rb +6 -11
- data/spec/unit/resource/log_spec.rb +8 -8
- data/spec/unit/resource/macos_user_defaults_spec.rb +5 -1
- data/spec/unit/resource/macports_package_spec.rb +19 -0
- data/spec/unit/resource/mdadm_spec.rb +7 -3
- data/spec/unit/resource/mount_spec.rb +15 -18
- data/spec/unit/resource/msu_package_spec.rb +10 -0
- data/spec/unit/resource/ohai_hint_spec.rb +9 -8
- data/spec/unit/resource/ohai_spec.rb +11 -3
- data/spec/unit/resource/openbsd_package_spec.rb +14 -0
- data/spec/unit/resource/openssl_dhparam.rb +10 -5
- data/spec/unit/resource/openssl_rsa_private_key_spec.rb +10 -5
- data/spec/unit/resource/openssl_rsa_public_key_spec.rb +9 -5
- data/spec/unit/resource/osx_profile_spec.rb +7 -4
- data/spec/unit/resource/package_spec.rb +14 -0
- data/spec/unit/resource/pacman_package_spec.rb +17 -3
- data/spec/unit/resource/paludis_package_spec.rb +36 -0
- data/spec/unit/resource/perl_spec.rb +8 -0
- data/spec/unit/resource/portage_package_spec.rb +14 -0
- data/spec/unit/resource/powershell_package_spec.rb +14 -0
- data/spec/unit/resource/python_spec.rb +8 -0
- data/spec/unit/resource/reboot_spec.rb +5 -3
- data/spec/unit/resource/registry_key_spec.rb +12 -1
- data/spec/unit/resource/remote_directory_spec.rb +11 -1
- data/spec/unit/resource/remote_file_spec.rb +19 -0
- data/spec/unit/resource/rhsm_errata_level_spec.rb +7 -3
- data/spec/unit/resource/rhsm_errata_spec.rb +8 -4
- data/spec/unit/resource/rhsm_register_spec.rb +6 -1
- data/spec/unit/resource/rhsm_repo_spec.rb +9 -4
- data/spec/unit/resource/rhsm_subscription_spec.rb +9 -4
- data/spec/unit/resource/route_spec.rb +4 -9
- data/spec/unit/resource/rpm_package_spec.rb +14 -0
- data/spec/unit/resource/ruby_block_spec.rb +12 -8
- data/spec/unit/resource/ruby_spec.rb +8 -0
- data/spec/unit/resource/scm_spec.rb +16 -8
- data/spec/unit/resource/script_spec.rb +8 -0
- data/spec/unit/resource/service_spec.rb +15 -0
- data/spec/unit/resource/smartos_package_spec.rb +18 -4
- data/spec/unit/resource/solaris_package_spec.rb +14 -0
- data/spec/unit/resource/subversion_spec.rb +14 -8
- data/spec/unit/resource/sudo_spec.rb +11 -4
- data/spec/unit/resource/swap_file_spec.rb +4 -5
- data/spec/unit/resource/sysctl_spec.rb +8 -10
- data/spec/unit/resource/systemd_unit_spec.rb +14 -12
- data/spec/unit/resource/template_spec.rb +19 -0
- data/spec/unit/resource/{windows_ad_join.rb → windows_ad_join_spec.rb} +12 -6
- data/spec/unit/resource/windows_auto_run_spec.rb +9 -9
- data/spec/unit/resource/windows_env_spec.rb +8 -16
- data/spec/unit/resource/windows_feature.rb +27 -8
- data/spec/unit/resource/windows_feature_dism.rb +30 -9
- data/spec/unit/resource/windows_feature_powershell.rb +7 -7
- data/spec/unit/resource/windows_font_spec.rb +3 -4
- data/spec/unit/resource/windows_package_spec.rb +12 -2
- data/spec/unit/resource/windows_pagefile_spec.rb +12 -8
- data/spec/unit/resource/windows_path_spec.rb +4 -5
- data/spec/unit/resource/windows_printer_port_spec.rb +20 -3
- data/spec/unit/resource/windows_printer_spec.rb +12 -5
- data/spec/unit/resource/windows_service_spec.rb +24 -1
- data/spec/unit/resource/windows_shortcut_spec.rb +4 -5
- data/spec/unit/resource/yum_repository_spec.rb +48 -2
- data/spec/unit/resource/zypper_package_spec.rb +51 -0
- data/spec/unit/resource/zypper_repository_spec.rb +56 -11
- data/spec/unit/resource_spec.rb +1 -5
- metadata +21 -12
- data/spec/functional/resource/user/useradd_spec.rb +0 -709
@@ -28,7 +28,13 @@ describe Chef::Resource::WindowsFeaturePowershell do
|
|
28
28
|
expect(resource.action).to eql([:install])
|
29
29
|
end
|
30
30
|
|
31
|
-
it "
|
31
|
+
it "supports :delete, :install, :remove actions" do
|
32
|
+
expect { resource.action :delete }.not_to raise_error
|
33
|
+
expect { resource.action :install }.not_to raise_error
|
34
|
+
expect { resource.action :remove }.not_to raise_error
|
35
|
+
end
|
36
|
+
|
37
|
+
it "sets the feature_name property as its name_property" do
|
32
38
|
expect(resource.feature_name).to eql(%w{SNMP DHCP})
|
33
39
|
end
|
34
40
|
|
@@ -42,10 +48,4 @@ describe Chef::Resource::WindowsFeaturePowershell do
|
|
42
48
|
expect(resource.feature_name).to eql(["SNMP"])
|
43
49
|
end
|
44
50
|
|
45
|
-
it "supports :install, :remove, and :delete actions" do
|
46
|
-
expect { resource.action :install }.not_to raise_error
|
47
|
-
expect { resource.action :remove }.not_to raise_error
|
48
|
-
expect { resource.action :delete }.not_to raise_error
|
49
|
-
expect { resource.action :update }.to raise_error(ArgumentError)
|
50
|
-
end
|
51
51
|
end
|
@@ -18,14 +18,14 @@
|
|
18
18
|
require "spec_helper"
|
19
19
|
|
20
20
|
describe Chef::Resource::WindowsFont do
|
21
|
-
let(:resource) { Chef::Resource::WindowsFont.new("
|
21
|
+
let(:resource) { Chef::Resource::WindowsFont.new("fakey_fakerton") }
|
22
22
|
|
23
23
|
it "sets resource name as :windows_font" do
|
24
24
|
expect(resource.resource_name).to eql(:windows_font)
|
25
25
|
end
|
26
26
|
|
27
|
-
it "
|
28
|
-
expect(resource.font_name).to eql("
|
27
|
+
it "the font_name property is the name_property" do
|
28
|
+
expect(resource.font_name).to eql("fakey_fakerton")
|
29
29
|
end
|
30
30
|
|
31
31
|
it "sets the default action as :install" do
|
@@ -34,7 +34,6 @@ describe Chef::Resource::WindowsFont do
|
|
34
34
|
|
35
35
|
it "supports :install action" do
|
36
36
|
expect { resource.action :install }.not_to raise_error
|
37
|
-
expect { resource.action :remove }.to raise_error(ArgumentError)
|
38
37
|
end
|
39
38
|
|
40
39
|
it "coerces backslashes in the source property to forward slashes" do
|
@@ -37,8 +37,18 @@ describe Chef::Resource::WindowsPackage, "initialize" do
|
|
37
37
|
expect(resource).to be_a_kind_of(Chef::Resource::Package)
|
38
38
|
end
|
39
39
|
|
40
|
-
it "sets the
|
41
|
-
expect(resource.
|
40
|
+
it "sets the default action as :install" do
|
41
|
+
expect(resource.action).to eql([:install])
|
42
|
+
end
|
43
|
+
|
44
|
+
it "supports :install, :lock, :purge, :reconfig, :remove, :unlock, :upgrade actions" do
|
45
|
+
expect { resource.action :install }.not_to raise_error
|
46
|
+
expect { resource.action :lock }.not_to raise_error
|
47
|
+
expect { resource.action :purge }.not_to raise_error
|
48
|
+
expect { resource.action :reconfig }.not_to raise_error
|
49
|
+
expect { resource.action :remove }.not_to raise_error
|
50
|
+
expect { resource.action :unlock }.not_to raise_error
|
51
|
+
expect { resource.action :upgrade }.not_to raise_error
|
42
52
|
end
|
43
53
|
|
44
54
|
it "supports setting installer_type as a symbol" do
|
@@ -24,22 +24,26 @@ describe Chef::Resource::WindowsPagefile do
|
|
24
24
|
expect(resource.resource_name).to eql(:windows_pagefile)
|
25
25
|
end
|
26
26
|
|
27
|
-
it "
|
27
|
+
it "the path property is the name_property" do
|
28
28
|
expect(resource.path).to eql("C:\\pagefile.sys")
|
29
29
|
end
|
30
30
|
|
31
|
+
it "sets the default action as :set" do
|
32
|
+
expect(resource.action).to eql([:set])
|
33
|
+
end
|
34
|
+
|
35
|
+
it "supports :delete, :set actions" do
|
36
|
+
expect { resource.action :delete }.not_to raise_error
|
37
|
+
expect { resource.action :set }.not_to raise_error
|
38
|
+
end
|
39
|
+
|
31
40
|
it "coerces forward slashes in the path property to back slashes" do
|
32
41
|
resource.path "C:/pagefile.sys"
|
33
42
|
expect(resource.path).to eql("C:\\pagefile.sys")
|
34
43
|
end
|
35
44
|
|
36
|
-
it "
|
37
|
-
expect(resource.
|
45
|
+
it "automatic_managed property defaults to false" do
|
46
|
+
expect(resource.automatic_managed).to eql(false)
|
38
47
|
end
|
39
48
|
|
40
|
-
it "supports :set and :delete actions" do
|
41
|
-
expect { resource.action :set }.not_to raise_error
|
42
|
-
expect { resource.action :delete }.not_to raise_error
|
43
|
-
expect { resource.action :create }.to raise_error(ArgumentError)
|
44
|
-
end
|
45
49
|
end
|
@@ -19,23 +19,22 @@
|
|
19
19
|
require "spec_helper"
|
20
20
|
|
21
21
|
describe Chef::Resource::WindowsPath do
|
22
|
-
let(:resource) { Chef::Resource::WindowsPath.new("
|
22
|
+
let(:resource) { Chef::Resource::WindowsPath.new("fakey_fakerton") }
|
23
23
|
|
24
24
|
it "sets resource name as :windows_path" do
|
25
25
|
expect(resource.resource_name).to eql(:windows_path)
|
26
26
|
end
|
27
27
|
|
28
|
-
it "
|
29
|
-
expect(resource.path).to eql("
|
28
|
+
it "the path property is the name_property" do
|
29
|
+
expect(resource.path).to eql("fakey_fakerton")
|
30
30
|
end
|
31
31
|
|
32
32
|
it "sets the default action as :add" do
|
33
33
|
expect(resource.action).to eql([:add])
|
34
34
|
end
|
35
35
|
|
36
|
-
it "supports :add
|
36
|
+
it "supports :add, :remove actions" do
|
37
37
|
expect { resource.action :add }.not_to raise_error
|
38
38
|
expect { resource.action :remove }.not_to raise_error
|
39
|
-
expect { resource.action :delete }.to raise_error(ArgumentError)
|
40
39
|
end
|
41
40
|
end
|
@@ -24,7 +24,7 @@ describe Chef::Resource::WindowsPrinterPort do
|
|
24
24
|
expect(resource.resource_name).to eql(:windows_printer_port)
|
25
25
|
end
|
26
26
|
|
27
|
-
it "
|
27
|
+
it "the ipv4_address property is the name_property" do
|
28
28
|
expect(resource.ipv4_address).to eql("63.192.209.236")
|
29
29
|
end
|
30
30
|
|
@@ -32,10 +32,27 @@ describe Chef::Resource::WindowsPrinterPort do
|
|
32
32
|
expect(resource.action).to eql([:create])
|
33
33
|
end
|
34
34
|
|
35
|
-
it "supports :create
|
35
|
+
it "supports :create, :delete actions" do
|
36
36
|
expect { resource.action :create }.not_to raise_error
|
37
37
|
expect { resource.action :delete }.not_to raise_error
|
38
|
-
|
38
|
+
end
|
39
|
+
|
40
|
+
it "port_number property defaults to 9100" do
|
41
|
+
expect(resource.port_number).to eql(9100)
|
42
|
+
end
|
43
|
+
|
44
|
+
it "snmp_enabled property defaults to false" do
|
45
|
+
expect(resource.snmp_enabled).to eql(false)
|
46
|
+
end
|
47
|
+
|
48
|
+
it "port_protocol property defaults to 1" do
|
49
|
+
expect(resource.port_protocol).to eql(1)
|
50
|
+
end
|
51
|
+
|
52
|
+
it "raises an error if port_protocol isn't in 1 or 2" do
|
53
|
+
expect { resource.port_protocol 1 }.not_to raise_error
|
54
|
+
expect { resource.port_protocol 2 }.not_to raise_error
|
55
|
+
expect { resource.port_protocol 3 }.to raise_error(ArgumentError)
|
39
56
|
end
|
40
57
|
|
41
58
|
it "raises an error if ipv4_address isn't in X.X.X.X format" do
|
@@ -18,24 +18,31 @@
|
|
18
18
|
require "spec_helper"
|
19
19
|
|
20
20
|
describe Chef::Resource::WindowsPrinter do
|
21
|
-
let(:resource) { Chef::Resource::WindowsPrinter.new("
|
21
|
+
let(:resource) { Chef::Resource::WindowsPrinter.new("fakey_fakerton") }
|
22
22
|
|
23
23
|
it "sets resource name as :windows_printer" do
|
24
24
|
expect(resource.resource_name).to eql(:windows_printer)
|
25
25
|
end
|
26
26
|
|
27
|
-
it "
|
28
|
-
expect(resource.device_id).to eql("
|
27
|
+
it "the device_id property is the name_property" do
|
28
|
+
expect(resource.device_id).to eql("fakey_fakerton")
|
29
29
|
end
|
30
30
|
|
31
31
|
it "sets the default action as :create" do
|
32
32
|
expect(resource.action).to eql([:create])
|
33
33
|
end
|
34
34
|
|
35
|
-
it "supports :create
|
35
|
+
it "supports :create, :delete actions" do
|
36
36
|
expect { resource.action :create }.not_to raise_error
|
37
37
|
expect { resource.action :delete }.not_to raise_error
|
38
|
-
|
38
|
+
end
|
39
|
+
|
40
|
+
it "default property defaults to false" do
|
41
|
+
expect(resource.default).to eql(false)
|
42
|
+
end
|
43
|
+
|
44
|
+
it "shared property defaults to false" do
|
45
|
+
expect(resource.shared).to eql(false)
|
39
46
|
end
|
40
47
|
|
41
48
|
it "raises an error if ipv4_address isn't in X.X.X.X format" do
|
@@ -27,12 +27,35 @@ describe Chef::Resource::WindowsService, "initialize" do
|
|
27
27
|
action: :start
|
28
28
|
)
|
29
29
|
|
30
|
-
let(:resource) { Chef::Resource::WindowsService.new("
|
30
|
+
let(:resource) { Chef::Resource::WindowsService.new("fakey_fakerton") }
|
31
31
|
|
32
32
|
it "sets the resource_name to :windows_service" do
|
33
33
|
expect(resource.resource_name).to eql(:windows_service)
|
34
34
|
end
|
35
35
|
|
36
|
+
it "the service_name property is the name_property" do
|
37
|
+
expect(resource.service_name).to eql("fakey_fakerton")
|
38
|
+
end
|
39
|
+
|
40
|
+
it "sets the default action as :nothing" do
|
41
|
+
expect(resource.action).to eql([:nothing])
|
42
|
+
end
|
43
|
+
|
44
|
+
it "supports :configure, :configure_startup, :create, :delete, :disable, :enable, :mask, :reload, :restart, :start, :stop, :unmask actions" do
|
45
|
+
expect { resource.action :configure }.not_to raise_error
|
46
|
+
expect { resource.action :configure_startup }.not_to raise_error
|
47
|
+
expect { resource.action :create }.not_to raise_error
|
48
|
+
expect { resource.action :delete }.not_to raise_error
|
49
|
+
expect { resource.action :disable }.not_to raise_error
|
50
|
+
expect { resource.action :enable }.not_to raise_error
|
51
|
+
expect { resource.action :mask }.not_to raise_error
|
52
|
+
expect { resource.action :reload }.not_to raise_error
|
53
|
+
expect { resource.action :restart }.not_to raise_error
|
54
|
+
expect { resource.action :start }.not_to raise_error
|
55
|
+
expect { resource.action :stop }.not_to raise_error
|
56
|
+
expect { resource.action :unmask }.not_to raise_error
|
57
|
+
end
|
58
|
+
|
36
59
|
it "supports setting startup_type" do
|
37
60
|
resource.startup_type(:manual)
|
38
61
|
expect(resource.startup_type).to eql(:manual)
|
@@ -18,22 +18,21 @@
|
|
18
18
|
require "spec_helper"
|
19
19
|
|
20
20
|
describe Chef::Resource::WindowsShortcut do
|
21
|
-
let(:resource) { Chef::Resource::WindowsShortcut.new("
|
21
|
+
let(:resource) { Chef::Resource::WindowsShortcut.new("fakey_fakerton") }
|
22
22
|
|
23
23
|
it "sets resource name as :windows_shortcut" do
|
24
24
|
expect(resource.resource_name).to eql(:windows_shortcut)
|
25
25
|
end
|
26
26
|
|
27
|
-
it "
|
28
|
-
expect(resource.shortcut_name).to eql("
|
27
|
+
it "the shortcut_name property is the name_property" do
|
28
|
+
expect(resource.shortcut_name).to eql("fakey_fakerton")
|
29
29
|
end
|
30
30
|
|
31
31
|
it "sets the default action as :create" do
|
32
32
|
expect(resource.action).to eql([:create])
|
33
33
|
end
|
34
34
|
|
35
|
-
it "supports :create action
|
35
|
+
it "supports :create action" do
|
36
36
|
expect { resource.action :create }.not_to raise_error
|
37
|
-
expect { resource.action :delete }.to raise_error(ArgumentError)
|
38
37
|
end
|
39
38
|
end
|
@@ -22,20 +22,56 @@ describe Chef::Resource::YumRepository do
|
|
22
22
|
let(:node) { Chef::Node.new }
|
23
23
|
let(:events) { Chef::EventDispatch::Dispatcher.new }
|
24
24
|
let(:run_context) { Chef::RunContext.new(node, {}, events) }
|
25
|
-
let(:resource) { Chef::Resource::YumRepository.new("
|
25
|
+
let(:resource) { Chef::Resource::YumRepository.new("fakey_fakerton", run_context) }
|
26
26
|
|
27
27
|
it "has a resource_name of :yum_repository" do
|
28
28
|
expect(resource.resource_name).to eq(:yum_repository)
|
29
29
|
end
|
30
30
|
|
31
31
|
it "the repositoryid property is the name_property" do
|
32
|
-
expect(resource.repositoryid).to
|
32
|
+
expect(resource.repositoryid).to eql("fakey_fakerton")
|
33
|
+
end
|
34
|
+
|
35
|
+
it "sets the default action as :create" do
|
36
|
+
expect(resource.action).to eql([:create])
|
37
|
+
end
|
38
|
+
|
39
|
+
it "supports :add, :create, :delete, :makecache, :remove actions" do
|
40
|
+
expect { resource.action :add }.not_to raise_error
|
41
|
+
expect { resource.action :create }.not_to raise_error
|
42
|
+
expect { resource.action :delete }.not_to raise_error
|
43
|
+
expect { resource.action :makecache }.not_to raise_error
|
44
|
+
expect { resource.action :remove }.not_to raise_error
|
33
45
|
end
|
34
46
|
|
35
47
|
it "fails if the user provides a repositoryid with a forward slash" do
|
36
48
|
expect { resource.repositoryid "foo/bar" }.to raise_error(ArgumentError)
|
37
49
|
end
|
38
50
|
|
51
|
+
it "clean_headers property defaults to false" do
|
52
|
+
expect(resource.clean_headers).to eql(false)
|
53
|
+
end
|
54
|
+
|
55
|
+
it "clean_metadata property defaults to true" do
|
56
|
+
expect(resource.clean_metadata).to eql(true)
|
57
|
+
end
|
58
|
+
|
59
|
+
it "description property defaults to 'Yum Repository'" do
|
60
|
+
expect(resource.description).to eql("Yum Repository")
|
61
|
+
end
|
62
|
+
|
63
|
+
it "enabled property defaults to true" do
|
64
|
+
expect(resource.enabled).to eql(true)
|
65
|
+
end
|
66
|
+
|
67
|
+
it "make_cache property defaults to true" do
|
68
|
+
expect(resource.make_cache).to eql(true)
|
69
|
+
end
|
70
|
+
|
71
|
+
it "mode property defaults to '0644'" do
|
72
|
+
expect(resource.mode).to eql("0644")
|
73
|
+
end
|
74
|
+
|
39
75
|
it "the timeout property expects numeric Strings" do
|
40
76
|
expect { resource.timeout "123" }.not_to raise_error(ArgumentError)
|
41
77
|
expect { resource.timeout "123foo" }.to raise_error(ArgumentError)
|
@@ -86,6 +122,16 @@ describe Chef::Resource::YumRepository do
|
|
86
122
|
expect { resource.mirrorlist_expire "never" }.to raise_error(ArgumentError)
|
87
123
|
end
|
88
124
|
|
125
|
+
it "accepts the legacy 'url' property" do
|
126
|
+
resource.url "foo"
|
127
|
+
expect(resource.baseurl).to eql("foo")
|
128
|
+
end
|
129
|
+
|
130
|
+
it "accepts the legacy 'keyurl' property" do
|
131
|
+
resource.keyurl "foo"
|
132
|
+
expect(resource.gpgkey).to eql("foo")
|
133
|
+
end
|
134
|
+
|
89
135
|
context "on linux", :linux_only do
|
90
136
|
it "resolves to a Noop class when yum is not found" do
|
91
137
|
expect(Chef::Provider::YumRepository).to receive(:which).with("yum").and_return(false)
|
@@ -0,0 +1,51 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Tim Smith (<tsmith@chef.io>)
|
3
|
+
# Copyright:: Copyright 2018 Chef Software, Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require "spec_helper"
|
20
|
+
require "support/shared/unit/resource/static_provider_resolution"
|
21
|
+
|
22
|
+
describe Chef::Resource::ZypperPackage, "initialize" do
|
23
|
+
|
24
|
+
static_provider_resolution(
|
25
|
+
resource: Chef::Resource::ZypperPackage,
|
26
|
+
provider: Chef::Provider::Package::Zypper,
|
27
|
+
name: :zypper_package,
|
28
|
+
action: :install,
|
29
|
+
os: "linux",
|
30
|
+
platform_family: "suse"
|
31
|
+
)
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
describe Chef::Resource::ZypperPackage, "defaults" do
|
36
|
+
let(:resource) { Chef::Resource::ZypperPackage.new("fakey_fakerton") }
|
37
|
+
|
38
|
+
it "sets the default action as :install" do
|
39
|
+
expect(resource.action).to eql([:install])
|
40
|
+
end
|
41
|
+
|
42
|
+
it "supports :install, :lock, :purge, :reconfig, :remove, :unlock, :upgrade actions" do
|
43
|
+
expect { resource.action :install }.not_to raise_error
|
44
|
+
expect { resource.action :lock }.not_to raise_error
|
45
|
+
expect { resource.action :purge }.not_to raise_error
|
46
|
+
expect { resource.action :reconfig }.not_to raise_error
|
47
|
+
expect { resource.action :remove }.not_to raise_error
|
48
|
+
expect { resource.action :unlock }.not_to raise_error
|
49
|
+
expect { resource.action :upgrade }.not_to raise_error
|
50
|
+
end
|
51
|
+
end
|
@@ -22,30 +22,75 @@ describe Chef::Resource::ZypperRepository do
|
|
22
22
|
let(:node) { Chef::Node.new }
|
23
23
|
let(:events) { Chef::EventDispatch::Dispatcher.new }
|
24
24
|
let(:run_context) { Chef::RunContext.new(node, {}, events) }
|
25
|
-
let(:resource) { Chef::Resource::ZypperRepository.new("
|
25
|
+
let(:resource) { Chef::Resource::ZypperRepository.new("fakey_fakerton", run_context) }
|
26
26
|
|
27
27
|
it "has a resource_name of :zypper_repository" do
|
28
28
|
expect(resource.resource_name).to eq(:zypper_repository)
|
29
29
|
end
|
30
30
|
|
31
|
-
it "repo_name is the name_property" do
|
32
|
-
expect(resource.repo_name).to eql("
|
31
|
+
it "the repo_name property is the name_property" do
|
32
|
+
expect(resource.repo_name).to eql("fakey_fakerton")
|
33
33
|
end
|
34
34
|
|
35
|
-
it "
|
36
|
-
expect { resource.repo_name "foo/bar" }.to raise_error(ArgumentError)
|
37
|
-
end
|
38
|
-
|
39
|
-
it "has a default action of create" do
|
35
|
+
it "sets the default action as :create" do
|
40
36
|
expect(resource.action).to eql([:create])
|
41
37
|
end
|
42
38
|
|
43
|
-
it "supports
|
39
|
+
it "supports :add, :create, :refresh, :remove actions" do
|
44
40
|
expect { resource.action :add }.not_to raise_error
|
45
|
-
expect { resource.action :remove }.not_to raise_error
|
46
41
|
expect { resource.action :create }.not_to raise_error
|
47
42
|
expect { resource.action :refresh }.not_to raise_error
|
48
|
-
expect { resource.action :
|
43
|
+
expect { resource.action :remove }.not_to raise_error
|
44
|
+
end
|
45
|
+
|
46
|
+
it "fails if the user provides a repo_name with a forward slash" do
|
47
|
+
expect { resource.repo_name "foo/bar" }.to raise_error(ArgumentError)
|
48
|
+
end
|
49
|
+
|
50
|
+
it "type property defaults to 'NONE'" do
|
51
|
+
expect(resource.type).to eql("NONE")
|
52
|
+
end
|
53
|
+
|
54
|
+
it "enabled property defaults to true" do
|
55
|
+
expect(resource.enabled).to eql(true)
|
56
|
+
end
|
57
|
+
|
58
|
+
it "autorefresh property defaults to true" do
|
59
|
+
expect(resource.autorefresh).to eql(true)
|
60
|
+
end
|
61
|
+
|
62
|
+
it "gpgcheck property defaults to true" do
|
63
|
+
expect(resource.gpgcheck).to eql(true)
|
64
|
+
end
|
65
|
+
|
66
|
+
it "keeppackages property defaults to false" do
|
67
|
+
expect(resource.keeppackages).to eql(false)
|
68
|
+
end
|
69
|
+
|
70
|
+
it "priority property defaults to 99" do
|
71
|
+
expect(resource.priority).to eql(99)
|
72
|
+
end
|
73
|
+
|
74
|
+
it "mode property defaults to '0644'" do
|
75
|
+
expect(resource.mode).to eql("0644")
|
76
|
+
end
|
77
|
+
|
78
|
+
it "refresh_cache property defaults to true" do
|
79
|
+
expect(resource.refresh_cache).to eql(true)
|
80
|
+
end
|
81
|
+
|
82
|
+
it "gpgautoimportkeys property defaults to true" do
|
83
|
+
expect(resource.gpgautoimportkeys).to eql(true)
|
84
|
+
end
|
85
|
+
|
86
|
+
it "accepts the legacy 'key' property" do
|
87
|
+
resource.key "foo"
|
88
|
+
expect(resource.gpgkey).to eql("foo")
|
89
|
+
end
|
90
|
+
|
91
|
+
it "accepts the legacy 'uri' property" do
|
92
|
+
resource.uri "foo"
|
93
|
+
expect(resource.baseurl).to eql("foo")
|
49
94
|
end
|
50
95
|
|
51
96
|
context "on linux", :linux_only do
|