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,43 @@
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 "chef/knife/data_bag_list"
20
+
21
+ describe "knife data bag list", :workstation do
22
+ include IntegrationSupport
23
+ include KnifeSupport
24
+
25
+ include_context "default config options"
26
+
27
+ when_the_chef_server "has some data bags" do
28
+ before do
29
+ data_bag "x", {}
30
+ data_bag "canteloupe", {}
31
+ data_bag "rocket", {}
32
+ end
33
+
34
+ it "knife data bag list shows all the cookbooks" do
35
+ knife("data bag list").should_succeed <<EOM
36
+ canteloupe
37
+ rocket
38
+ x
39
+ EOM
40
+ end
41
+
42
+ end
43
+ 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
+ require "chef/knife/data_bag_show"
20
+
21
+ describe "knife data bag show", :workstation do
22
+ include IntegrationSupport
23
+ include KnifeSupport
24
+
25
+ include_context "default config options"
26
+
27
+ when_the_chef_server "has some data bags" do
28
+ before do
29
+ data_bag "x", {}
30
+ data_bag "canteloupe", {}
31
+ data_bag "rocket", { "falcon9" => { heavy: "true" }, "atlas" => {}, "ariane" => {} }
32
+ end
33
+
34
+ it "with an empty data bag" do
35
+ knife("data bag show canteloupe").should_succeed "\n"
36
+ end
37
+
38
+ it "with a bag with some items" do
39
+ knife("data bag show rocket").should_succeed <<EOM
40
+ ariane
41
+ atlas
42
+ falcon9
43
+ EOM
44
+ end
45
+
46
+ it "with a single item" do
47
+ knife("data bag show rocket falcon9").should_succeed <<EOM, stderr: "WARNING: Unencrypted data bag detected, ignoring any provided secret options.\n"
48
+ heavy: true
49
+ id: falcon9
50
+ EOM
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,74 @@
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 environment compare", :workstation do
21
+ include IntegrationSupport
22
+ include KnifeSupport
23
+
24
+ include_context "default config options"
25
+
26
+ when_the_chef_server "has some environments" do
27
+ before do
28
+ cookbook "blah", "1.0.1"
29
+ cookbook "blah", "1.1.1"
30
+ cookbook "krad", "1.1.1"
31
+ environment "x", {
32
+ "cookbook_versions" => {
33
+ "blah" => "= 1.0.0",
34
+ "krad" => ">= 1.0.0",
35
+ },
36
+ }
37
+ environment "y", {
38
+ "cookbook_versions" => {
39
+ "blah" => "= 1.1.0",
40
+ "krad" => ">= 1.0.0",
41
+ },
42
+ }
43
+ end
44
+
45
+ # rubocop:disable Style/TrailingWhitespace
46
+ it "displays the cookbooks for a single environment" do
47
+ knife("environment compare x").should_succeed <<EOM
48
+ x
49
+ blah = 1.0.0
50
+ krad >= 1.0.0
51
+
52
+ EOM
53
+ end
54
+
55
+ it "compares the cookbooks for two environments" do
56
+ knife("environment compare x y").should_succeed <<EOM
57
+ x y
58
+ blah = 1.0.0 = 1.1.0
59
+ krad >= 1.0.0 >= 1.0.0
60
+
61
+ EOM
62
+ end
63
+
64
+ it "compares the cookbooks for all environments" do
65
+ knife("environment compare --all").should_succeed <<EOM
66
+ x y
67
+ blah = 1.0.0 = 1.1.0
68
+ krad >= 1.0.0 >= 1.0.0
69
+
70
+ EOM
71
+ end
72
+ # rubocop:enable Style/TrailingWhitespace
73
+ end
74
+ 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 environment create", :workstation do
21
+ include IntegrationSupport
22
+ include KnifeSupport
23
+
24
+ include_context "default config options"
25
+
26
+ let(:out) { "Created bah\n" }
27
+
28
+ when_the_chef_server "is empty" do
29
+ it "creates a new environment" do
30
+ knife("environment create bah").should_succeed out
31
+ end
32
+
33
+ it "refuses to add an existing environment" do
34
+ pending "Knife environment create must not blindly overwrite an existing environment"
35
+ knife("environment create bah").should_succeed out
36
+ expect { knife("environment create bah") }.to raise_error(Net::HTTPServerException)
37
+ end
38
+
39
+ end
40
+ end
@@ -0,0 +1,36 @@
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 environment delete", :workstation do
21
+ include IntegrationSupport
22
+ include KnifeSupport
23
+
24
+ include_context "default config options"
25
+
26
+ when_the_chef_server "has an environment" do
27
+ before do
28
+ environment "y", {}
29
+ end
30
+
31
+ it "deletes an environment" do
32
+ knife("environment delete y", input: "y").should_succeed "Do you really want to delete y? (Y/N) Deleted y\n"
33
+ end
34
+
35
+ end
36
+ end
@@ -0,0 +1,115 @@
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 environment from file", :workstation do
21
+ include IntegrationSupport
22
+ include KnifeSupport
23
+
24
+ # include_context "default config options"
25
+
26
+ let (:env_dir) { "#{@repository_dir}/environments" }
27
+
28
+ when_the_chef_server "is empty" do
29
+ when_the_repository "has some environments" do
30
+ before do
31
+
32
+ file "environments/cons.json", <<EOM
33
+ {
34
+ "name": "cons",
35
+ "description": "An environment",
36
+ "cookbook_versions": {
37
+
38
+ },
39
+ "json_class": "Chef::Environment",
40
+ "chef_type": "environment",
41
+ "default_attributes": {
42
+ "hola": "Amigos!"
43
+ },
44
+ "override_attributes": {
45
+
46
+ }
47
+ }
48
+ EOM
49
+
50
+ file "environments/car.json", <<EOM
51
+ {
52
+ "name": "car",
53
+ "description": "An environment for list nodes",
54
+ "cookbook_versions": {
55
+
56
+ },
57
+ "json_class": "Chef::Environment",
58
+ "chef_type": "environment",
59
+ "default_attributes": {
60
+ "hola": "Amigos!"
61
+ },
62
+ "override_attributes": {
63
+
64
+ }
65
+ }
66
+ EOM
67
+
68
+ file "environments/cdr.json", <<EOM
69
+ {
70
+ "name": "cdr",
71
+ "description": "An environment for last nodes",
72
+ "cookbook_versions": {
73
+
74
+ },
75
+ "json_class": "Chef::Environment",
76
+ "chef_type": "environment",
77
+ "default_attributes": {
78
+ "hola": "Amigos!"
79
+ },
80
+ "override_attributes": {
81
+
82
+ }
83
+ }
84
+ EOM
85
+
86
+ end
87
+
88
+ it "uploads a single file" do
89
+ knife("environment from file #{env_dir}/cons.json").should_succeed stderr: <<EOM
90
+ Updated Environment cons
91
+ EOM
92
+ end
93
+
94
+ it "uploads many files" do
95
+ knife("environment from file #{env_dir}/cons.json #{env_dir}/car.json #{env_dir}/cdr.json").should_succeed stderr: <<EOM
96
+ Updated Environment cons
97
+ Updated Environment car
98
+ Updated Environment cdr
99
+ EOM
100
+ end
101
+
102
+ it "uploads all environments in the repository" do
103
+ cwd(".")
104
+ knife("environment from file --all")
105
+ knife("environment list").should_succeed <<EOM
106
+ _default
107
+ car
108
+ cdr
109
+ cons
110
+ EOM
111
+ end
112
+
113
+ end
114
+ end
115
+ end
@@ -0,0 +1,41 @@
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 environment list", :workstation do
21
+ include IntegrationSupport
22
+ include KnifeSupport
23
+
24
+ include_context "default config options"
25
+
26
+ when_the_chef_server "has some environments" do
27
+ before do
28
+ environment "b", {}
29
+ environment "y", {}
30
+ end
31
+
32
+ it "lists all the environments" do
33
+ knife("environment list").should_succeed <<EOM
34
+ _default
35
+ b
36
+ y
37
+ EOM
38
+ end
39
+
40
+ end
41
+ end
@@ -0,0 +1,56 @@
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 environment show", :workstation do
21
+ include IntegrationSupport
22
+ include KnifeSupport
23
+
24
+ include_context "default config options"
25
+
26
+ when_the_chef_server "has some environments" do
27
+ before do
28
+ environment "b", {
29
+ "default_attributes" => { "foo" => "bar" },
30
+ }
31
+ end
32
+
33
+ # rubocop:disable Style/TrailingWhitespace
34
+ it "shows an environment" do
35
+ knife("environment show b").should_succeed <<EOM
36
+ chef_type: environment
37
+ cookbook_versions:
38
+ default_attributes:
39
+ foo: bar
40
+ description:
41
+ json_class: Chef::Environment
42
+ name: b
43
+ override_attributes:
44
+ EOM
45
+ end
46
+ # rubocop:enable Style/TrailingWhitespace
47
+
48
+ it "shows the requested attribute of an environment" do
49
+ pending "KnifeSupport doesn't appear to pass this through correctly"
50
+ knife("environment show b -a foo").should_succeed <<EOM
51
+ b:
52
+ foo: bar
53
+ EOM
54
+ end
55
+ end
56
+ end