chef 13.6.4 → 13.7.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/acceptance/Gemfile +2 -2
- data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/top_cookbooks.rb +1 -6
- data/distro/powershell/chef/chef.psm1 +1 -5
- data/lib/chef/api_client.rb +5 -5
- data/lib/chef/api_client_v1.rb +6 -6
- data/lib/chef/application.rb +3 -2
- data/lib/chef/application/knife.rb +4 -0
- data/lib/chef/chef_class.rb +2 -2
- data/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/data_handler_base.rb +2 -4
- data/lib/chef/client.rb +3 -3
- data/lib/chef/cookbook/chefignore.rb +4 -0
- data/lib/chef/cookbook/cookbook_collection.rb +2 -2
- data/lib/chef/cookbook/metadata.rb +2 -2
- data/lib/chef/data_bag.rb +1 -1
- data/lib/chef/deprecated.rb +10 -0
- data/lib/chef/event_dispatch/base.rb +2 -2
- data/lib/chef/http.rb +10 -10
- data/lib/chef/knife.rb +16 -15
- data/lib/chef/knife/configure.rb +12 -36
- data/lib/chef/knife/cookbook_upload.rb +4 -4
- data/lib/chef/knife/core/bootstrap_context.rb +1 -1
- data/lib/chef/knife/core/status_presenter.rb +6 -2
- data/lib/chef/knife/core/ui.rb +1 -1
- data/lib/chef/knife/data_bag_secret_options.rb +1 -1
- data/lib/chef/knife/data_bag_show.rb +1 -1
- data/lib/chef/knife/edit.rb +1 -1
- data/lib/chef/knife/ssh.rb +47 -35
- data/lib/chef/knife/user_create.rb +2 -0
- data/lib/chef/knife/user_delete.rb +2 -0
- data/lib/chef/knife/user_edit.rb +2 -0
- data/lib/chef/knife/user_reregister.rb +2 -0
- data/lib/chef/knife/user_show.rb +2 -0
- data/lib/chef/mixin/powershell_out.rb +1 -1
- data/lib/chef/node/attribute.rb +46 -70
- data/lib/chef/node/attribute_collections.rb +5 -5
- data/lib/chef/node/common_api.rb +1 -1
- data/lib/chef/node/immutable_collections.rb +180 -23
- data/lib/chef/node/mixin/state_tracking.rb +6 -6
- data/lib/chef/node_map.rb +63 -45
- data/lib/chef/property.rb +8 -8
- data/lib/chef/provider.rb +9 -3
- data/lib/chef/provider/apt_preference.rb +1 -1
- data/lib/chef/provider/apt_repository.rb +1 -1
- data/lib/chef/provider/apt_update.rb +1 -1
- data/lib/chef/provider/file.rb +1 -1
- data/lib/chef/provider/group/dscl.rb +6 -2
- data/lib/chef/provider/ifconfig.rb +96 -34
- data/lib/chef/provider/launchd.rb +0 -1
- data/lib/chef/provider/log.rb +3 -13
- data/lib/chef/provider/package/dnf.rb +1 -1
- data/lib/chef/provider/package/smartos.rb +2 -2
- data/lib/chef/provider/reboot.rb +12 -0
- data/lib/chef/provider/remote_directory.rb +1 -1
- data/lib/chef/provider/remote_file/http.rb +3 -2
- data/lib/chef/provider/service/solaris.rb +6 -2
- data/lib/chef/provider/systemd_unit.rb +34 -33
- data/lib/chef/provider/user/dscl.rb +1 -1
- data/lib/chef/provider/windows_path.rb +6 -7
- data/lib/chef/provider/windows_task.rb +89 -33
- data/lib/chef/provider/yum_repository.rb +24 -9
- data/lib/chef/resource/apt_package.rb +1 -0
- data/lib/chef/resource/apt_preference.rb +4 -0
- data/lib/chef/resource/apt_repository.rb +4 -0
- data/lib/chef/resource/apt_update.rb +3 -0
- data/lib/chef/resource/bash.rb +4 -0
- data/lib/chef/resource/batch.rb +5 -0
- data/lib/chef/resource/bff_package.rb +4 -0
- data/lib/chef/resource/breakpoint.rb +6 -0
- data/lib/chef/resource/cab_package.rb +6 -6
- data/lib/chef/resource/chef_gem.rb +13 -0
- data/lib/chef/resource/chocolatey_package.rb +4 -6
- data/lib/chef/resource/cookbook_file.rb +13 -15
- data/lib/chef/resource/cron.rb +2 -0
- data/lib/chef/resource/csh.rb +4 -0
- data/lib/chef/resource/directory.rb +8 -26
- data/lib/chef/resource/dnf_package.rb +5 -0
- data/lib/chef/resource/dpkg_package.rb +2 -0
- data/lib/chef/resource/dsc_resource.rb +5 -0
- data/lib/chef/resource/dsc_script.rb +6 -0
- data/lib/chef/resource/env.rb +3 -0
- data/lib/chef/resource/erl_call.rb +5 -0
- data/lib/chef/resource/execute.rb +5 -1
- data/lib/chef/resource/file.rb +2 -1
- data/lib/chef/resource/file/verification.rb +10 -0
- data/lib/chef/resource/freebsd_package.rb +10 -2
- data/lib/chef/resource/gem_package.rb +2 -0
- data/lib/chef/resource/git.rb +2 -0
- data/lib/chef/resource/group.rb +1 -0
- data/lib/chef/resource/homebrew_package.rb +3 -0
- data/lib/chef/resource/http_request.rb +2 -0
- data/lib/chef/resource/ifconfig.rb +23 -150
- data/lib/chef/resource/ips_package.rb +1 -0
- data/lib/chef/resource/ksh.rb +6 -0
- data/lib/chef/resource/launchd.rb +5 -4
- data/lib/chef/resource/link.rb +10 -0
- data/lib/chef/resource/log.rb +19 -46
- data/lib/chef/resource/macports_package.rb +1 -0
- data/lib/chef/resource/mdadm.rb +4 -0
- data/lib/chef/resource/mount.rb +1 -0
- data/lib/chef/resource/msu_package.rb +7 -8
- data/lib/chef/resource/ohai.rb +2 -0
- data/lib/chef/resource/openbsd_package.rb +3 -0
- data/lib/chef/resource/osx_profile.rb +10 -40
- data/lib/chef/resource/package.rb +6 -0
- data/lib/chef/resource/pacman_package.rb +1 -0
- data/lib/chef/resource/paludis_package.rb +3 -0
- data/lib/chef/resource/perl.rb +4 -0
- data/lib/chef/resource/portage_package.rb +1 -0
- data/lib/chef/resource/powershell_package.rb +5 -0
- data/lib/chef/resource/powershell_script.rb +8 -0
- data/lib/chef/resource/python.rb +4 -0
- data/lib/chef/resource/reboot.rb +14 -20
- data/lib/chef/resource/registry_key.rb +1 -0
- data/lib/chef/resource/remote_directory.rb +3 -0
- data/lib/chef/resource/remote_file.rb +2 -0
- data/lib/chef/resource/resource_notification.rb +17 -0
- data/lib/chef/resource/route.rb +1 -0
- data/lib/chef/resource/rpm_package.rb +1 -0
- data/lib/chef/resource/ruby.rb +4 -0
- data/lib/chef/resource/ruby_block.rb +3 -0
- data/lib/chef/resource/script.rb +4 -0
- data/lib/chef/resource/service.rb +1 -0
- data/lib/chef/resource/smartos_package.rb +1 -0
- data/lib/chef/resource/solaris_package.rb +1 -0
- data/lib/chef/resource/subversion.rb +1 -0
- data/lib/chef/resource/systemd_unit.rb +6 -0
- data/lib/chef/resource/template.rb +9 -0
- data/lib/chef/resource/user.rb +1 -0
- data/lib/chef/resource/windows_package.rb +2 -0
- data/lib/chef/resource/windows_path.rb +5 -10
- data/lib/chef/resource/windows_service.rb +3 -0
- data/lib/chef/resource/windows_task.rb +66 -87
- data/lib/chef/resource/yum_repository.rb +26 -22
- data/lib/chef/resource/zypper_package.rb +2 -0
- data/lib/chef/resource/zypper_repository.rb +6 -1
- data/lib/chef/run_context.rb +8 -2
- data/lib/chef/server_api.rb +1 -0
- data/lib/chef/util/selinux.rb +5 -4
- data/lib/chef/version.rb +1 -1
- data/lib/chef/version/platform.rb +18 -0
- data/lib/chef/version_constraint/platform.rb +2 -0
- data/spec/data/client.d_00/02-strings.rb +2 -0
- data/spec/functional/assets/chefinittest +6 -4
- data/spec/functional/knife/ssh_spec.rb +54 -7
- data/spec/functional/resource/bff_spec.rb +3 -3
- data/spec/functional/resource/ifconfig_spec.rb +1 -1
- data/spec/functional/resource/mount_spec.rb +7 -3
- data/spec/functional/resource/user/useradd_spec.rb +4 -4
- data/spec/functional/resource/windows_task_spec.rb +6 -6
- data/spec/functional/win32/security_spec.rb +7 -33
- data/spec/integration/knife/data_bag_show_spec.rb +1 -1
- data/spec/integration/recipes/noop_resource_spec.rb +1 -1
- data/spec/integration/recipes/recipe_dsl_spec.rb +30 -30
- data/spec/integration/recipes/resource_action_spec.rb +2 -2
- data/spec/integration/recipes/resource_converge_if_changed_spec.rb +71 -15
- data/spec/spec_helper.rb +19 -0
- data/spec/support/shared/functional/execute_resource.rb +1 -1
- data/spec/support/shared/unit/application_dot_d.rb +2 -0
- data/spec/support/shared/unit/execute_resource.rb +8 -1
- data/spec/support/shared/unit/provider/file.rb +9 -1
- data/spec/unit/chef_fs/data_handler/data_bag_item_data_handler.rb +10 -7
- data/spec/unit/chef_fs/file_system/repository/directory_spec.rb +2 -2
- data/spec/unit/client_spec.rb +1 -1
- data/spec/unit/deprecated_spec.rb +4 -4
- data/spec/unit/http_spec.rb +9 -0
- data/spec/unit/knife/bootstrap_spec.rb +5 -0
- data/spec/unit/knife/configure_spec.rb +10 -60
- data/spec/unit/knife/data_bag_create_spec.rb +40 -2
- data/spec/unit/knife/data_bag_show_spec.rb +16 -2
- data/spec/unit/knife/ssh_spec.rb +85 -39
- data/spec/unit/knife_spec.rb +2 -0
- data/spec/unit/lwrp_spec.rb +5 -3
- data/spec/unit/mixin/powershell_type_coercions_spec.rb +7 -6
- data/spec/unit/node/attribute_spec.rb +55 -24
- data/spec/unit/node/immutable_collections_spec.rb +28 -14
- data/spec/unit/node/vivid_mash_spec.rb +27 -10
- data/spec/unit/node_map_spec.rb +34 -0
- data/spec/unit/property_spec.rb +13 -13
- data/spec/unit/provider/group/dscl_spec.rb +14 -5
- data/spec/unit/provider/ifconfig_spec.rb +10 -3
- data/spec/unit/provider/remote_file/http_spec.rb +23 -19
- data/spec/unit/provider/service/solaris_smf_service_spec.rb +6 -5
- data/spec/unit/provider/user/dscl_spec.rb +26 -0
- data/spec/unit/provider/windows_task_spec.rb +148 -4
- data/spec/unit/provider_spec.rb +1 -1
- data/spec/unit/resource/apt_package_spec.rb +1 -1
- data/spec/unit/resource/bash_spec.rb +8 -10
- data/spec/unit/resource/batch_spec.rb +1 -1
- data/spec/unit/resource/cab_package_spec.rb +19 -1
- data/spec/unit/resource/chef_gem_spec.rb +3 -3
- data/spec/unit/resource/chocolatey_package_spec.rb +10 -10
- data/spec/unit/resource/conditional_spec.rb +2 -2
- data/spec/unit/resource/cookbook_file_spec.rb +24 -30
- data/spec/unit/resource/cron_spec.rb +79 -82
- data/spec/unit/resource/csh_spec.rb +8 -10
- data/spec/unit/resource/deploy_spec.rb +1 -1
- data/spec/unit/resource/directory_spec.rb +28 -31
- data/spec/unit/resource/dnf_package_spec.rb +9 -9
- data/spec/unit/resource/env_spec.rb +7 -7
- data/spec/unit/resource/erl_call_spec.rb +9 -9
- data/spec/unit/resource/execute_spec.rb +6 -6
- data/spec/unit/resource/file/verification_spec.rb +18 -4
- data/spec/unit/resource/file_spec.rb +53 -56
- data/spec/unit/resource/freebsd_package_spec.rb +7 -7
- data/spec/unit/resource/gem_package_spec.rb +1 -1
- data/spec/unit/resource/git_spec.rb +7 -9
- data/spec/unit/resource/group_spec.rb +60 -70
- data/spec/unit/resource/http_request_spec.rb +16 -19
- data/spec/unit/resource/ifconfig_spec.rb +3 -3
- data/spec/unit/resource/ips_package_spec.rb +3 -5
- data/spec/unit/resource/ksh_spec.rb +8 -10
- data/spec/unit/resource/launchd_spec.rb +17 -10
- data/spec/unit/resource/link_spec.rb +53 -53
- data/spec/unit/resource/log_spec.rb +24 -28
- data/spec/unit/resource/mdadm_spec.rb +42 -44
- data/spec/unit/resource/mount_spec.rb +97 -99
- data/spec/unit/resource/msu_package_spec.rb +14 -8
- data/spec/unit/resource/ohai_spec.rb +15 -17
- data/spec/unit/resource/openbsd_package_spec.rb +3 -3
- data/spec/unit/resource/osx_profile_spec.rb +7 -7
- data/spec/unit/resource/package_spec.rb +36 -40
- data/spec/unit/resource/perl_spec.rb +8 -11
- data/spec/unit/resource/portage_package_spec.rb +8 -10
- data/spec/unit/resource/powershell_package_spec.rb +9 -9
- data/spec/unit/resource/python_spec.rb +8 -11
- data/spec/unit/resource/reboot_spec.rb +50 -0
- data/spec/unit/resource/registry_key_spec.rb +84 -98
- data/spec/unit/resource/remote_directory_spec.rb +40 -42
- data/spec/unit/resource/remote_file_spec.rb +78 -80
- data/spec/unit/resource/route_spec.rb +42 -44
- data/spec/unit/resource/rpm_package_spec.rb +5 -7
- data/spec/unit/resource/ruby_block_spec.rb +14 -16
- data/spec/unit/resource/ruby_spec.rb +8 -12
- data/spec/unit/resource/scm_spec.rb +66 -69
- data/spec/unit/resource/script_spec.rb +1 -1
- data/spec/unit/resource/service_spec.rb +80 -83
- data/spec/unit/resource/smartos_package_spec.rb +5 -0
- data/spec/unit/resource/solaris_package_spec.rb +3 -5
- data/spec/unit/resource/subversion_spec.rb +18 -16
- data/spec/unit/resource/systemd_unit_spec.rb +50 -54
- data/spec/unit/resource/template_spec.rb +56 -61
- data/spec/unit/resource/user_spec.rb +47 -53
- data/spec/unit/resource/windows_package_spec.rb +1 -1
- data/spec/unit/resource/windows_path_spec.rb +11 -8
- data/spec/unit/resource/windows_task_spec.rb +129 -33
- data/spec/unit/resource/yum_package_spec.rb +1 -1
- data/spec/unit/resource/yum_repository_spec.rb +61 -8
- data/spec/unit/resource/zypper_repository_spec.rb +17 -18
- data/spec/unit/util/selinux_spec.rb +3 -6
- data/tasks/dependencies.rb +0 -5
- data/tasks/rspec.rb +1 -1
- metadata +6 -6
- data/acceptance/top-cookbooks/.kitchen.docker.yml +0 -13
- data/acceptance/top-cookbooks/.kitchen.git.yml +0 -11
@@ -31,19 +31,25 @@ describe Chef::Resource::MsuPackage do
|
|
31
31
|
expect(resource.resource_name).to eql(:msu_package)
|
32
32
|
end
|
33
33
|
|
34
|
-
it "sets the
|
35
|
-
expect(resource.
|
34
|
+
it "sets the default action as :install" do
|
35
|
+
expect(resource.action).to eql([:install])
|
36
36
|
end
|
37
37
|
|
38
|
-
it "
|
39
|
-
expect(resource.
|
38
|
+
it "coerces name property to package_name property" do
|
39
|
+
expect(resource.package_name).to eql("test_pkg")
|
40
40
|
end
|
41
41
|
|
42
|
-
it "
|
43
|
-
expect
|
42
|
+
it "coerces name property to a source property if source not provided" do
|
43
|
+
expect(resource.source).to end_with("test_pkg")
|
44
44
|
end
|
45
45
|
|
46
|
-
it "
|
47
|
-
|
46
|
+
it "coerces name property to a source property if source not provided and package_name is" do
|
47
|
+
resource.package_name("package.msu")
|
48
|
+
expect(resource.source).to end_with("package.msu")
|
49
|
+
end
|
50
|
+
|
51
|
+
it "coerces source property if it does not looks like a path" do
|
52
|
+
resource.source("package.msu")
|
53
|
+
expect(resource.source).not_to eq("package.msu")
|
48
54
|
end
|
49
55
|
end
|
@@ -20,41 +20,39 @@ require "spec_helper"
|
|
20
20
|
|
21
21
|
describe Chef::Resource::Ohai do
|
22
22
|
|
23
|
-
|
24
|
-
@resource = Chef::Resource::Ohai.new("ohai_reload")
|
25
|
-
end
|
23
|
+
let(:resource) { Chef::Resource::Ohai.new("ohai_reload") }
|
26
24
|
|
27
|
-
it "
|
28
|
-
expect(
|
29
|
-
expect(
|
25
|
+
it "creates a new Chef::Resource::Ohai" do
|
26
|
+
expect(resource).to be_a_kind_of(Chef::Resource)
|
27
|
+
expect(resource).to be_a_kind_of(Chef::Resource::Ohai)
|
30
28
|
end
|
31
29
|
|
32
|
-
it "
|
33
|
-
expect(
|
30
|
+
it "has a resource name of :ohai" do
|
31
|
+
expect(resource.resource_name).to eql(:ohai)
|
34
32
|
end
|
35
33
|
|
36
|
-
it "
|
37
|
-
expect(
|
34
|
+
it "has a default action of reload" do
|
35
|
+
expect(resource.action).to eql([:reload])
|
38
36
|
end
|
39
37
|
|
40
|
-
it "
|
41
|
-
|
42
|
-
expect(
|
38
|
+
it "allows you to set the plugin attribute" do
|
39
|
+
resource.plugin "passwd"
|
40
|
+
expect(resource.plugin).to eql("passwd")
|
43
41
|
end
|
44
42
|
|
45
43
|
describe "when it has a plugin value" do
|
46
44
|
before do
|
47
|
-
|
48
|
-
|
45
|
+
resource.name("test")
|
46
|
+
resource.plugin("passwd")
|
49
47
|
end
|
50
48
|
|
51
49
|
it "describes its state" do
|
52
|
-
state =
|
50
|
+
state = resource.state_for_resource_reporter
|
53
51
|
expect(state[:plugin]).to eq("passwd")
|
54
52
|
end
|
55
53
|
|
56
54
|
it "returns the name as its identity" do
|
57
|
-
expect(
|
55
|
+
expect(resource.identity).to eq("test")
|
58
56
|
end
|
59
57
|
end
|
60
58
|
|
@@ -32,15 +32,15 @@ describe Chef::Resource::OpenbsdPackage do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
describe "Initialization" do
|
35
|
-
it "
|
35
|
+
it "returns a Chef::Resource::OpenbsdPackage" do
|
36
36
|
expect(@resource).to be_a_kind_of(Chef::Resource::OpenbsdPackage)
|
37
37
|
end
|
38
38
|
|
39
|
-
it "
|
39
|
+
it "sets the resource_name to :openbsd_package" do
|
40
40
|
expect(@resource.resource_name).to eql(:openbsd_package)
|
41
41
|
end
|
42
42
|
|
43
|
-
it "
|
43
|
+
it "does not set the provider" do
|
44
44
|
expect(@resource.provider).to be_nil
|
45
45
|
end
|
46
46
|
end
|
@@ -25,36 +25,36 @@ describe Chef::Resource::OsxProfile do
|
|
25
25
|
run_context)
|
26
26
|
end
|
27
27
|
|
28
|
-
it "
|
28
|
+
it "creates a new Chef::Resource::OsxProfile" do
|
29
29
|
expect(resource).to be_a_kind_of(Chef::Resource)
|
30
30
|
expect(resource).to be_a_kind_of(Chef::Resource::OsxProfile)
|
31
31
|
end
|
32
32
|
|
33
|
-
it "
|
33
|
+
it "has a resource name of profile" do
|
34
34
|
expect(resource.resource_name).to eql(:osx_profile)
|
35
35
|
end
|
36
36
|
|
37
|
-
it "
|
37
|
+
it "has a default action of install" do
|
38
38
|
expect(resource.action).to eql([:install])
|
39
39
|
end
|
40
40
|
|
41
|
-
it "
|
41
|
+
it "accepts install and remove as actions" do
|
42
42
|
expect { resource.action :install }.not_to raise_error
|
43
43
|
expect { resource.action :remove }.not_to raise_error
|
44
44
|
end
|
45
45
|
|
46
|
-
it "
|
46
|
+
it "allows you to set the profile attribute" do
|
47
47
|
resource.profile "com.testprofile.screensaver"
|
48
48
|
expect(resource.profile).to eql("com.testprofile.screensaver")
|
49
49
|
end
|
50
50
|
|
51
|
-
it "
|
51
|
+
it "allows you to set the profile attribute to a string" do
|
52
52
|
resource.profile "com.testprofile.screensaver"
|
53
53
|
expect(resource.profile).to be_a(String)
|
54
54
|
expect(resource.profile).to eql("com.testprofile.screensaver")
|
55
55
|
end
|
56
56
|
|
57
|
-
it "
|
57
|
+
it "allows you to set the profile attribute to a hash" do
|
58
58
|
test_profile = { "profile" => false }
|
59
59
|
resource.profile test_profile
|
60
60
|
expect(resource.profile).to be_a(Hash)
|
@@ -20,84 +20,80 @@
|
|
20
20
|
require "spec_helper"
|
21
21
|
|
22
22
|
describe Chef::Resource::Package do
|
23
|
+
let(:resource) { Chef::Resource::Package.new("emacs") }
|
23
24
|
|
24
|
-
|
25
|
-
|
25
|
+
it "creates a new Chef::Resource::Package" do
|
26
|
+
expect(resource).to be_a_kind_of(Chef::Resource)
|
27
|
+
expect(resource).to be_a_kind_of(Chef::Resource::Package)
|
26
28
|
end
|
27
29
|
|
28
|
-
it "
|
29
|
-
expect(
|
30
|
-
expect(@resource).to be_a_kind_of(Chef::Resource::Package)
|
30
|
+
it "sets the package_name to the first argument to new" do
|
31
|
+
expect(resource.package_name).to eql("emacs")
|
31
32
|
end
|
32
33
|
|
33
|
-
it "
|
34
|
-
|
34
|
+
it "accepts a string for the package name" do
|
35
|
+
resource.package_name "something"
|
36
|
+
expect(resource.package_name).to eql("something")
|
35
37
|
end
|
36
38
|
|
37
|
-
it "
|
38
|
-
|
39
|
-
expect(
|
39
|
+
it "accepts a string for the version" do
|
40
|
+
resource.version "something"
|
41
|
+
expect(resource.version).to eql("something")
|
40
42
|
end
|
41
43
|
|
42
|
-
it "
|
43
|
-
|
44
|
-
expect(
|
44
|
+
it "accepts a string for the response file" do
|
45
|
+
resource.response_file "something"
|
46
|
+
expect(resource.response_file).to eql("something")
|
45
47
|
end
|
46
48
|
|
47
|
-
it "
|
48
|
-
|
49
|
-
expect(
|
49
|
+
it "accepts a hash for response file template variables" do
|
50
|
+
resource.response_file_variables({ :variables => true })
|
51
|
+
expect(resource.response_file_variables).to eql({ :variables => true })
|
50
52
|
end
|
51
53
|
|
52
|
-
it "
|
53
|
-
|
54
|
-
expect(
|
54
|
+
it "accepts a string for the source" do
|
55
|
+
resource.source "something"
|
56
|
+
expect(resource.source).to eql("something")
|
55
57
|
end
|
56
58
|
|
57
|
-
it "
|
58
|
-
|
59
|
-
expect(
|
59
|
+
it "accepts a string for the options" do
|
60
|
+
resource.options "something"
|
61
|
+
expect(resource.options).to eql(["something"])
|
60
62
|
end
|
61
63
|
|
62
|
-
it "
|
63
|
-
|
64
|
-
expect(
|
65
|
-
end
|
66
|
-
|
67
|
-
it "should split options" do
|
68
|
-
@resource.options "-a -b 'arg with spaces' -b \"and quotes\""
|
69
|
-
expect(@resource.options).to eql(["-a", "-b", "arg with spaces", "-b", "and quotes"])
|
64
|
+
it "splits options" do
|
65
|
+
resource.options "-a -b 'arg with spaces' -b \"and quotes\""
|
66
|
+
expect(resource.options).to eql(["-a", "-b", "arg with spaces", "-b", "and quotes"])
|
70
67
|
end
|
71
68
|
|
72
69
|
describe "when it has a package_name and version" do
|
73
70
|
before do
|
74
|
-
|
75
|
-
|
76
|
-
|
71
|
+
resource.package_name("tomcat")
|
72
|
+
resource.version("10.9.8")
|
73
|
+
resource.options("-al")
|
77
74
|
end
|
78
75
|
|
79
76
|
it "describes its state" do
|
80
|
-
state =
|
77
|
+
state = resource.state_for_resource_reporter
|
81
78
|
expect(state[:version]).to eq("10.9.8")
|
82
79
|
expect(state[:options]).to eq(["-al"])
|
83
80
|
end
|
84
81
|
|
85
82
|
it "returns the file path as its identity" do
|
86
|
-
expect(
|
83
|
+
expect(resource.identity).to eq("tomcat")
|
87
84
|
end
|
88
85
|
|
89
86
|
it "takes options as an array" do
|
90
|
-
|
91
|
-
expect(
|
87
|
+
resource.options [ "-a", "-l" ]
|
88
|
+
expect(resource.options).to eq(["-a", "-l" ])
|
92
89
|
end
|
93
90
|
end
|
94
91
|
|
95
92
|
# String, Integer
|
96
93
|
[ "600", 600 ].each do |val|
|
97
94
|
it "supports setting a timeout as a #{val.class}" do
|
98
|
-
|
99
|
-
expect(
|
95
|
+
resource.timeout(val)
|
96
|
+
expect(resource.timeout).to eql(val)
|
100
97
|
end
|
101
98
|
end
|
102
|
-
|
103
99
|
end
|
@@ -20,21 +20,18 @@ require "spec_helper"
|
|
20
20
|
|
21
21
|
describe Chef::Resource::Perl do
|
22
22
|
|
23
|
-
|
24
|
-
@resource = Chef::Resource::Perl.new("fakey_fakerton")
|
25
|
-
end
|
23
|
+
let(:resource) { Chef::Resource::Perl.new("fakey_fakerton") }
|
26
24
|
|
27
|
-
it "
|
28
|
-
expect(
|
29
|
-
expect(
|
25
|
+
it "creates a new Chef::Resource::Perl" do
|
26
|
+
expect(resource).to be_a_kind_of(Chef::Resource)
|
27
|
+
expect(resource).to be_a_kind_of(Chef::Resource::Perl)
|
30
28
|
end
|
31
29
|
|
32
|
-
it "
|
33
|
-
expect(
|
30
|
+
it "has a resource name of :perl" do
|
31
|
+
expect(resource.resource_name).to eql(:perl)
|
34
32
|
end
|
35
33
|
|
36
|
-
it "
|
37
|
-
expect(
|
34
|
+
it "has an interpreter of perl" do
|
35
|
+
expect(resource.interpreter).to eql("perl")
|
38
36
|
end
|
39
|
-
|
40
37
|
end
|
@@ -16,23 +16,21 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
require
|
19
|
+
require "spec_helper"
|
20
20
|
|
21
21
|
describe Chef::Resource::PortagePackage, "initialize" do
|
22
22
|
|
23
|
-
|
24
|
-
@resource = Chef::Resource::PortagePackage.new("foo")
|
25
|
-
end
|
23
|
+
let(:resource) { Chef::Resource::PortagePackage.new("foo") }
|
26
24
|
|
27
|
-
it "
|
28
|
-
expect(
|
25
|
+
it "returns a Chef::Resource::PortagePackage" do
|
26
|
+
expect(resource).to be_a_kind_of(Chef::Resource::PortagePackage)
|
29
27
|
end
|
30
28
|
|
31
|
-
it "
|
32
|
-
expect(
|
29
|
+
it "sets the resource_name to :portage_package" do
|
30
|
+
expect(resource.resource_name).to eql(:portage_package)
|
33
31
|
end
|
34
32
|
|
35
|
-
it "
|
36
|
-
expect(
|
33
|
+
it "sets the provider to Chef::Provider::Package::Portage" do
|
34
|
+
expect(resource.provider).to eql(Chef::Provider::Package::Portage)
|
37
35
|
end
|
38
36
|
end
|
@@ -22,46 +22,46 @@ describe Chef::Resource::PowershellPackage do
|
|
22
22
|
|
23
23
|
let(:resource) { Chef::Resource::PowershellPackage.new("test_package") }
|
24
24
|
|
25
|
-
it "
|
25
|
+
it "creates a new Chef::Resource::PowershellPackage" do
|
26
26
|
expect(resource).to be_a_kind_of(Chef::Resource)
|
27
27
|
expect(resource).to be_a_kind_of(Chef::Resource::Package)
|
28
28
|
expect(resource).to be_a_instance_of(Chef::Resource::PowershellPackage)
|
29
29
|
end
|
30
30
|
|
31
31
|
#to check the value of resource.resource_name
|
32
|
-
it "
|
32
|
+
it "has a resource name of :python" do
|
33
33
|
expect(resource.resource_name).to eql(:powershell_package)
|
34
34
|
end
|
35
35
|
|
36
|
-
it "
|
36
|
+
it "coerces its name to a package_name array" do
|
37
37
|
expect(resource.package_name).to eql(["test_package"])
|
38
38
|
end
|
39
39
|
|
40
|
-
it "the package_name setter
|
40
|
+
it "the package_name setter coerces to arrays" do
|
41
41
|
resource.package_name("git")
|
42
42
|
expect(resource.package_name).to eql(["git"])
|
43
43
|
end
|
44
44
|
|
45
|
-
it "the package_name setter
|
45
|
+
it "the package_name setter accepts arrays" do
|
46
46
|
resource.package_name(%w{git unzip})
|
47
47
|
expect(resource.package_name).to eql(%w{git unzip})
|
48
48
|
end
|
49
49
|
|
50
|
-
it "the name
|
50
|
+
it "the name accepts arrays" do
|
51
51
|
resource = Chef::Resource::PowershellPackage.new(%w{git unzip})
|
52
52
|
expect(resource.package_name).to eql(%w{git unzip})
|
53
53
|
end
|
54
54
|
|
55
|
-
it "the default version
|
55
|
+
it "the default version is nil" do
|
56
56
|
expect(resource.version).to eql(nil)
|
57
57
|
end
|
58
58
|
|
59
|
-
it "the version setter
|
59
|
+
it "the version setter coerces to arrays" do
|
60
60
|
resource.version("1.2.3")
|
61
61
|
expect(resource.version).to eql(["1.2.3"])
|
62
62
|
end
|
63
63
|
|
64
|
-
it "the version setter
|
64
|
+
it "the version setter accepts arrays" do
|
65
65
|
resource.version(["1.2.3", "4.5.6"])
|
66
66
|
expect(resource.version).to eql(["1.2.3", "4.5.6"])
|
67
67
|
end
|
@@ -20,21 +20,18 @@ require "spec_helper"
|
|
20
20
|
|
21
21
|
describe Chef::Resource::Python do
|
22
22
|
|
23
|
-
|
24
|
-
@resource = Chef::Resource::Python.new("fakey_fakerton")
|
25
|
-
end
|
23
|
+
let(:resource) { Chef::Resource::Python.new("fakey_fakerton") }
|
26
24
|
|
27
|
-
it "
|
28
|
-
expect(
|
29
|
-
expect(
|
25
|
+
it "creates a new Chef::Resource::Python" do
|
26
|
+
expect(resource).to be_a_kind_of(Chef::Resource)
|
27
|
+
expect(resource).to be_a_kind_of(Chef::Resource::Python)
|
30
28
|
end
|
31
29
|
|
32
|
-
it "
|
33
|
-
expect(
|
30
|
+
it "has a resource name of :python" do
|
31
|
+
expect(resource.resource_name).to eql(:python)
|
34
32
|
end
|
35
33
|
|
36
|
-
it "
|
37
|
-
expect(
|
34
|
+
it "has an interpreter of python" do
|
35
|
+
expect(resource.interpreter).to eql("python")
|
38
36
|
end
|
39
|
-
|
40
37
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright 2017, Chef Software Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require "spec_helper"
|
19
|
+
|
20
|
+
describe Chef::Resource::Reboot do
|
21
|
+
|
22
|
+
let(:resource) { Chef::Resource::Reboot.new("reboot me!") }
|
23
|
+
|
24
|
+
it "creates a new Chef::Resource::Reboot" do
|
25
|
+
expect(resource).to be_a_kind_of(Chef::Resource)
|
26
|
+
expect(resource).to be_a_kind_of(Chef::Resource::Reboot)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "has a default action of :nothing" do
|
30
|
+
expect(resource.action).to eql([:nothing])
|
31
|
+
end
|
32
|
+
|
33
|
+
it "supports the :nothing, :request_reboot, :reboot_now, and :cancel actions" do
|
34
|
+
expect(resource.allowed_actions).to include(:nothing, :request_reboot, :reboot_now, :cancel)
|
35
|
+
end
|
36
|
+
|
37
|
+
it "has a resource_name of :reboot" do
|
38
|
+
expect(resource.resource_name).to eq(:reboot)
|
39
|
+
end
|
40
|
+
|
41
|
+
it "accepts a String for the reboot reason" do
|
42
|
+
resource.reason "reasons"
|
43
|
+
expect(resource.reason).to eq("reasons")
|
44
|
+
end
|
45
|
+
|
46
|
+
it "accepts an Integer for delay_mins" do
|
47
|
+
resource.delay_mins 100
|
48
|
+
expect { resource.delay_mins "100" }.to raise_error(ArgumentError)
|
49
|
+
end
|
50
|
+
end
|