chef 12.11.18-universal-mingw32 → 12.12.13-universal-mingw32

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.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +4 -4
  3. data/Rakefile +3 -2
  4. data/VERSION +1 -1
  5. data/acceptance/Gemfile.lock +22 -23
  6. data/acceptance/data-collector/test/integration/default/serverspec/default_spec.rb +2 -41
  7. data/lib/chef/application/solo.rb +7 -0
  8. data/lib/chef/chef_fs/file_system/multiplexed_dir.rb +1 -1
  9. data/lib/chef/data_collector.rb +79 -43
  10. data/lib/chef/data_collector/messages.rb +4 -33
  11. data/lib/chef/data_collector/messages/helpers.rb +2 -2
  12. data/lib/chef/data_collector/resource_report.rb +21 -11
  13. data/lib/chef/decorator/unchain.rb +43 -0
  14. data/lib/chef/exceptions.rb +5 -0
  15. data/lib/chef/http.rb +5 -5
  16. data/lib/chef/knife/cookbook_create.rb +4 -0
  17. data/lib/chef/knife/cookbook_site_download.rb +8 -1
  18. data/lib/chef/knife/cookbook_site_install.rb +8 -0
  19. data/lib/chef/knife/cookbook_site_list.rb +8 -1
  20. data/lib/chef/knife/cookbook_site_search.rb +8 -1
  21. data/lib/chef/knife/cookbook_site_share.rb +8 -1
  22. data/lib/chef/knife/cookbook_site_show.rb +14 -3
  23. data/lib/chef/knife/cookbook_site_unshare.rb +8 -1
  24. data/lib/chef/knife/core/bootstrap_context.rb +1 -1
  25. data/lib/chef/knife/supermarket_download.rb +33 -0
  26. data/lib/chef/knife/supermarket_install.rb +33 -0
  27. data/lib/chef/knife/supermarket_list.rb +33 -0
  28. data/lib/chef/knife/supermarket_search.rb +33 -0
  29. data/lib/chef/knife/supermarket_share.rb +33 -0
  30. data/lib/chef/knife/supermarket_show.rb +33 -0
  31. data/lib/chef/knife/supermarket_unshare.rb +33 -0
  32. data/lib/chef/node.rb +13 -32
  33. data/lib/chef/node/attribute.rb +123 -70
  34. data/lib/chef/node/attribute_collections.rb +9 -130
  35. data/lib/chef/node/common_api.rb +124 -0
  36. data/lib/chef/node/immutable_collections.rb +27 -2
  37. data/lib/chef/property.rb +6 -2
  38. data/lib/chef/provider.rb +4 -5
  39. data/lib/chef/provider/batch.rb +1 -1
  40. data/lib/chef/provider/directory.rb +3 -1
  41. data/lib/chef/provider/package/openbsd.rb +1 -1
  42. data/lib/chef/provider/package/rubygems.rb +9 -3
  43. data/lib/chef/provider/package/windows/exe.rb +2 -5
  44. data/lib/chef/provider/powershell_script.rb +1 -1
  45. data/lib/chef/provider/remote_directory.rb +2 -0
  46. data/lib/chef/resource.rb +22 -17
  47. data/lib/chef/resource_builder.rb +9 -4
  48. data/lib/chef/shell.rb +1 -1
  49. data/lib/chef/version.rb +1 -1
  50. data/spec/data/run_context/cookbooks/circular-dep1/attributes/default.rb +2 -4
  51. data/spec/data/run_context/cookbooks/circular-dep2/attributes/default.rb +2 -3
  52. data/spec/data/run_context/cookbooks/dependency1/attributes/aa_first.rb +2 -2
  53. data/spec/data/run_context/cookbooks/dependency1/attributes/default.rb +2 -2
  54. data/spec/data/run_context/cookbooks/dependency1/attributes/zz_last.rb +2 -3
  55. data/spec/data/run_context/cookbooks/dependency2/attributes/default.rb +2 -3
  56. data/spec/data/run_context/cookbooks/no-default-attr/attributes/server.rb +2 -3
  57. data/spec/data/run_context/cookbooks/test-with-circular-deps/attributes/default.rb +2 -3
  58. data/spec/data/run_context/cookbooks/test-with-deps/attributes/default.rb +2 -3
  59. data/spec/functional/assets/chocolatey_feed/test-A.1.0.nupkg +0 -0
  60. data/spec/functional/assets/chocolatey_feed/test-A.1.5.nupkg +0 -0
  61. data/spec/functional/assets/chocolatey_feed/test-A.2.0.nupkg +0 -0
  62. data/spec/functional/assets/chocolatey_feed/test-B.1.0.nupkg +0 -0
  63. data/spec/functional/resource/dsc_script_spec.rb +1 -0
  64. data/spec/functional/resource/package_spec.rb +1 -1
  65. data/spec/functional/resource/template_spec.rb +3 -3
  66. data/spec/functional/shell_spec.rb +1 -1
  67. data/spec/integration/knife/client_bulk_delete_spec.rb +130 -0
  68. data/spec/integration/knife/client_create_spec.rb +69 -0
  69. data/spec/integration/knife/client_delete_spec.rb +63 -0
  70. data/spec/integration/knife/client_key_create_spec.rb +65 -0
  71. data/spec/integration/knife/client_key_delete_spec.rb +42 -0
  72. data/spec/integration/knife/client_key_list_spec.rb +60 -0
  73. data/spec/integration/knife/client_key_show_spec.rb +44 -0
  74. data/spec/integration/knife/client_list_spec.rb +48 -0
  75. data/spec/integration/knife/client_show_spec.rb +36 -0
  76. data/spec/integration/knife/cookbook_bulk_delete_spec.rb +64 -0
  77. data/spec/integration/knife/cookbook_download_spec.rb +95 -0
  78. data/spec/integration/knife/cookbook_list_spec.rb +54 -0
  79. data/spec/integration/knife/cookbook_show_spec.rb +159 -0
  80. data/spec/integration/knife/cookbook_upload_spec.rb +90 -0
  81. data/spec/integration/knife/data_bag_create_spec.rb +58 -0
  82. data/spec/integration/knife/data_bag_delete_spec.rb +58 -0
  83. data/spec/integration/knife/data_bag_from_file_spec.rb +115 -0
  84. data/spec/integration/knife/data_bag_list_spec.rb +43 -0
  85. data/spec/integration/knife/data_bag_show_spec.rb +53 -0
  86. data/spec/integration/knife/environment_compare_spec.rb +74 -0
  87. data/spec/integration/knife/environment_create_spec.rb +40 -0
  88. data/spec/integration/knife/environment_delete_spec.rb +36 -0
  89. data/spec/integration/knife/environment_from_file_spec.rb +115 -0
  90. data/spec/integration/knife/environment_list_spec.rb +41 -0
  91. data/spec/integration/knife/environment_show_spec.rb +56 -0
  92. data/spec/integration/knife/node_bulk_delete_spec.rb +51 -0
  93. data/spec/integration/knife/node_create_spec.rb +46 -0
  94. data/spec/integration/knife/node_delete_spec.rb +47 -0
  95. data/spec/integration/knife/node_environment_set_spec.rb +42 -0
  96. data/spec/integration/knife/node_from_file_spec.rb +58 -0
  97. data/spec/integration/knife/node_list_spec.rb +44 -0
  98. data/spec/integration/knife/node_run_list_add_spec.rb +53 -0
  99. data/spec/integration/knife/node_run_list_remove_spec.rb +35 -0
  100. data/spec/integration/knife/node_run_list_set_spec.rb +40 -0
  101. data/spec/integration/knife/node_show_spec.rb +35 -0
  102. data/spec/integration/knife/role_bulk_delete_spec.rb +51 -0
  103. data/spec/integration/knife/role_create_spec.rb +40 -0
  104. data/spec/integration/knife/role_delete_spec.rb +47 -0
  105. data/spec/integration/knife/role_from_file_spec.rb +95 -0
  106. data/spec/integration/knife/role_list_spec.rb +44 -0
  107. data/spec/integration/knife/role_show_spec.rb +50 -0
  108. data/spec/support/shared/integration/knife_support.rb +10 -3
  109. data/spec/unit/application/solo_spec.rb +7 -0
  110. data/spec/unit/cookbook_version_spec.rb +4 -4
  111. data/spec/unit/data_collector/messages/helpers_spec.rb +3 -7
  112. data/spec/unit/data_collector/messages_spec.rb +28 -45
  113. data/spec/unit/data_collector_spec.rb +40 -47
  114. data/spec/unit/knife/cookbook_create_spec.rb +1 -0
  115. data/spec/unit/knife/cookbook_site_download_spec.rb +1 -0
  116. data/spec/unit/knife/node_environment_set_spec.rb +0 -24
  117. data/spec/unit/knife/node_run_list_set_spec.rb +0 -25
  118. data/spec/unit/node/attribute_spec.rb +7 -9
  119. data/spec/unit/node/immutable_collections_spec.rb +4 -0
  120. data/spec/unit/node/vivid_mash_spec.rb +344 -0
  121. data/spec/unit/node_spec.rb +115 -26
  122. data/spec/unit/provider/directory_spec.rb +11 -1
  123. data/spec/unit/provider/package/windows/exe_spec.rb +14 -9
  124. data/spec/unit/provider/powershell_script_spec.rb +4 -4
  125. data/spec/unit/provider/remote_directory_spec.rb +15 -0
  126. data/spec/unit/recipe_spec.rb +31 -6
  127. data/spec/unit/run_context_spec.rb +2 -2
  128. data/spec/unit/shell/shell_session_spec.rb +1 -1
  129. data/tasks/dependencies.rb +0 -2
  130. metadata +55 -786
  131. data/acceptance/.bundle/config +0 -2
  132. data/acceptance/basics/.kitchen/logs/chef-current-install-ubuntu-1404.log +0 -2
  133. data/acceptance/basics/.kitchen/logs/kitchen.log +0 -3
  134. data/acceptance/fips/.kitchen/logs/fips-integration-centos-6.log +0 -3
  135. data/acceptance/fips/.kitchen/logs/fips-integration-windows-2012r2.log +0 -3
  136. data/acceptance/fips/.kitchen/logs/fips-unit-functional-centos-6.log +0 -3
  137. data/acceptance/fips/.kitchen/logs/fips-unit-functional-windows-2012r2.log +0 -3
  138. data/acceptance/fips/.kitchen/logs/kitchen.log +0 -6
  139. data/acceptance/trivial/.kitchen/logs/chef-current-install-windows-2012r2.log +0 -2
  140. data/acceptance/trivial/.kitchen/logs/kitchen.log +0 -3
  141. data/acceptance/windows-service/.kitchen/logs/chef-windows-service-windows-2012r2.log +0 -2
  142. data/acceptance/windows-service/.kitchen/logs/kitchen.log +0 -3
@@ -0,0 +1,51 @@
1
+ #
2
+ # Copyright:: Copyright 2013-2016, 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
+ require "support/shared/integration/integration_helper"
18
+ require "support/shared/context/config"
19
+
20
+ describe "knife node bulk delete", :workstation do
21
+ include IntegrationSupport
22
+ include KnifeSupport
23
+
24
+ include_context "default config options"
25
+
26
+ when_the_chef_server "has some nodes" do
27
+ before do
28
+ node "cons", {}
29
+ node "car", {}
30
+ node "cdr", {}
31
+ node "cat", {}
32
+ end
33
+
34
+ it "deletes all matching nodes" do
35
+ knife("node bulk delete ^ca.*", input: "Y").should_succeed <<EOM
36
+ The following nodes will be deleted:
37
+
38
+ car cat
39
+
40
+ Are you sure you want to delete these nodes? (Y/N) Deleted node car
41
+ Deleted node cat
42
+ EOM
43
+
44
+ knife("node list").should_succeed <<EOM
45
+ cdr
46
+ cons
47
+ EOM
48
+ end
49
+ end
50
+
51
+ end
@@ -0,0 +1,46 @@
1
+ #
2
+ # Copyright:: Copyright 2013-2016, 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
+ require "support/shared/integration/integration_helper"
18
+ require "support/shared/context/config"
19
+ require "openssl"
20
+
21
+ describe "knife node create", :workstation do
22
+ include IntegrationSupport
23
+ include KnifeSupport
24
+
25
+ include_context "default config options"
26
+
27
+ let(:out) { "Created node[bah]\n" }
28
+
29
+ when_the_chef_server "is empty" do
30
+ it "creates a new node" do
31
+ knife("node create bah").should_succeed out
32
+ end
33
+
34
+ it "creates a new validator node" do
35
+ knife("node create bah").should_succeed out
36
+ knife("node show bah").should_succeed /Node Name: bah/
37
+ end
38
+
39
+ it "refuses to add an existing node" do
40
+ pending "Knife node create must not blindly overwrite an existing node"
41
+ knife("node create bah").should_succeed out
42
+ expect { knife("node create bah") }.to raise_error(Net::HTTPServerException)
43
+ end
44
+
45
+ end
46
+ end
@@ -0,0 +1,47 @@
1
+ #
2
+ # Copyright:: Copyright 2013-2016, 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
+ require "support/shared/integration/integration_helper"
18
+ require "support/shared/context/config"
19
+
20
+ describe "knife node delete", :workstation do
21
+ include IntegrationSupport
22
+ include KnifeSupport
23
+
24
+ include_context "default config options"
25
+
26
+ when_the_chef_server "has some nodes" do
27
+ before do
28
+ node "cons", {}
29
+ node "car", {}
30
+ node "cdr", {}
31
+ node "cat", {}
32
+ end
33
+
34
+ it "deletes a node" do
35
+ knife("node delete car", input: "Y").should_succeed <<EOM
36
+ Do you really want to delete car? (Y/N) Deleted node[car]
37
+ EOM
38
+
39
+ knife("node list").should_succeed <<EOM
40
+ cat
41
+ cdr
42
+ cons
43
+ EOM
44
+ end
45
+
46
+ end
47
+ end
@@ -0,0 +1,42 @@
1
+ #
2
+ # Copyright:: Copyright 2013-2016, 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
+ require "support/shared/integration/integration_helper"
18
+ require "support/shared/context/config"
19
+
20
+ describe "knife node environment set", :workstation do
21
+ include IntegrationSupport
22
+ include KnifeSupport
23
+
24
+ include_context "default config options"
25
+
26
+ when_the_chef_server "has a node and an environment" do
27
+ before do
28
+ node "cons", {}
29
+ environment "lisp", {}
30
+ end
31
+
32
+ it "sets an environment on a node" do
33
+ knife("node environment set cons lisp").should_succeed /chef_environment:.*lisp/
34
+ knife("node show cons -a chef_environment").should_succeed /Environment:.*lisp/
35
+ end
36
+
37
+ it "with no environment" do
38
+ knife("node environment set adam").should_fail stderr: "FATAL: You must specify a node name and an environment.\n",
39
+ stdout: /^USAGE: knife node environment set NODE ENVIRONMENT\n/
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,58 @@
1
+ #
2
+ # Copyright:: Copyright 2013-2016, 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
+ require "support/shared/integration/integration_helper"
18
+ require "support/shared/context/config"
19
+
20
+ describe "knife node from file", :workstation do
21
+ include IntegrationSupport
22
+ include KnifeSupport
23
+
24
+ # include_context "default config options"
25
+
26
+ let (:node_dir) { "#{@repository_dir}/nodes" }
27
+
28
+ when_the_chef_server "is empty" do
29
+ when_the_repository "has some nodes" do
30
+ before do
31
+
32
+ file "nodes/cons.json", <<EOM
33
+ {
34
+ "name": "cons",
35
+ "chef_environment": "_default",
36
+ "run_list": [
37
+ "recipe[cons]"
38
+ ]
39
+ ,
40
+ "normal": {
41
+ "tags": [
42
+
43
+ ]
44
+ }
45
+ }
46
+ EOM
47
+
48
+ end
49
+
50
+ it "uploads a single file" do
51
+ knife("node from file #{node_dir}/cons.json").should_succeed stderr: <<EOM
52
+ Updated Node cons
53
+ EOM
54
+ end
55
+
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,44 @@
1
+ #
2
+ # Copyright:: Copyright 2013-2016, 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
+ require "support/shared/integration/integration_helper"
18
+ require "support/shared/context/config"
19
+
20
+ describe "knife node list", :workstation do
21
+ include IntegrationSupport
22
+ include KnifeSupport
23
+
24
+ include_context "default config options"
25
+
26
+ when_the_chef_server "has some nodes" do
27
+ before do
28
+ node "cons", {}
29
+ node "car", {}
30
+ node "cdr", {}
31
+ node "cat", {}
32
+ end
33
+
34
+ it "lists all cookbooks" do
35
+ knife("node list").should_succeed <<EOM
36
+ car
37
+ cat
38
+ cdr
39
+ cons
40
+ EOM
41
+ end
42
+
43
+ end
44
+ end
@@ -0,0 +1,53 @@
1
+ #
2
+ # Copyright:: Copyright 2013-2016, 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
+ require "support/shared/integration/integration_helper"
18
+ require "support/shared/context/config"
19
+
20
+ describe "knife node run list add", :workstation do
21
+ include IntegrationSupport
22
+ include KnifeSupport
23
+
24
+ include_context "default config options"
25
+
26
+ when_the_chef_server "has a node with no run_list" do
27
+ before do
28
+ node "cons", {}
29
+ end
30
+
31
+ it "sets the run list" do
32
+ knife("node run list add cons recipe[foo]").should_succeed /run_list:\s*recipe\[foo\]\n/
33
+ end
34
+ end
35
+
36
+ when_the_chef_server "has a node with a run_list" do
37
+ before do
38
+ node "cons", { run_list: ["recipe[bar]"] }
39
+ end
40
+
41
+ it "appends to the run list" do
42
+ knife("node run list add cons recipe[foo]").should_succeed /run_list:\n\s*recipe\[bar\]\n\s*recipe\[foo\]\n/m
43
+ end
44
+
45
+ it "adds to the run list before the specified item" do
46
+ knife("node run list add cons -b recipe[bar] recipe[foo]").should_succeed /run_list:\n\s*recipe\[foo\]\n\s*recipe\[bar\]\n/m
47
+ end
48
+
49
+ it "adds to the run list after the specified item" do
50
+ knife("node run list add cons -a recipe[bar] recipe[foo]").should_succeed /run_list:\n\s*recipe\[bar\]\n\s*recipe\[foo\]\n/m
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,35 @@
1
+ #
2
+ # Copyright:: Copyright 2013-2016, 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
+ require "support/shared/integration/integration_helper"
18
+ require "support/shared/context/config"
19
+
20
+ describe "knife node run list remove", :workstation do
21
+ include IntegrationSupport
22
+ include KnifeSupport
23
+
24
+ include_context "default config options"
25
+
26
+ when_the_chef_server "has a node with a run_list" do
27
+ before do
28
+ node "cons", { run_list: ["recipe[bar]", "recipe[foo]"] }
29
+ end
30
+
31
+ it "removes the item from the run list" do
32
+ knife("node run list remove cons recipe[bar]").should_succeed /run_list:\s*recipe\[foo\]\n/m
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,40 @@
1
+ #
2
+ # Copyright:: Copyright 2013-2016, 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
+ require "support/shared/integration/integration_helper"
18
+ require "support/shared/context/config"
19
+
20
+ describe "knife node run list set", :workstation do
21
+ include IntegrationSupport
22
+ include KnifeSupport
23
+
24
+ include_context "default config options"
25
+
26
+ when_the_chef_server "has a node with a run_list" do
27
+ before do
28
+ node "cons", { run_list: ["recipe[bar]", "recipe[foo]"] }
29
+ end
30
+
31
+ it "sets the run list" do
32
+ knife("node run list set cons recipe[bar]").should_succeed /run_list:\s*recipe\[bar\]\n/m
33
+ end
34
+
35
+ it "with no role or recipe" do
36
+ knife("node run list set cons").should_fail stderr: "FATAL: You must supply both a node name and a run list.\n",
37
+ stdout: /^USAGE: knife node run_list set NODE ENTRIES \(options\)/m
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,35 @@
1
+ #
2
+ # Copyright:: Copyright 2013-2016, 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
+ require "support/shared/integration/integration_helper"
18
+ require "support/shared/context/config"
19
+
20
+ describe "knife node show", :workstation do
21
+ include IntegrationSupport
22
+ include KnifeSupport
23
+
24
+ include_context "default config options"
25
+
26
+ when_the_chef_server "has a node with a run_list" do
27
+ before do
28
+ node "cons", { run_list: ["recipe[bar]", "recipe[foo]"] }
29
+ end
30
+
31
+ it "shows the node" do
32
+ knife("node show cons").should_succeed /Run List:\s*recipe\[bar\], recipe\[foo\]\n/m
33
+ end
34
+ end
35
+ end