chef 12.5.0.alpha.1 → 12.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +21 -25
- data/Gemfile +46 -0
- data/README.md +4 -4
- data/Rakefile +5 -110
- data/distro/common/html/knife_cookbook_site.html +18 -18
- data/distro/common/man/man1/knife-cookbook-site.1 +11 -11
- data/lib/chef/application.rb +1 -1
- data/lib/chef/application/apply.rb +19 -1
- data/lib/chef/application/client.rb +11 -5
- data/lib/chef/application/knife.rb +2 -2
- data/lib/chef/application/windows_service_manager.rb +9 -7
- data/lib/chef/chef_class.rb +39 -0
- data/lib/chef/chef_fs/data_handler/client_data_handler.rb +3 -1
- data/lib/chef/chef_fs/file_system/acl_dir.rb +3 -4
- data/lib/chef/chef_fs/file_system/acls_dir.rb +5 -1
- data/lib/chef/chef_fs/file_system/base_fs_dir.rb +0 -5
- data/lib/chef/chef_fs/file_system/base_fs_object.rb +5 -2
- data/lib/chef/chef_fs/file_system/chef_repository_file_system_cookbook_dir.rb +2 -9
- data/lib/chef/chef_fs/file_system/chef_repository_file_system_cookbook_entry.rb +2 -9
- data/lib/chef/chef_fs/file_system/chef_repository_file_system_cookbooks_dir.rb +10 -17
- data/lib/chef/chef_fs/file_system/chef_repository_file_system_entry.rb +1 -12
- data/lib/chef/chef_fs/file_system/chef_repository_file_system_root_dir.rb +15 -11
- data/lib/chef/chef_fs/file_system/chef_server_root_dir.rb +8 -2
- data/lib/chef/chef_fs/file_system/cookbook_dir.rb +3 -4
- data/lib/chef/chef_fs/file_system/cookbooks_acl_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/cookbooks_dir.rb +3 -11
- data/lib/chef/chef_fs/file_system/data_bags_dir.rb +3 -5
- data/lib/chef/chef_fs/file_system/environments_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/file_system_entry.rb +7 -4
- data/lib/chef/chef_fs/file_system/memory_dir.rb +2 -3
- data/lib/chef/chef_fs/file_system/multiplexed_dir.rb +15 -0
- data/lib/chef/chef_fs/file_system/nodes_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/organization_members_entry.rb +2 -2
- data/lib/chef/chef_fs/file_system/rest_list_dir.rb +4 -9
- data/lib/chef/client.rb +2 -3
- data/lib/chef/config.rb +34 -2
- data/lib/chef/cookbook/metadata.rb +25 -3
- data/lib/chef/cookbook/synchronizer.rb +1 -1
- data/lib/chef/cookbook_site_streaming_uploader.rb +1 -1
- data/lib/chef/cookbook_version.rb +3 -3
- data/lib/chef/deprecation/mixin/template.rb +1 -2
- data/lib/chef/deprecation/provider/cookbook_file.rb +1 -1
- data/lib/chef/deprecation/provider/file.rb +1 -1
- data/lib/chef/deprecation/provider/remote_directory.rb +52 -0
- data/lib/chef/deprecation/provider/remote_file.rb +1 -2
- data/lib/chef/deprecation/provider/template.rb +1 -1
- data/lib/chef/deprecation/warnings.rb +3 -4
- data/lib/chef/dsl/reboot_pending.rb +3 -2
- data/lib/chef/dsl/recipe.rb +6 -5
- data/lib/chef/dsl/resources.rb +2 -2
- data/lib/chef/event_dispatch/base.rb +12 -7
- data/lib/chef/event_dispatch/dispatcher.rb +21 -6
- data/lib/chef/exceptions.rb +22 -0
- data/lib/chef/file_content_management/tempfile.rb +1 -1
- data/lib/chef/formatters/base.rb +3 -0
- data/lib/chef/formatters/doc.rb +53 -5
- data/lib/chef/formatters/error_inspectors/compile_error_inspector.rb +36 -0
- data/lib/chef/formatters/minimal.rb +2 -2
- data/lib/chef/knife.rb +35 -55
- data/lib/chef/knife/bootstrap.rb +41 -0
- data/lib/chef/knife/bootstrap/chef_vault_handler.rb +1 -0
- data/lib/chef/knife/bootstrap/client_builder.rb +16 -0
- data/lib/chef/knife/bootstrap/templates/README.md +3 -4
- data/lib/chef/knife/cookbook_create.rb +1 -1
- data/lib/chef/knife/cookbook_site_download.rb +1 -1
- data/lib/chef/knife/cookbook_site_install.rb +1 -1
- data/lib/chef/knife/cookbook_site_share.rb +6 -6
- data/lib/chef/knife/cookbook_site_unshare.rb +2 -2
- data/lib/chef/knife/core/bootstrap_context.rb +12 -4
- data/lib/chef/knife/core/custom_manifest_loader.rb +69 -0
- data/lib/chef/knife/core/gem_glob_loader.rb +138 -0
- data/lib/chef/knife/core/hashed_command_loader.rb +80 -0
- data/lib/chef/knife/core/node_presenter.rb +24 -1
- data/lib/chef/knife/core/object_loader.rb +1 -0
- data/lib/chef/knife/core/subcommand_loader.rb +131 -146
- data/lib/chef/knife/node_run_list_remove.rb +12 -1
- data/lib/chef/knife/null.rb +10 -0
- data/lib/chef/knife/rehash.rb +62 -0
- data/lib/chef/knife/search.rb +3 -3
- data/lib/chef/knife/ssh.rb +52 -30
- data/lib/chef/local_mode.rb +5 -0
- data/lib/chef/log.rb +5 -1
- data/lib/chef/mixin/deprecation.rb +8 -8
- data/lib/chef/mixin/params_validate.rb +2 -2
- data/lib/chef/mixin/template.rb +48 -0
- data/lib/chef/mixin/which.rb +1 -1
- data/lib/chef/mixin/wide_string.rb +72 -0
- data/lib/chef/mixin/windows_architecture_helper.rb +15 -39
- data/lib/chef/mixin/windows_env_helper.rb +4 -1
- data/lib/chef/monkey_patches/webrick-utils.rb +51 -0
- data/lib/chef/monkey_patches/win32/registry.rb +72 -0
- data/lib/chef/node.rb +97 -3
- data/lib/chef/node_map.rb +2 -2
- data/lib/chef/platform/provider_mapping.rb +5 -6
- data/lib/chef/platform/query_helpers.rb +46 -4
- data/lib/chef/platform/service_helpers.rb +30 -32
- data/lib/chef/policy_builder.rb +1 -8
- data/lib/chef/policy_builder/dynamic.rb +186 -0
- data/lib/chef/policy_builder/expand_node_object.rb +30 -15
- data/lib/chef/policy_builder/policyfile.rb +155 -18
- data/lib/chef/property.rb +38 -9
- data/lib/chef/provider.rb +104 -12
- data/lib/chef/provider/batch.rb +8 -0
- data/lib/chef/provider/deploy.rb +2 -2
- data/lib/chef/provider/directory.rb +14 -2
- data/lib/chef/provider/dsc_resource.rb +5 -9
- data/lib/chef/provider/group/pw.rb +1 -1
- data/lib/chef/provider/ifconfig.rb +2 -2
- data/lib/chef/provider/mount.rb +7 -3
- data/lib/chef/provider/package/dpkg.rb +5 -11
- data/lib/chef/provider/package/rpm.rb +2 -2
- data/lib/chef/provider/package/rubygems.rb +1 -1
- data/lib/chef/provider/package/windows/msi.rb +2 -2
- data/lib/chef/provider/package/yum.rb +17 -5
- data/lib/chef/provider/powershell_script.rb +27 -4
- data/lib/chef/provider/remote_directory.rb +190 -102
- data/lib/chef/provider/service.rb +12 -2
- data/lib/chef/provider/service/aix.rb +1 -1
- data/lib/chef/provider/service/debian.rb +3 -5
- data/lib/chef/provider/service/freebsd.rb +1 -1
- data/lib/chef/provider/service/gentoo.rb +3 -3
- data/lib/chef/provider/service/init.rb +3 -3
- data/lib/chef/provider/service/insserv.rb +2 -4
- data/lib/chef/provider/service/invokercd.rb +2 -4
- data/lib/chef/provider/service/openbsd.rb +2 -1
- data/lib/chef/provider/service/redhat.rb +52 -16
- data/lib/chef/provider/service/simple.rb +2 -2
- data/lib/chef/provider/service/systemd.rb +3 -5
- data/lib/chef/provider/service/upstart.rb +4 -6
- data/lib/chef/provider/subversion.rb +13 -7
- data/lib/chef/provider/template/content.rb +16 -6
- data/lib/chef/provider/user/solaris.rb +32 -4
- data/lib/chef/provider/windows_script.rb +3 -5
- data/lib/chef/provider_resolver.rb +2 -2
- data/lib/chef/resource.rb +85 -27
- data/lib/chef/resource/action_class.rb +83 -0
- data/lib/chef/resource/chef_gem.rb +3 -3
- data/lib/chef/resource/deploy.rb +8 -2
- data/lib/chef/resource/dsc_script.rb +2 -0
- data/lib/chef/resource/file/verification.rb +1 -1
- data/lib/chef/resource/registry_key.rb +1 -1
- data/lib/chef/resource/service.rb +10 -2
- data/lib/chef/resource/subversion.rb +5 -0
- data/lib/chef/resource/windows_script.rb +6 -2
- data/lib/chef/resource/yum_package.rb +10 -1
- data/lib/chef/resource_resolver.rb +3 -3
- data/lib/chef/run_context.rb +6 -8
- data/lib/chef/run_list/versioned_recipe_list.rb +15 -0
- data/lib/chef/run_lock.rb +30 -21
- data/lib/chef/util/powershell/ps_credential.rb +4 -0
- data/lib/chef/util/windows.rb +0 -32
- data/lib/chef/util/windows/net_group.rb +85 -106
- data/lib/chef/util/windows/net_use.rb +35 -71
- data/lib/chef/util/windows/net_user.rb +0 -1
- data/lib/chef/util/windows/volume.rb +19 -19
- data/lib/chef/version.rb +3 -3
- data/lib/chef/win32/api.rb +1 -0
- data/lib/chef/win32/api/file.rb +20 -0
- data/lib/chef/win32/api/net.rb +163 -43
- data/lib/chef/win32/api/registry.rb +51 -0
- data/lib/chef/win32/api/system.rb +23 -0
- data/lib/chef/win32/api/unicode.rb +0 -43
- data/lib/chef/win32/crypto.rb +2 -1
- data/lib/chef/win32/file.rb +28 -3
- data/lib/chef/win32/mutex.rb +1 -2
- data/lib/chef/win32/net.rb +162 -8
- data/lib/chef/win32/process.rb +13 -0
- data/lib/chef/win32/registry.rb +25 -28
- data/lib/chef/win32/security.rb +1 -1
- data/lib/chef/win32/security/token.rb +1 -1
- data/lib/chef/win32/system.rb +62 -0
- data/lib/chef/win32/unicode.rb +7 -2
- data/lib/chef/win32/version.rb +0 -4
- data/spec/data/cookbooks/openldap/templates/default/helpers.erb +14 -0
- data/spec/data/cookbooks/openldap/templates/default/nested_openldap_partials.erb +1 -0
- data/spec/data/cookbooks/openldap/templates/default/nested_partial.erb +1 -0
- data/spec/data/dsc_lcm.pfx +0 -0
- data/spec/functional/dsl/reboot_pending_spec.rb +33 -43
- data/spec/functional/knife/cookbook_delete_spec.rb +17 -7
- data/spec/functional/knife/ssh_spec.rb +16 -0
- data/spec/functional/resource/deploy_revision_spec.rb +1 -1
- data/spec/functional/resource/dsc_resource_spec.rb +2 -0
- data/spec/functional/resource/dsc_script_spec.rb +91 -2
- data/spec/functional/resource/group_spec.rb +67 -44
- data/spec/functional/resource/powershell_script_spec.rb +104 -15
- data/spec/functional/resource/windows_service_spec.rb +1 -1
- data/spec/functional/run_lock_spec.rb +368 -189
- data/spec/functional/win32/{registry_helper_spec.rb → registry_spec.rb} +4 -23
- data/spec/integration/client/client_spec.rb +51 -0
- data/spec/integration/knife/download_spec.rb +4 -0
- data/spec/integration/knife/list_spec.rb +8 -0
- data/spec/integration/knife/upload_spec.rb +1 -1
- data/spec/integration/recipes/recipe_dsl_spec.rb +1 -1
- data/spec/integration/recipes/remote_directory.rb +74 -0
- data/spec/integration/recipes/resource_action_spec.rb +42 -22
- data/spec/integration/recipes/resource_converge_if_changed_spec.rb +423 -0
- data/spec/integration/recipes/resource_load_spec.rb +206 -0
- data/spec/spec_helper.rb +8 -0
- data/spec/support/platform_helpers.rb +13 -0
- data/{lib/chef/mixin/wstring.rb → spec/support/shared/context/win32.rb} +15 -12
- data/spec/support/shared/functional/windows_script.rb +63 -26
- data/spec/support/shared/unit/mock_shellout.rb +46 -0
- data/spec/support/shared/unit/provider/file.rb +10 -4
- data/spec/unit/application/client_spec.rb +16 -3
- data/spec/unit/application/knife_spec.rb +2 -2
- data/spec/unit/chef_class_spec.rb +0 -4
- data/spec/unit/client_spec.rb +6 -1
- data/spec/unit/config_spec.rb +31 -0
- data/spec/unit/cookbook/metadata_spec.rb +23 -3
- data/spec/unit/cookbook/syntax_check_spec.rb +3 -0
- data/spec/unit/deprecation_spec.rb +3 -6
- data/spec/unit/dsl/reboot_pending_spec.rb +12 -6
- data/spec/unit/event_dispatch/dispatcher_spec.rb +65 -3
- data/spec/unit/event_dispatch/dsl_spec.rb +0 -4
- data/spec/unit/formatters/doc_spec.rb +32 -0
- data/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb +26 -0
- data/spec/unit/knife/bootstrap/client_builder_spec.rb +27 -0
- data/spec/unit/knife/bootstrap_spec.rb +55 -3
- data/spec/unit/knife/cookbook_site_share_spec.rb +3 -3
- data/spec/unit/knife/core/bootstrap_context_spec.rb +21 -4
- data/spec/unit/knife/core/custom_manifest_loader_spec.rb +41 -0
- data/spec/unit/knife/core/gem_glob_loader_spec.rb +210 -0
- data/spec/unit/knife/core/hashed_command_loader_spec.rb +93 -0
- data/spec/unit/knife/core/subcommand_loader_spec.rb +16 -192
- data/spec/unit/knife/node_run_list_remove_spec.rb +17 -0
- data/spec/unit/mixin/enforce_ownership_and_permissions_spec.rb +10 -10
- data/spec/unit/mixin/template_spec.rb +5 -1
- data/spec/unit/mixin/windows_architecture_helper_spec.rb +13 -8
- data/spec/unit/node_spec.rb +213 -0
- data/spec/unit/platform/query_helpers_spec.rb +146 -3
- data/spec/unit/policy_builder/dynamic_spec.rb +275 -0
- data/spec/unit/policy_builder/expand_node_object_spec.rb +37 -38
- data/spec/unit/policy_builder/policyfile_spec.rb +260 -46
- data/spec/unit/property/validation_spec.rb +5 -0
- data/spec/unit/property_spec.rb +152 -26
- data/spec/unit/provider/deploy_spec.rb +5 -5
- data/spec/unit/provider/directory_spec.rb +35 -0
- data/spec/unit/provider/dsc_resource_spec.rb +3 -10
- data/spec/unit/provider/ifconfig_spec.rb +22 -2
- data/spec/unit/provider/mount/aix_spec.rb +2 -1
- data/spec/unit/provider/mount/mount_spec.rb +6 -0
- data/spec/unit/provider/mount/windows_spec.rb +14 -0
- data/spec/unit/provider/mount_spec.rb +12 -1
- data/spec/unit/provider/package/dpkg_spec.rb +8 -1
- data/spec/unit/provider/package/rpm_spec.rb +18 -1
- data/spec/unit/provider/package/rubygems_spec.rb +18 -0
- data/spec/unit/provider/package/yum_spec.rb +97 -24
- data/spec/unit/provider/powershell_script_spec.rb +52 -26
- data/spec/unit/provider/remote_directory_spec.rb +1 -2
- data/spec/unit/provider/service/aix_service_spec.rb +3 -3
- data/spec/unit/provider/service/gentoo_service_spec.rb +4 -4
- data/spec/unit/provider/service/openbsd_service_spec.rb +10 -8
- data/spec/unit/provider/service/redhat_spec.rb +88 -8
- data/spec/unit/provider/service/upstart_service_spec.rb +11 -7
- data/spec/unit/provider/service/windows_spec.rb +211 -200
- data/spec/unit/provider/subversion_spec.rb +50 -31
- data/spec/unit/provider/template/content_spec.rb +93 -2
- data/spec/unit/provider/user/solaris_spec.rb +66 -9
- data/spec/unit/provider_resolver_spec.rb +707 -650
- data/spec/unit/resource/deploy_spec.rb +7 -1
- data/spec/unit/resource/dsc_script_spec.rb +4 -0
- data/spec/unit/resource/file/verification_spec.rb +1 -1
- data/spec/unit/resource/powershell_script_spec.rb +17 -13
- data/spec/unit/resource/service_spec.rb +4 -4
- data/spec/unit/resource/subversion_spec.rb +4 -0
- data/spec/unit/resource/yum_package_spec.rb +10 -1
- data/spec/unit/run_list/versioned_recipe_list_spec.rb +5 -0
- data/spec/unit/win32/registry_spec.rb +394 -0
- data/tasks/external_tests.rb +47 -23
- data/tasks/maintainers.rb +155 -14
- metadata +51 -26
- data/lib/chef/knife/bootstrap/templates/archlinux-gems.erb +0 -76
- data/lib/chef/knife/bootstrap/templates/chef-aix.erb +0 -72
- data/spec/unit/registry_helper_spec.rb +0 -390
@@ -110,6 +110,32 @@ describe Chef::Formatters::ErrorInspectors::CompileErrorInspector do
|
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
|
+
context "when the error is a RuntimeError about frozen object" do
|
114
|
+
let(:exception) do
|
115
|
+
e = RuntimeError.new("can't modify frozen Array")
|
116
|
+
e.set_backtrace(trace)
|
117
|
+
e
|
118
|
+
end
|
119
|
+
|
120
|
+
let(:path_to_failed_file) { "/tmp/kitchen/cache/cookbooks/foo/recipes/default.rb" }
|
121
|
+
|
122
|
+
let(:trace) do
|
123
|
+
[
|
124
|
+
"/tmp/kitchen/cache/cookbooks/foo/recipes/default.rb:2:in `block in from_file'",
|
125
|
+
"/tmp/kitchen/cache/cookbooks/foo/recipes/default.rb:1:in `from_file'"
|
126
|
+
]
|
127
|
+
end
|
128
|
+
|
129
|
+
describe "when explaining a runtime error in the compile phase" do
|
130
|
+
it "correctly detects RuntimeError for frozen objects" do
|
131
|
+
expect(inspector.exception_message_modifying_frozen?).to be(true)
|
132
|
+
end
|
133
|
+
|
134
|
+
# could also test for description.section to be called, but would have
|
135
|
+
# to adjust every other test to begin using a test double for description
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
113
139
|
context "when the error does not contain any lines from cookbooks" do
|
114
140
|
|
115
141
|
let(:trace) do
|
@@ -149,6 +149,22 @@ describe Chef::Knife::Bootstrap::ClientBuilder do
|
|
149
149
|
client_builder.run
|
150
150
|
end
|
151
151
|
|
152
|
+
it "does not add tags by default" do
|
153
|
+
allow(node).to receive(:run_list).with([])
|
154
|
+
expect(node).to_not receive(:tags)
|
155
|
+
client_builder.run
|
156
|
+
end
|
157
|
+
|
158
|
+
it "adds tags to the node when given" do
|
159
|
+
tag_receiver = []
|
160
|
+
|
161
|
+
knife_config[:tags] = %w[foo bar]
|
162
|
+
allow(node).to receive(:run_list).with([])
|
163
|
+
allow(node).to receive(:tags).and_return(tag_receiver)
|
164
|
+
client_builder.run
|
165
|
+
expect(tag_receiver).to eq %w[foo bar]
|
166
|
+
end
|
167
|
+
|
152
168
|
it "builds a node when the run_list is a string" do
|
153
169
|
knife_config[:run_list] = "role[base],role[app]"
|
154
170
|
expect(node).to receive(:run_list).with(["role[base]", "role[app]"])
|
@@ -174,5 +190,16 @@ describe Chef::Knife::Bootstrap::ClientBuilder do
|
|
174
190
|
expect(node).to receive(:run_list).with([])
|
175
191
|
client_builder.run
|
176
192
|
end
|
193
|
+
|
194
|
+
it "builds a node with policy_name and policy_group when given" do
|
195
|
+
knife_config[:policy_name] = "my-app"
|
196
|
+
knife_config[:policy_group] = "staging"
|
197
|
+
|
198
|
+
expect(node).to receive(:run_list).with([])
|
199
|
+
expect(node).to receive(:policy_name=).with("my-app")
|
200
|
+
expect(node).to receive(:policy_group=).with("staging")
|
201
|
+
|
202
|
+
client_builder.run
|
203
|
+
end
|
177
204
|
end
|
178
205
|
end
|
@@ -250,14 +250,14 @@ describe Chef::Knife::Bootstrap do
|
|
250
250
|
it "should create a hint file when told to" do
|
251
251
|
knife.parse_options(["--hint", "openstack"])
|
252
252
|
knife.merge_configs
|
253
|
-
expect(knife.render_template).to match
|
253
|
+
expect(knife.render_template).to match(/\/etc\/chef\/ohai\/hints\/openstack.json/)
|
254
254
|
end
|
255
255
|
|
256
256
|
it "should populate a hint file with JSON when given a file to read" do
|
257
257
|
allow(::File).to receive(:read).and_return('{ "foo" : "bar" }')
|
258
258
|
knife.parse_options(["--hint", "openstack=hints/openstack.json"])
|
259
259
|
knife.merge_configs
|
260
|
-
expect(knife.render_template).to match
|
260
|
+
expect(knife.render_template).to match(/\{\"foo\":\"bar\"\}/)
|
261
261
|
end
|
262
262
|
end
|
263
263
|
|
@@ -395,6 +395,58 @@ describe Chef::Knife::Bootstrap do
|
|
395
395
|
end
|
396
396
|
end
|
397
397
|
|
398
|
+
describe "handling policyfile options" do
|
399
|
+
|
400
|
+
context "when only policy_name is given" do
|
401
|
+
|
402
|
+
let(:bootstrap_cli_options) { %w[ --policy-name my-app-server ] }
|
403
|
+
|
404
|
+
it "returns an error stating that policy_name and policy_group must be given together" do
|
405
|
+
expect { knife.validate_options! }.to raise_error(SystemExit)
|
406
|
+
expect(stderr.string).to include("ERROR: --policy-name and --policy-group must be specified together")
|
407
|
+
end
|
408
|
+
|
409
|
+
end
|
410
|
+
|
411
|
+
context "when only policy_group is given" do
|
412
|
+
|
413
|
+
let(:bootstrap_cli_options) { %w[ --policy-group staging ] }
|
414
|
+
|
415
|
+
it "returns an error stating that policy_name and policy_group must be given together" do
|
416
|
+
expect { knife.validate_options! }.to raise_error(SystemExit)
|
417
|
+
expect(stderr.string).to include("ERROR: --policy-name and --policy-group must be specified together")
|
418
|
+
end
|
419
|
+
|
420
|
+
end
|
421
|
+
|
422
|
+
context "when both policy_name and policy_group are given, but run list is also given" do
|
423
|
+
|
424
|
+
let(:bootstrap_cli_options) { %w[ --policy-name my-app --policy-group staging --run-list cookbook ] }
|
425
|
+
|
426
|
+
it "returns an error stating that policyfile and run_list are exclusive" do
|
427
|
+
expect { knife.validate_options! }.to raise_error(SystemExit)
|
428
|
+
expect(stderr.string).to include("ERROR: Policyfile options and --run-list are exclusive")
|
429
|
+
end
|
430
|
+
|
431
|
+
end
|
432
|
+
|
433
|
+
context "when policy_name and policy_group are given with no conflicting options" do
|
434
|
+
|
435
|
+
let(:bootstrap_cli_options) { %w[ --policy-name my-app --policy-group staging ] }
|
436
|
+
|
437
|
+
it "passes options validation" do
|
438
|
+
expect { knife.validate_options! }.to_not raise_error
|
439
|
+
end
|
440
|
+
|
441
|
+
it "passes them into the bootstrap context" do
|
442
|
+
expect(knife.bootstrap_context.first_boot).to have_key(:policy_name)
|
443
|
+
expect(knife.bootstrap_context.first_boot).to have_key(:policy_group)
|
444
|
+
end
|
445
|
+
|
446
|
+
end
|
447
|
+
|
448
|
+
end
|
449
|
+
|
398
450
|
describe "when configuring the underlying knife ssh command" do
|
399
451
|
context "from the command line" do
|
400
452
|
let(:knife_ssh) do
|
@@ -525,7 +577,7 @@ describe Chef::Knife::Bootstrap do
|
|
525
577
|
it "verifies that a server to bootstrap was given as a command line arg" do
|
526
578
|
knife.name_args = nil
|
527
579
|
expect { knife.run }.to raise_error(SystemExit)
|
528
|
-
expect(stderr.string).to match
|
580
|
+
expect(stderr.string).to match(/ERROR:.+FQDN or ip/)
|
529
581
|
end
|
530
582
|
|
531
583
|
describe "when running the bootstrap" do
|
@@ -78,21 +78,21 @@ describe Chef::Knife::CookbookSiteShare do
|
|
78
78
|
|
79
79
|
it 'should not fail when given only 1 argument and can determine category' do
|
80
80
|
@knife.name_args = ['cookbook_name']
|
81
|
-
expect(@noauth_rest).to receive(:get_rest).with("
|
81
|
+
expect(@noauth_rest).to receive(:get_rest).with("https://supermarket.chef.io/api/v1/cookbooks/cookbook_name").and_return(@category_response)
|
82
82
|
expect(@knife).to receive(:do_upload)
|
83
83
|
@knife.run
|
84
84
|
end
|
85
85
|
|
86
86
|
it 'should print error and exit when given only 1 argument and cannot determine category' do
|
87
87
|
@knife.name_args = ['cookbook_name']
|
88
|
-
expect(@noauth_rest).to receive(:get_rest).with("
|
88
|
+
expect(@noauth_rest).to receive(:get_rest).with("https://supermarket.chef.io/api/v1/cookbooks/cookbook_name").and_return(@bad_category_response)
|
89
89
|
expect(@knife.ui).to receive(:fatal)
|
90
90
|
expect { @knife.run }.to raise_error(SystemExit)
|
91
91
|
end
|
92
92
|
|
93
93
|
it 'should print error and exit when given only 1 argument and Chef::REST throws an exception' do
|
94
94
|
@knife.name_args = ['cookbook_name']
|
95
|
-
expect(@noauth_rest).to receive(:get_rest).with("
|
95
|
+
expect(@noauth_rest).to receive(:get_rest).with("https://supermarket.chef.io/api/v1/cookbooks/cookbook_name") { raise Errno::ECONNREFUSED, "Connection refused" }
|
96
96
|
expect(@knife.ui).to receive(:fatal)
|
97
97
|
expect { @knife.run }.to raise_error(SystemExit)
|
98
98
|
end
|
@@ -38,14 +38,14 @@ describe Chef::Knife::Core::BootstrapContext do
|
|
38
38
|
expect{described_class.new(config, run_list, chef_config)}.not_to raise_error
|
39
39
|
end
|
40
40
|
|
41
|
-
it "runs chef with the first-boot.json
|
42
|
-
expect(bootstrap_context.start_chef).to eq "chef-client -j /etc/chef/first-boot.json
|
41
|
+
it "runs chef with the first-boot.json with no environment specified" do
|
42
|
+
expect(bootstrap_context.start_chef).to eq "chef-client -j /etc/chef/first-boot.json"
|
43
43
|
end
|
44
44
|
|
45
45
|
describe "when in verbosity mode" do
|
46
46
|
let(:config) { {:verbosity => 2} }
|
47
47
|
it "adds '-l debug' when verbosity is >= 2" do
|
48
|
-
expect(bootstrap_context.start_chef).to eq "chef-client -j /etc/chef/first-boot.json -l debug
|
48
|
+
expect(bootstrap_context.start_chef).to eq "chef-client -j /etc/chef/first-boot.json -l debug"
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -70,7 +70,7 @@ EXPECTED
|
|
70
70
|
describe "alternate chef-client path" do
|
71
71
|
let(:chef_config){ {:chef_client_path => '/usr/local/bin/chef-client'} }
|
72
72
|
it "runs chef-client from another path when specified" do
|
73
|
-
expect(bootstrap_context.start_chef).to eq "/usr/local/bin/chef-client -j /etc/chef/first-boot.json
|
73
|
+
expect(bootstrap_context.start_chef).to eq "/usr/local/bin/chef-client -j /etc/chef/first-boot.json"
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
@@ -97,6 +97,13 @@ EXPECTED
|
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
|
+
describe "when tags are given" do
|
101
|
+
let(:config) { {:tags => [ "unicorn" ] } }
|
102
|
+
it "adds the attributes to first_boot" do
|
103
|
+
expect(Chef::JSONCompat.to_json(bootstrap_context.first_boot)).to eq(Chef::JSONCompat.to_json({:run_list => run_list, :tags => ["unicorn"]}))
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
100
107
|
describe "when JSON attributes are given" do
|
101
108
|
let(:config) { {:first_boot_attributes => {:baz => :quux}} }
|
102
109
|
it "adds the attributes to first_boot" do
|
@@ -110,6 +117,16 @@ EXPECTED
|
|
110
117
|
end
|
111
118
|
end
|
112
119
|
|
120
|
+
describe "when policy_name and policy_group are present in config" do
|
121
|
+
|
122
|
+
let(:config) { { policy_name: "my_app_server", policy_group: "staging" } }
|
123
|
+
|
124
|
+
it "includes them in the first_boot data and excludes run_list" do
|
125
|
+
expect(Chef::JSONCompat.to_json(bootstrap_context.first_boot)).to eq(Chef::JSONCompat.to_json(config))
|
126
|
+
end
|
127
|
+
|
128
|
+
end
|
129
|
+
|
113
130
|
describe "when an encrypted_data_bag_secret is provided" do
|
114
131
|
let(:secret) { "supersekret" }
|
115
132
|
it "reads the encrypted_data_bag_secret" do
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright (c) 2015 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::Knife::SubcommandLoader::CustomManifestLoader do
|
21
|
+
let(:ec2_server_create_plugin) { "/usr/lib/ruby/gems/knife-ec2-0.5.12/lib/chef/knife/ec2_server_create.rb" }
|
22
|
+
let(:manifest_content) do
|
23
|
+
{ "plugins" => {
|
24
|
+
"knife-ec2" => {
|
25
|
+
"paths" => [
|
26
|
+
ec2_server_create_plugin
|
27
|
+
]
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}
|
31
|
+
end
|
32
|
+
let(:loader) do
|
33
|
+
Chef::Knife::SubcommandLoader::CustomManifestLoader.new(File.join(CHEF_SPEC_DATA, 'knife-site-subcommands'),
|
34
|
+
manifest_content)
|
35
|
+
end
|
36
|
+
|
37
|
+
it "uses paths from the manifest instead of searching gems" do
|
38
|
+
expect(Gem::Specification).not_to receive(:latest_specs).and_call_original
|
39
|
+
expect(loader.subcommand_files).to include(ec2_server_create_plugin)
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,210 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright (c) 2015 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::Knife::SubcommandLoader::GemGlobLoader do
|
21
|
+
let(:loader) { Chef::Knife::SubcommandLoader::GemGlobLoader.new(File.join(CHEF_SPEC_DATA, 'knife-site-subcommands')) }
|
22
|
+
let(:home) { File.join(CHEF_SPEC_DATA, 'knife-home') }
|
23
|
+
let(:plugin_dir) { File.join(home, '.chef', 'plugins', 'knife') }
|
24
|
+
|
25
|
+
before do
|
26
|
+
allow(ChefConfig).to receive(:windows?) { false }
|
27
|
+
Chef::Util::PathHelper.class_variable_set(:@@home_dir, home)
|
28
|
+
end
|
29
|
+
|
30
|
+
after do
|
31
|
+
Chef::Util::PathHelper.class_variable_set(:@@home_dir, nil)
|
32
|
+
end
|
33
|
+
|
34
|
+
it "builds a list of the core subcommand file require paths" do
|
35
|
+
expect(loader.subcommand_files).not_to be_empty
|
36
|
+
loader.subcommand_files.each do |require_path|
|
37
|
+
expect(require_path).to match(/chef\/knife\/.*|plugins\/knife\/.*/)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
it "finds files installed via rubygems" do
|
42
|
+
expect(loader.find_subcommands_via_rubygems).to include('chef/knife/node_create')
|
43
|
+
loader.find_subcommands_via_rubygems.each {|rel_path, abs_path| expect(abs_path).to match(%r[chef/knife/.+])}
|
44
|
+
end
|
45
|
+
|
46
|
+
it "finds files from latest version of installed gems" do
|
47
|
+
gems = [ double('knife-ec2-0.5.12') ]
|
48
|
+
gem_files = [
|
49
|
+
'/usr/lib/ruby/gems/knife-ec2-0.5.12/lib/chef/knife/ec2_base.rb',
|
50
|
+
'/usr/lib/ruby/gems/knife-ec2-0.5.12/lib/chef/knife/ec2_otherstuff.rb'
|
51
|
+
]
|
52
|
+
expect($LOAD_PATH).to receive(:map).and_return([])
|
53
|
+
if Gem::Specification.respond_to? :latest_specs
|
54
|
+
expect(Gem::Specification).to receive(:latest_specs).with(true).and_return(gems)
|
55
|
+
expect(gems[0]).to receive(:matches_for_glob).with(/chef\/knife\/\*\.rb\{(.*),\.rb,(.*)\}/).and_return(gem_files)
|
56
|
+
else
|
57
|
+
expect(Gem.source_index).to receive(:latest_specs).with(true).and_return(gems)
|
58
|
+
expect(gems[0]).to receive(:require_paths).twice.and_return(['lib'])
|
59
|
+
expect(gems[0]).to receive(:full_gem_path).and_return('/usr/lib/ruby/gems/knife-ec2-0.5.12')
|
60
|
+
expect(Dir).to receive(:[]).with('/usr/lib/ruby/gems/knife-ec2-0.5.12/lib/chef/knife/*.rb').and_return(gem_files)
|
61
|
+
end
|
62
|
+
expect(loader).to receive(:find_subcommands_via_dirglob).and_return({})
|
63
|
+
expect(loader.subcommand_files.select { |file| file =~ /knife-ec2/ }.sort).to eq(gem_files)
|
64
|
+
end
|
65
|
+
|
66
|
+
it "finds files using a dirglob when rubygems is not available" do
|
67
|
+
expect(loader.find_subcommands_via_dirglob).to include('chef/knife/node_create')
|
68
|
+
loader.find_subcommands_via_dirglob.each {|rel_path, abs_path| expect(abs_path).to match(%r[chef/knife/.+])}
|
69
|
+
end
|
70
|
+
|
71
|
+
it "finds user-specific subcommands in the user's ~/.chef directory" do
|
72
|
+
expected_command = File.join(home, '.chef', 'plugins', 'knife', 'example_home_subcommand.rb')
|
73
|
+
expect(loader.site_subcommands).to include(expected_command)
|
74
|
+
end
|
75
|
+
|
76
|
+
it "finds repo specific subcommands by searching for a .chef directory" do
|
77
|
+
expected_command = File.join(CHEF_SPEC_DATA, 'knife-site-subcommands', 'plugins', 'knife', 'example_subcommand.rb')
|
78
|
+
expect(loader.site_subcommands).to include(expected_command)
|
79
|
+
end
|
80
|
+
|
81
|
+
# https://github.com/opscode/chef-dk/issues/227
|
82
|
+
#
|
83
|
+
# `knife` in ChefDK isn't from a gem install, it's directly run from a clone
|
84
|
+
# of the source, but there can be one or more versions of chef also installed
|
85
|
+
# as a gem. If the gem install contains a command that doesn't exist in the
|
86
|
+
# source tree of the "primary" chef install, it can be loaded and cause an
|
87
|
+
# error. We also want to ensure that we only load builtin commands from the
|
88
|
+
# "primary" chef install.
|
89
|
+
context "when a different version of chef is also installed as a gem" do
|
90
|
+
|
91
|
+
let(:all_found_commands) do
|
92
|
+
[
|
93
|
+
"/opt/chefdk/embedded/apps/chef/lib/chef/knife/bootstrap.rb",
|
94
|
+
"/opt/chefdk/embedded/apps/chef/lib/chef/knife/client_bulk_delete.rb",
|
95
|
+
"/opt/chefdk/embedded/apps/chef/lib/chef/knife/client_create.rb",
|
96
|
+
|
97
|
+
# We use the fake version 1.0.0 because that version doesn't exist,
|
98
|
+
# which ensures it won't ever equal "chef-#{Chef::VERSION}"
|
99
|
+
"/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-1.0.0/lib/chef/knife/bootstrap.rb",
|
100
|
+
"/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-1.0.0/lib/chef/knife/client_bulk_delete.rb",
|
101
|
+
"/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-1.0.0/lib/chef/knife/client_create.rb",
|
102
|
+
|
103
|
+
# Test that we don't accept a version number that is different only in
|
104
|
+
# trailing characters, e.g. we are running Chef 12.0.0 but there is a
|
105
|
+
# Chef 12.0.0.rc.0 gem also:
|
106
|
+
"/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-#{Chef::VERSION}.rc.0/lib/chef/knife/thing.rb",
|
107
|
+
|
108
|
+
# Test that we ignore the platform suffix when checking for different
|
109
|
+
# gem versions.
|
110
|
+
"/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-#{Chef::VERSION}-x86-mingw32/lib/chef/knife/valid.rb",
|
111
|
+
"/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-#{Chef::VERSION}-i386-mingw64/lib/chef/knife/valid-too.rb",
|
112
|
+
"/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-#{Chef::VERSION}-mswin32/lib/chef/knife/also-valid.rb",
|
113
|
+
"/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-#{Chef::VERSION}-universal-mingw32/lib/chef/knife/universal-is-valid.rb",
|
114
|
+
# ...but don't ignore the .rc / .dev parts in the case when we have
|
115
|
+
# platform suffixes
|
116
|
+
"/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-#{Chef::VERSION}.rc.0-x86-mingw32/lib/chef/knife/invalid.rb",
|
117
|
+
"/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-#{Chef::VERSION}.dev-mswin32/lib/chef/knife/invalid-too.rb",
|
118
|
+
"/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-#{Chef::VERSION}.dev.0-x86-mingw64/lib/chef/knife/still-invalid.rb",
|
119
|
+
|
120
|
+
# This command is "extra" compared to what's in the embedded/apps/chef install:
|
121
|
+
"/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-1.0.0/lib/chef/knife/data_bag_secret_options.rb",
|
122
|
+
"/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-vault-2.2.4/lib/chef/knife/decrypt.rb",
|
123
|
+
"/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/knife-spork-1.4.1/lib/chef/knife/spork-bump.rb",
|
124
|
+
|
125
|
+
# These are fake commands that have names designed to test that the
|
126
|
+
# regex is strict enough
|
127
|
+
"/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-foo-#{Chef::VERSION}/lib/chef/knife/chef-foo.rb",
|
128
|
+
"/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/foo-chef-#{Chef::VERSION}/lib/chef/knife/foo-chef.rb",
|
129
|
+
|
130
|
+
# In a real scenario, we'd use rubygems APIs to only select the most
|
131
|
+
# recent gem, but for this test we want to check that we're doing the
|
132
|
+
# right thing both when the plugin version matches and does not match
|
133
|
+
# the current chef version. Looking at
|
134
|
+
# `SubcommandLoader::MATCHES_THIS_CHEF_GEM` and
|
135
|
+
# `SubcommandLoader::MATCHES_CHEF_GEM` should make it clear why we want
|
136
|
+
# to test these two cases.
|
137
|
+
"/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-bar-1.0.0/lib/chef/knife/chef-bar.rb",
|
138
|
+
"/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/bar-chef-1.0.0/lib/chef/knife/bar-chef.rb"
|
139
|
+
]
|
140
|
+
end
|
141
|
+
|
142
|
+
let(:expected_valid_commands) do
|
143
|
+
[
|
144
|
+
"/opt/chefdk/embedded/apps/chef/lib/chef/knife/bootstrap.rb",
|
145
|
+
"/opt/chefdk/embedded/apps/chef/lib/chef/knife/client_bulk_delete.rb",
|
146
|
+
"/opt/chefdk/embedded/apps/chef/lib/chef/knife/client_create.rb",
|
147
|
+
"/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-#{Chef::VERSION}-x86-mingw32/lib/chef/knife/valid.rb",
|
148
|
+
"/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-#{Chef::VERSION}-i386-mingw64/lib/chef/knife/valid-too.rb",
|
149
|
+
"/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-#{Chef::VERSION}-mswin32/lib/chef/knife/also-valid.rb",
|
150
|
+
"/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-#{Chef::VERSION}-universal-mingw32/lib/chef/knife/universal-is-valid.rb",
|
151
|
+
"/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-vault-2.2.4/lib/chef/knife/decrypt.rb",
|
152
|
+
"/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/knife-spork-1.4.1/lib/chef/knife/spork-bump.rb",
|
153
|
+
"/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-foo-#{Chef::VERSION}/lib/chef/knife/chef-foo.rb",
|
154
|
+
"/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/foo-chef-#{Chef::VERSION}/lib/chef/knife/foo-chef.rb",
|
155
|
+
"/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-bar-1.0.0/lib/chef/knife/chef-bar.rb",
|
156
|
+
"/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/bar-chef-1.0.0/lib/chef/knife/bar-chef.rb"
|
157
|
+
]
|
158
|
+
end
|
159
|
+
|
160
|
+
before do
|
161
|
+
expect(loader).to receive(:find_files_latest_gems).with("chef/knife/*.rb").and_return(all_found_commands)
|
162
|
+
expect(loader).to receive(:find_subcommands_via_dirglob).and_return({})
|
163
|
+
end
|
164
|
+
|
165
|
+
it "ignores commands from the non-matching gem install" do
|
166
|
+
expect(loader.find_subcommands_via_rubygems.values).to eq(expected_valid_commands)
|
167
|
+
end
|
168
|
+
|
169
|
+
end
|
170
|
+
|
171
|
+
describe "finding 3rd party plugins" do
|
172
|
+
let(:env_home) { "/home/alice" }
|
173
|
+
let(:manifest_path) { env_home + "/.chef/plugin_manifest.json" }
|
174
|
+
|
175
|
+
before do
|
176
|
+
env_dup = ENV.to_hash
|
177
|
+
allow(ENV).to receive(:[]) { |key| env_dup[key] }
|
178
|
+
allow(ENV).to receive(:[]).with("HOME").and_return(env_home)
|
179
|
+
end
|
180
|
+
|
181
|
+
|
182
|
+
it "searches rubygems for plugins" do
|
183
|
+
if Gem::Specification.respond_to?(:latest_specs)
|
184
|
+
expect(Gem::Specification).to receive(:latest_specs).and_call_original
|
185
|
+
else
|
186
|
+
expect(Gem.source_index).to receive(:latest_specs).and_call_original
|
187
|
+
end
|
188
|
+
loader.subcommand_files.each do |require_path|
|
189
|
+
expect(require_path).to match(/chef\/knife\/.*|plugins\/knife\/.*/)
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
context "and HOME environment variable is not set" do
|
194
|
+
before do
|
195
|
+
allow(ENV).to receive(:[]).with("HOME").and_return(nil)
|
196
|
+
end
|
197
|
+
|
198
|
+
it "searches rubygems for plugins" do
|
199
|
+
if Gem::Specification.respond_to?(:latest_specs)
|
200
|
+
expect(Gem::Specification).to receive(:latest_specs).and_call_original
|
201
|
+
else
|
202
|
+
expect(Gem.source_index).to receive(:latest_specs).and_call_original
|
203
|
+
end
|
204
|
+
loader.subcommand_files.each do |require_path|
|
205
|
+
expect(require_path).to match(/chef\/knife\/.*|plugins\/knife\/.*/)
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|