chef 11.18.12-x86-mingw32 → 12.0.0.alpha.0-x86-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.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +10 -0
- data/README.md +1 -1
- data/distro/common/html/_sources/index.txt +5 -2
- data/distro/common/html/_sources/knife_serve.txt +19 -0
- data/distro/common/html/_sources/knife_ssl_check.txt +2 -2
- data/distro/common/html/_sources/knife_ssl_fetch.txt +2 -2
- data/distro/common/html/_static/basic.css +1 -1
- data/distro/common/html/_static/doctools.js +1 -1
- data/distro/common/html/_static/searchtools.js +1 -1
- data/distro/common/html/_static/websupport.js +1 -1
- data/distro/common/html/ctl_chef_client.html +19 -9
- data/distro/common/html/ctl_chef_server.html +7 -1
- data/distro/common/html/ctl_chef_shell.html +3 -4
- data/distro/common/html/ctl_chef_solo.html +12 -7
- data/distro/common/html/index.html +19 -12
- data/distro/common/html/knife.html +1 -2
- data/distro/common/html/knife_bootstrap.html +16 -5
- data/distro/common/html/knife_client.html +8 -5
- data/distro/common/html/knife_common_options.html +11 -12
- data/distro/common/html/knife_configure.html +2 -3
- data/distro/common/html/knife_cookbook.html +16 -17
- data/distro/common/html/knife_cookbook_site.html +19 -18
- data/distro/common/html/knife_data_bag.html +6 -7
- data/distro/common/html/knife_delete.html +2 -3
- data/distro/common/html/knife_deps.html +2 -3
- data/distro/common/html/knife_diff.html +3 -4
- data/distro/common/html/knife_download.html +6 -7
- data/distro/common/html/knife_edit.html +0 -1
- data/distro/common/html/knife_environment.html +3 -4
- data/distro/common/html/knife_exec.html +0 -1
- data/distro/common/html/knife_index_rebuild.html +0 -1
- data/distro/common/html/knife_list.html +5 -6
- data/distro/common/html/knife_node.html +13 -6
- data/distro/common/html/knife_raw.html +0 -1
- data/distro/common/html/knife_recipe_list.html +0 -1
- data/distro/common/html/knife_role.html +1 -2
- data/distro/common/html/knife_search.html +2 -3
- data/distro/common/html/knife_serve.html +79 -0
- data/distro/common/html/knife_show.html +1 -2
- data/distro/common/html/knife_ssh.html +2 -3
- data/distro/common/html/knife_ssl_check.html +12 -9
- data/distro/common/html/knife_ssl_fetch.html +9 -10
- data/distro/common/html/knife_status.html +2 -3
- data/distro/common/html/knife_tag.html +0 -1
- data/distro/common/html/knife_upload.html +3 -4
- data/distro/common/html/knife_user.html +2 -3
- data/distro/common/html/knife_using.html +0 -1
- data/distro/common/html/knife_xargs.html +3 -4
- data/distro/common/html/search.html +0 -1
- data/distro/common/html/searchindex.js +1 -1
- data/lib/chef/api_client.rb +1 -1
- data/lib/chef/application.rb +24 -67
- data/lib/chef/application/client.rb +1 -1
- data/lib/chef/application/knife.rb +1 -1
- data/lib/chef/chef_fs/chef_fs_data_store.rb +2 -3
- data/lib/chef/chef_fs/command_line.rb +2 -3
- data/lib/chef/chef_fs/data_handler/group_data_handler.rb +1 -5
- data/lib/chef/chef_fs/file_system/acl_entry.rb +1 -2
- data/lib/chef/chef_fs/file_system/chef_repository_file_system_entry.rb +1 -2
- data/lib/chef/chef_fs/file_system/cookbooks_dir.rb +2 -2
- data/lib/chef/chef_fs/file_system/rest_list_dir.rb +2 -3
- data/lib/chef/chef_fs/file_system/rest_list_entry.rb +4 -5
- data/lib/chef/config.rb +26 -2
- data/lib/chef/config_fetcher.rb +1 -1
- data/lib/chef/cookbook/cookbook_version_loader.rb +4 -4
- data/lib/chef/cookbook/metadata.rb +1 -1
- data/lib/chef/cookbook/synchronizer.rb +50 -8
- data/lib/chef/cookbook_uploader.rb +9 -23
- data/lib/chef/cookbook_version.rb +3 -2
- data/lib/chef/data_bag.rb +1 -1
- data/lib/chef/data_bag_item.rb +1 -1
- data/lib/chef/dsl/recipe.rb +1 -14
- data/lib/chef/encrypted_data_bag_item/decryptor.rb +3 -3
- data/lib/chef/environment.rb +1 -1
- data/lib/chef/exceptions.rb +2 -24
- data/lib/chef/file_content_management/tempfile.rb +8 -1
- data/lib/chef/formatters/base.rb +0 -7
- data/lib/chef/http.rb +12 -19
- data/lib/chef/http/json_input.rb +12 -1
- data/lib/chef/json_compat.rb +45 -64
- data/lib/chef/knife.rb +2 -5
- data/lib/chef/knife/bootstrap.rb +2 -2
- data/lib/chef/knife/bootstrap/archlinux-gems.erb +2 -2
- data/lib/chef/knife/bootstrap/centos5-gems.erb +2 -2
- data/lib/chef/knife/bootstrap/chef-aix.erb +2 -2
- data/lib/chef/knife/bootstrap/chef-full.erb +2 -2
- data/lib/chef/knife/bootstrap/fedora13-gems.erb +2 -2
- data/lib/chef/knife/bootstrap/ubuntu10.04-apt.erb +2 -2
- data/lib/chef/knife/bootstrap/ubuntu10.04-gems.erb +2 -2
- data/lib/chef/knife/bootstrap/ubuntu12.04-gems.erb +2 -2
- data/lib/chef/knife/cookbook_site_download.rb +1 -1
- data/lib/chef/knife/cookbook_site_install.rb +10 -34
- data/lib/chef/knife/cookbook_site_list.rb +1 -1
- data/lib/chef/knife/cookbook_site_search.rb +1 -1
- data/lib/chef/knife/cookbook_site_share.rb +3 -3
- data/lib/chef/knife/cookbook_site_show.rb +3 -3
- data/lib/chef/knife/cookbook_site_unshare.rb +1 -1
- data/lib/chef/knife/cookbook_upload.rb +1 -1
- data/lib/chef/knife/core/subcommand_loader.rb +0 -24
- data/lib/chef/knife/core/ui.rb +8 -7
- data/lib/chef/knife/deps.rb +2 -3
- data/lib/chef/knife/serve.rb +2 -1
- data/lib/chef/local_mode.rb +105 -0
- data/lib/chef/mixin/file_class.rb +1 -4
- data/lib/chef/mixin/shell_out.rb +15 -0
- data/lib/chef/mixin/windows_architecture_helper.rb +0 -16
- data/lib/chef/node.rb +1 -1
- data/lib/chef/platform/query_helpers.rb +1 -5
- data/lib/chef/policy_builder/expand_node_object.rb +3 -0
- data/lib/chef/provider.rb +2 -0
- data/lib/chef/provider/cookbook_file.rb +0 -1
- data/lib/chef/provider/deploy.rb +0 -1
- data/lib/chef/provider/deploy/revision.rb +1 -1
- data/lib/chef/provider/env.rb +10 -25
- data/lib/chef/provider/env/windows.rb +23 -10
- data/lib/chef/provider/execute.rb +0 -3
- data/lib/chef/provider/file.rb +0 -3
- data/lib/chef/provider/git.rb +0 -6
- data/lib/chef/provider/group/dscl.rb +9 -27
- data/lib/chef/provider/group/gpasswd.rb +0 -3
- data/lib/chef/provider/group/groupmod.rb +0 -4
- data/lib/chef/provider/group/suse.rb +0 -3
- data/lib/chef/provider/group/usermod.rb +0 -3
- data/lib/chef/provider/link.rb +22 -5
- data/lib/chef/provider/log.rb +15 -4
- data/lib/chef/provider/mdadm.rb +0 -3
- data/lib/chef/provider/mount/mount.rb +0 -2
- data/lib/chef/provider/mount/solaris.rb +0 -2
- data/lib/chef/provider/package.rb +0 -1
- data/lib/chef/provider/package/apt.rb +0 -3
- data/lib/chef/provider/package/dpkg.rb +0 -1
- data/lib/chef/provider/package/easy_install.rb +0 -4
- data/lib/chef/provider/package/freebsd/base.rb +0 -3
- data/lib/chef/provider/package/freebsd/pkgng.rb +0 -2
- data/lib/chef/provider/package/freebsd/port.rb +0 -2
- data/lib/chef/provider/package/ips.rb +0 -3
- data/lib/chef/provider/package/paludis.rb +0 -5
- data/lib/chef/provider/package/portage.rb +0 -2
- data/lib/chef/provider/package/rpm.rb +2 -4
- data/lib/chef/provider/package/rubygems.rb +0 -4
- data/lib/chef/provider/package/smartos.rb +0 -3
- data/lib/chef/provider/package/windows/msi.rb +0 -2
- data/lib/chef/provider/package/yum.rb +0 -4
- data/lib/chef/provider/package/zypper.rb +0 -3
- data/lib/chef/provider/registry_key.rb +0 -2
- data/lib/chef/provider/remote_directory.rb +0 -1
- data/lib/chef/provider/remote_file.rb +0 -1
- data/lib/chef/provider/remote_file/cache_control_data.rb +1 -3
- data/lib/chef/provider/remote_file/content.rb +0 -1
- data/lib/chef/provider/remote_file/fetcher.rb +0 -2
- data/lib/chef/provider/remote_file/ftp.rb +0 -1
- data/lib/chef/provider/resource_update.rb +0 -3
- data/lib/chef/provider/service/freebsd.rb +0 -3
- data/lib/chef/provider/service/init.rb +0 -3
- data/lib/chef/provider/service/macosx.rb +0 -1
- data/lib/chef/provider/service/redhat.rb +0 -2
- data/lib/chef/provider/service/simple.rb +0 -3
- data/lib/chef/provider/service/solaris.rb +0 -3
- data/lib/chef/provider/service/systemd.rb +15 -14
- data/lib/chef/provider/service/windows.rb +0 -3
- data/lib/chef/provider/subversion.rb +0 -2
- data/lib/chef/provider/template.rb +0 -2
- data/lib/chef/provider/template/content.rb +0 -1
- data/lib/chef/provider/user/dscl.rb +156 -549
- data/lib/chef/provider/user/solaris.rb +0 -1
- data/lib/chef/provider/user/useradd.rb +0 -3
- data/lib/chef/provider/whyrun_safe_ruby_block.rb +1 -1
- data/lib/chef/providers.rb +0 -1
- data/lib/chef/resource.rb +1 -4
- data/lib/chef/resource/freebsd_package.rb +2 -10
- data/lib/chef/resource/lwrp_base.rb +1 -12
- data/lib/chef/resource/user.rb +0 -18
- data/lib/chef/resource_collection.rb +1 -1
- data/lib/chef/resource_reporter.rb +10 -10
- data/lib/chef/resources.rb +0 -1
- data/lib/chef/role.rb +3 -3
- data/lib/chef/run_list.rb +1 -1
- data/lib/chef/tasks/chef_repo.rake +131 -264
- data/lib/chef/user.rb +1 -1
- data/lib/chef/util/path_helper.rb +2 -2
- data/lib/chef/version.rb +9 -1
- data/lib/chef/win32/api/system.rb +0 -9
- data/spec/data/bootstrap/test-hints.erb +1 -1
- data/spec/data/bootstrap/test.erb +1 -1
- data/spec/functional/dsl/reboot_pending_spec.rb +53 -58
- data/spec/functional/knife/cookbook_delete_spec.rb +3 -3
- data/spec/functional/knife/exec_spec.rb +1 -1
- data/spec/functional/mixin/shell_out_spec.rb +48 -0
- data/spec/functional/resource/base.rb +0 -10
- data/spec/functional/resource/group_spec.rb +1 -5
- data/spec/functional/resource/link_spec.rb +8 -0
- data/spec/functional/resource/{user/useradd_spec.rb → user_spec.rb} +1 -1
- data/spec/integration/knife/chef_fs_data_store_spec.rb +3 -3
- data/spec/integration/knife/chef_repo_path_spec.rb +1 -6
- data/spec/integration/knife/chef_repository_file_system_spec.rb +1 -1
- data/spec/integration/knife/chefignore_spec.rb +1 -1
- data/spec/integration/knife/common_options_spec.rb +50 -3
- data/spec/integration/knife/cookbook_api_ipv6_spec.rb +1 -1
- data/spec/integration/knife/delete_spec.rb +1 -1
- data/spec/integration/knife/deps_spec.rb +1 -1
- data/spec/integration/knife/diff_spec.rb +3 -3
- data/spec/integration/knife/download_spec.rb +3 -3
- data/spec/integration/knife/list_spec.rb +1 -1
- data/spec/integration/knife/raw_spec.rb +1 -11
- data/spec/integration/knife/redirection_spec.rb +1 -1
- data/spec/integration/knife/serve_spec.rb +2 -2
- data/spec/integration/knife/show_spec.rb +1 -1
- data/spec/integration/knife/upload_spec.rb +9 -9
- data/spec/spec_helper.rb +0 -9
- data/spec/support/pedant/pedant_config.rb +2 -1
- data/spec/support/pedant/run_pedant.rb +2 -1
- data/spec/support/platform_helpers.rb +5 -24
- data/spec/support/shared/integration/integration_helper.rb +2 -1
- data/spec/support/shared/matchers.rb +17 -0
- data/spec/tiny_server.rb +1 -2
- data/spec/unit/api_client_spec.rb +3 -3
- data/spec/unit/application_spec.rb +9 -32
- data/spec/unit/config_fetcher_spec.rb +1 -1
- data/spec/unit/cookbook/metadata_spec.rb +3 -7
- data/spec/unit/cookbook/synchronizer_spec.rb +441 -226
- data/spec/unit/cookbook_loader_spec.rb +1 -1
- data/spec/unit/cookbook_uploader_spec.rb +160 -0
- data/spec/unit/cookbook_version_spec.rb +0 -4
- data/spec/unit/data_bag_item_spec.rb +1 -5
- data/spec/unit/data_bag_spec.rb +1 -5
- data/spec/unit/deprecation_spec.rb +1 -1
- data/spec/unit/dsl/recipe_spec.rb +12 -0
- data/spec/unit/encrypted_data_bag_item_spec.rb +7 -14
- data/spec/unit/environment_spec.rb +3 -7
- data/spec/unit/exceptions_spec.rb +0 -6
- data/spec/unit/http/json_input_spec.rb +128 -0
- data/spec/unit/json_compat_spec.rb +17 -58
- data/spec/unit/knife/client_create_spec.rb +3 -3
- data/spec/unit/knife/configure_client_spec.rb +6 -5
- data/spec/unit/knife/cookbook_delete_spec.rb +1 -1
- data/spec/unit/knife/cookbook_download_spec.rb +5 -5
- data/spec/unit/knife/cookbook_metadata_from_file_spec.rb +1 -0
- data/spec/unit/knife/cookbook_metadata_spec.rb +1 -1
- data/spec/unit/knife/cookbook_site_download_spec.rb +10 -11
- data/spec/unit/knife/cookbook_site_install_spec.rb +116 -161
- data/spec/unit/knife/cookbook_site_share_spec.rb +8 -8
- data/spec/unit/knife/cookbook_upload_spec.rb +3 -2
- data/spec/unit/knife/core/bootstrap_context_spec.rb +3 -3
- data/spec/unit/knife/core/subcommand_loader_spec.rb +1 -66
- data/spec/unit/knife/data_bag_from_file_spec.rb +2 -1
- data/spec/unit/knife/tag_create_spec.rb +3 -3
- data/spec/unit/knife/tag_delete_spec.rb +3 -3
- data/spec/unit/knife/user_create_spec.rb +1 -1
- data/spec/unit/knife_spec.rb +14 -14
- data/spec/unit/lwrp_spec.rb +1 -21
- data/spec/unit/mixin/shell_out_spec.rb +92 -0
- data/spec/unit/node_spec.rb +0 -4
- data/spec/unit/platform/query_helpers_spec.rb +0 -23
- data/spec/unit/provider/env/windows_spec.rb +34 -70
- data/spec/unit/provider/env_spec.rb +11 -76
- data/spec/unit/provider/group/dscl_spec.rb +1 -38
- data/spec/unit/provider/log_spec.rb +18 -0
- data/spec/unit/provider/package/rpm_spec.rb +0 -12
- data/spec/unit/provider/remote_file/cache_control_data_spec.rb +1 -1
- data/spec/unit/provider/service/systemd_service_spec.rb +44 -27
- data/spec/unit/provider/user/dscl_spec.rb +264 -660
- data/spec/unit/provider/user/useradd_spec.rb +0 -1
- data/spec/unit/provider/whyrun_safe_ruby_block_spec.rb +2 -2
- data/spec/unit/provider_spec.rb +12 -0
- data/spec/unit/recipe_spec.rb +0 -41
- data/spec/unit/resource_collection_spec.rb +1 -5
- data/spec/unit/resource_reporter_spec.rb +3 -51
- data/spec/unit/resource_spec.rb +3 -14
- data/spec/unit/rest_spec.rb +1 -4
- data/spec/unit/role_spec.rb +0 -10
- data/spec/unit/run_list_spec.rb +1 -5
- data/spec/unit/user_spec.rb +1 -5
- metadata +20 -100
- data/lib/chef/mixin/windows_env_helper.rb +0 -56
- data/lib/chef/provider/dsc_script.rb +0 -175
- data/lib/chef/resource/dsc_script.rb +0 -126
- data/lib/chef/streaming_cookbook_uploader.rb +0 -205
- data/lib/chef/util/dsc/configuration_generator.rb +0 -115
- data/lib/chef/util/dsc/lcm_output_parser.rb +0 -133
- data/lib/chef/util/dsc/local_configuration_manager.rb +0 -141
- data/lib/chef/util/dsc/resource_info.rb +0 -26
- data/lib/chef/util/powershell/cmdlet.rb +0 -136
- data/lib/chef/util/powershell/cmdlet_result.rb +0 -46
- data/spec/data/mac_users/10.7-8.plist.xml +0 -559
- data/spec/data/mac_users/10.7-8.shadow.xml +0 -11
- data/spec/data/mac_users/10.7.plist.xml +0 -559
- data/spec/data/mac_users/10.7.shadow.xml +0 -11
- data/spec/data/mac_users/10.8.plist.xml +0 -559
- data/spec/data/mac_users/10.8.shadow.xml +0 -21
- data/spec/data/mac_users/10.9.plist.xml +0 -560
- data/spec/data/mac_users/10.9.shadow.xml +0 -21
- data/spec/functional/provider/whyrun_safe_ruby_block_spec.rb +0 -51
- data/spec/functional/resource/dsc_script_spec.rb +0 -382
- data/spec/functional/resource/env_spec.rb +0 -182
- data/spec/functional/resource/user/dscl_spec.rb +0 -199
- data/spec/functional/util/powershell/cmdlet_spec.rb +0 -113
- data/spec/support/lib/chef/resource/zen_follower.rb +0 -46
- data/spec/support/shared/shared_examples.rb +0 -10
- data/spec/unit/chef_fs/data_handler/group_handler_spec.rb +0 -63
- data/spec/unit/formatters/base_spec.rb +0 -48
- data/spec/unit/provider/dsc_script_spec.rb +0 -174
- data/spec/unit/resource/dsc_script_spec.rb +0 -98
- data/spec/unit/util/dsc/configuration_generator_spec.rb +0 -171
- data/spec/unit/util/dsc/lcm_output_parser_spec.rb +0 -169
- data/spec/unit/util/dsc/local_configuration_manager_spec.rb +0 -139
- data/spec/unit/util/powershell/cmdlet_spec.rb +0 -106
@@ -18,7 +18,7 @@
|
|
18
18
|
require 'support/shared/integration/integration_helper'
|
19
19
|
require 'chef/knife/raw'
|
20
20
|
|
21
|
-
describe 'knife common options'
|
21
|
+
describe 'knife common options' do
|
22
22
|
extend IntegrationSupport
|
23
23
|
include KnifeSupport
|
24
24
|
|
@@ -53,10 +53,9 @@ describe 'knife common options', :workstation do
|
|
53
53
|
# 0.0.0.0 is not a valid address to bind to on windows.
|
54
54
|
context 'And chef_zero.host is 0.0.0.0', :unix_only do
|
55
55
|
before(:each) { Chef::Config.chef_zero.host = '0.0.0.0' }
|
56
|
-
|
56
|
+
|
57
57
|
it 'knife raw /nodes/x should retrieve the role' do
|
58
58
|
knife('raw /nodes/x').should_succeed /"name": "x"/
|
59
|
-
Chef::Config.chef_server_url.should == 'http://0.0.0.0:8889'
|
60
59
|
end
|
61
60
|
end
|
62
61
|
|
@@ -109,5 +108,53 @@ EOM
|
|
109
108
|
knife('raw -z --chef-zero-port=9999 /nodes/x').should_succeed /"name": "x"/
|
110
109
|
Chef::Config.chef_server_url.should == 'http://localhost:9999'
|
111
110
|
end
|
111
|
+
|
112
|
+
context 'when the default port (8889) is already bound' do
|
113
|
+
before :each do
|
114
|
+
begin
|
115
|
+
@server = ChefZero::Server.new(:host => 'localhost', :port => 8889)
|
116
|
+
@server.start_background
|
117
|
+
rescue Errno::EADDRINUSE
|
118
|
+
# OK. Don't care who has it in use, as long as *someone* does.
|
119
|
+
end
|
120
|
+
end
|
121
|
+
after :each do
|
122
|
+
@server.stop if @server
|
123
|
+
end
|
124
|
+
|
125
|
+
it 'knife raw -z /nodes/x retrieves the node' do
|
126
|
+
knife('raw -z /nodes/x').should_succeed /"name": "x"/
|
127
|
+
expect(URI(Chef::Config.chef_server_url).port).to be > 8889
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
context 'when port 9999 is already bound' do
|
132
|
+
before :each do
|
133
|
+
begin
|
134
|
+
@server = ChefZero::Server.new(:host => 'localhost', :port => 9999)
|
135
|
+
@server.start_background
|
136
|
+
rescue Errno::EADDRINUSE
|
137
|
+
# OK. Don't care who has it in use, as long as *someone* does.
|
138
|
+
end
|
139
|
+
end
|
140
|
+
after :each do
|
141
|
+
@server.stop if @server
|
142
|
+
end
|
143
|
+
|
144
|
+
it 'knife raw -z --chef-zero-port=9999-20000 /nodes/x' do
|
145
|
+
knife('raw -z --chef-zero-port=9999-20000 /nodes/x').should_succeed /"name": "x"/
|
146
|
+
expect(URI(Chef::Config.chef_server_url).port).to be > 9999
|
147
|
+
end
|
148
|
+
|
149
|
+
it 'knife raw -z --chef-zero-port=9999-9999,19423' do
|
150
|
+
knife('raw -z --chef-zero-port=9999-9999,19423 /nodes/x').should_succeed /"name": "x"/
|
151
|
+
expect(URI(Chef::Config.chef_server_url).port).to be == 19423
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
it 'knife raw -z --chef-zero-port=9999 /nodes/x retrieves the node' do
|
156
|
+
knife('raw -z --chef-zero-port=9999 /nodes/x').should_succeed /"name": "x"/
|
157
|
+
Chef::Config.chef_server_url.should == 'http://localhost:9999'
|
158
|
+
end
|
112
159
|
end
|
113
160
|
end
|
@@ -18,7 +18,7 @@
|
|
18
18
|
require 'support/shared/integration/integration_helper'
|
19
19
|
require 'chef/mixin/shell_out'
|
20
20
|
|
21
|
-
describe "Knife cookbook API integration with IPv6"
|
21
|
+
describe "Knife cookbook API integration with IPv6" do
|
22
22
|
extend IntegrationSupport
|
23
23
|
include Chef::Mixin::ShellOut
|
24
24
|
|
@@ -18,7 +18,7 @@
|
|
18
18
|
require 'support/shared/integration/integration_helper'
|
19
19
|
require 'chef/knife/diff'
|
20
20
|
|
21
|
-
describe 'knife diff'
|
21
|
+
describe 'knife diff' do
|
22
22
|
extend IntegrationSupport
|
23
23
|
include KnifeSupport
|
24
24
|
|
@@ -275,7 +275,7 @@ EOM
|
|
275
275
|
when_the_repository 'has an environment with bad JSON' do
|
276
276
|
file 'environments/x.json', '{'
|
277
277
|
it 'knife diff reports an error and does a textual diff' do
|
278
|
-
knife('diff /environments/x.json').should_succeed(/- "name": "x"/, :stderr =>
|
278
|
+
knife('diff /environments/x.json').should_succeed(/- "name": "x"/, :stderr => "WARN: Parse error reading #{path_to('environments/x.json')} as JSON: A JSON text must at least contain two octets!\n")
|
279
279
|
end
|
280
280
|
end
|
281
281
|
end
|
@@ -528,7 +528,7 @@ EOM
|
|
528
528
|
when_the_repository 'has an environment with bad JSON' do
|
529
529
|
file 'environments/x.json', '{'
|
530
530
|
it 'knife diff reports an error and does a textual diff' do
|
531
|
-
knife('diff /environments/x.json').should_succeed(/- "name": "x"/, :stderr =>
|
531
|
+
knife('diff /environments/x.json').should_succeed(/- "name": "x"/, :stderr => "WARN: Parse error reading #{path_to('environments/x.json')} as JSON: A JSON text must at least contain two octets!\n")
|
532
532
|
end
|
533
533
|
end
|
534
534
|
end
|
@@ -19,7 +19,7 @@ require 'support/shared/integration/integration_helper'
|
|
19
19
|
require 'chef/knife/download'
|
20
20
|
require 'chef/knife/diff'
|
21
21
|
|
22
|
-
describe 'knife download'
|
22
|
+
describe 'knife download' do
|
23
23
|
extend IntegrationSupport
|
24
24
|
include KnifeSupport
|
25
25
|
|
@@ -496,7 +496,7 @@ EOM
|
|
496
496
|
when_the_repository 'has an environment with bad JSON' do
|
497
497
|
file 'environments/x.json', '{'
|
498
498
|
it 'knife download succeeds' do
|
499
|
-
knife('download /environments/x.json').should_succeed "Updated /environments/x.json\n", :stderr =>
|
499
|
+
knife('download /environments/x.json').should_succeed "Updated /environments/x.json\n", :stderr => "WARN: Parse error reading #{path_to('environments/x.json')} as JSON: A JSON text must at least contain two octets!\n"
|
500
500
|
knife('diff --name-status /environments/x.json').should_succeed ''
|
501
501
|
end
|
502
502
|
end
|
@@ -946,7 +946,7 @@ EOM
|
|
946
946
|
when_the_repository 'has an environment with bad JSON' do
|
947
947
|
file 'environments/x.json', '{'
|
948
948
|
it 'knife download succeeds' do
|
949
|
-
knife('download /environments/x.json').should_succeed "Updated /environments/x.json\n", :stderr =>
|
949
|
+
knife('download /environments/x.json').should_succeed "Updated /environments/x.json\n", :stderr => "WARN: Parse error reading #{path_to('environments/x.json')} as JSON: A JSON text must at least contain two octets!\n"
|
950
950
|
knife('diff --name-status /environments/x.json').should_succeed ''
|
951
951
|
end
|
952
952
|
end
|
@@ -20,7 +20,7 @@ require 'support/shared/context/config'
|
|
20
20
|
require 'chef/knife/raw'
|
21
21
|
require 'chef/knife/show'
|
22
22
|
|
23
|
-
describe 'knife raw'
|
23
|
+
describe 'knife raw' do
|
24
24
|
extend IntegrationSupport
|
25
25
|
include KnifeSupport
|
26
26
|
include AppServerSupport
|
@@ -44,16 +44,12 @@ describe 'knife raw', :workstation do
|
|
44
44
|
"chef_type": "node",
|
45
45
|
"chef_environment": "_default",
|
46
46
|
"override": {
|
47
|
-
|
48
47
|
},
|
49
48
|
"normal": {
|
50
|
-
|
51
49
|
},
|
52
50
|
"default": {
|
53
|
-
|
54
51
|
},
|
55
52
|
"automatic": {
|
56
|
-
|
57
53
|
},
|
58
54
|
"run_list": [
|
59
55
|
|
@@ -74,16 +70,13 @@ EOM
|
|
74
70
|
"json_class": "Chef::Role",
|
75
71
|
"chef_type": "role",
|
76
72
|
"default_attributes": {
|
77
|
-
|
78
73
|
},
|
79
74
|
"override_attributes": {
|
80
|
-
|
81
75
|
},
|
82
76
|
"run_list": [
|
83
77
|
|
84
78
|
],
|
85
79
|
"env_run_lists": {
|
86
|
-
|
87
80
|
}
|
88
81
|
}
|
89
82
|
EOM
|
@@ -118,16 +111,13 @@ EOM
|
|
118
111
|
"json_class": "Chef::Role",
|
119
112
|
"chef_type": "role",
|
120
113
|
"default_attributes": {
|
121
|
-
|
122
114
|
},
|
123
115
|
"override_attributes": {
|
124
|
-
|
125
116
|
},
|
126
117
|
"run_list": [
|
127
118
|
|
128
119
|
],
|
129
120
|
"env_run_lists": {
|
130
|
-
|
131
121
|
}
|
132
122
|
}
|
133
123
|
EOM
|
@@ -19,7 +19,7 @@ require 'support/shared/integration/integration_helper'
|
|
19
19
|
require 'support/shared/context/config'
|
20
20
|
require 'chef/knife/list'
|
21
21
|
|
22
|
-
describe 'redirection'
|
22
|
+
describe 'redirection' do
|
23
23
|
extend IntegrationSupport
|
24
24
|
include KnifeSupport
|
25
25
|
include AppServerSupport
|
@@ -19,7 +19,7 @@ require 'support/shared/integration/integration_helper'
|
|
19
19
|
require 'chef/knife/serve'
|
20
20
|
require 'chef/server_api'
|
21
21
|
|
22
|
-
describe 'knife serve'
|
22
|
+
describe 'knife serve' do
|
23
23
|
extend IntegrationSupport
|
24
24
|
include KnifeSupport
|
25
25
|
include AppServerSupport
|
@@ -31,7 +31,7 @@ describe 'knife serve', :workstation do
|
|
31
31
|
exception = nil
|
32
32
|
t = Thread.new do
|
33
33
|
begin
|
34
|
-
knife('serve')
|
34
|
+
knife('serve --chef-zero-port=8889')
|
35
35
|
rescue
|
36
36
|
exception = $!
|
37
37
|
end
|
@@ -20,7 +20,7 @@ require 'chef/knife/upload'
|
|
20
20
|
require 'chef/knife/diff'
|
21
21
|
require 'chef/knife/raw'
|
22
22
|
|
23
|
-
describe 'knife upload'
|
23
|
+
describe 'knife upload' do
|
24
24
|
extend IntegrationSupport
|
25
25
|
include KnifeSupport
|
26
26
|
|
@@ -237,7 +237,7 @@ Created /data_bags/x/y.json
|
|
237
237
|
EOM
|
238
238
|
knife('diff --name-status /data_bags').should_succeed <<EOM
|
239
239
|
EOM
|
240
|
-
|
240
|
+
JSON.parse(knife('raw /data/x/y').stdout, :create_additions => false).keys.sort.should == [ 'foo', 'id' ]
|
241
241
|
end
|
242
242
|
|
243
243
|
it 'knife upload /data_bags/x /data_bags/x/y.json uploads x once' do
|
@@ -256,7 +256,7 @@ Created /data_bags/x
|
|
256
256
|
Created /data_bags/x/y.json
|
257
257
|
EOM
|
258
258
|
knife('diff --name-status /data_bags').should_succeed ''
|
259
|
-
result =
|
259
|
+
result = JSON.parse(knife('raw /data/x/y').stdout, :create_additions => false)
|
260
260
|
result.keys.sort.should == [ 'chef_type', 'data_bag', 'id' ]
|
261
261
|
result['chef_type'].should == 'aaa'
|
262
262
|
result['data_bag'].should == 'bbb'
|
@@ -528,8 +528,8 @@ EOM
|
|
528
528
|
when_the_repository 'has an environment with bad JSON' do
|
529
529
|
file 'environments/x.json', '{'
|
530
530
|
it 'knife upload tries and fails' do
|
531
|
-
knife('upload /environments/x.json').should_fail
|
532
|
-
knife('diff --name-status /environments/x.json').should_succeed "M\t/environments/x.json\n", :stderr =>
|
531
|
+
knife('upload /environments/x.json').should_fail "WARN: Parse error reading #{path_to('environments/x.json')} as JSON: A JSON text must at least contain two octets!\nERROR: /environments/x.json failed to write: Parse error reading JSON: A JSON text must at least contain two octets!\n"
|
532
|
+
knife('diff --name-status /environments/x.json').should_succeed "M\t/environments/x.json\n", :stderr => "WARN: Parse error reading #{path_to('environments/x.json')} as JSON: A JSON text must at least contain two octets!\n"
|
533
533
|
end
|
534
534
|
end
|
535
535
|
|
@@ -554,7 +554,7 @@ EOM
|
|
554
554
|
when_the_repository 'has an environment with bad JSON' do
|
555
555
|
file 'environments/x.json', '{'
|
556
556
|
it 'knife upload tries and fails' do
|
557
|
-
knife('upload /environments/x.json').should_fail
|
557
|
+
knife('upload /environments/x.json').should_fail "ERROR: /environments failed to create_child: Parse error reading JSON creating child 'x.json': A JSON text must at least contain two octets!\n"
|
558
558
|
knife('diff --name-status /environments/x.json').should_succeed "A\t/environments/x.json\n"
|
559
559
|
end
|
560
560
|
end
|
@@ -1007,8 +1007,8 @@ EOM
|
|
1007
1007
|
when_the_repository 'has an environment with bad JSON' do
|
1008
1008
|
file 'environments/x.json', '{'
|
1009
1009
|
it 'knife upload tries and fails' do
|
1010
|
-
knife('upload /environments/x.json').should_fail
|
1011
|
-
knife('diff --name-status /environments/x.json').should_succeed "M\t/environments/x.json\n", :stderr =>
|
1010
|
+
knife('upload /environments/x.json').should_fail "WARN: Parse error reading #{path_to('environments/x.json')} as JSON: A JSON text must at least contain two octets!\nERROR: /environments/x.json failed to write: Parse error reading JSON: A JSON text must at least contain two octets!\n"
|
1011
|
+
knife('diff --name-status /environments/x.json').should_succeed "M\t/environments/x.json\n", :stderr => "WARN: Parse error reading #{path_to('environments/x.json')} as JSON: A JSON text must at least contain two octets!\n"
|
1012
1012
|
end
|
1013
1013
|
end
|
1014
1014
|
|
@@ -1033,7 +1033,7 @@ EOM
|
|
1033
1033
|
when_the_repository 'has an environment with bad JSON' do
|
1034
1034
|
file 'environments/x.json', '{'
|
1035
1035
|
it 'knife upload tries and fails' do
|
1036
|
-
knife('upload /environments/x.json').should_fail
|
1036
|
+
knife('upload /environments/x.json').should_fail "ERROR: /environments failed to create_child: Parse error reading JSON creating child 'x.json': A JSON text must at least contain two octets!\n"
|
1037
1037
|
knife('diff --name-status /environments/x.json').should_succeed "A\t/environments/x.json\n"
|
1038
1038
|
end
|
1039
1039
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -97,9 +97,6 @@ RSpec.configure do |config|
|
|
97
97
|
config.filter_run :focus => true
|
98
98
|
config.filter_run_excluding :external => true
|
99
99
|
|
100
|
-
# Only run these tests on platforms that are also chef workstations
|
101
|
-
config.filter_run_excluding :workstation if solaris?
|
102
|
-
|
103
100
|
# Tests that randomly fail, but may have value.
|
104
101
|
config.filter_run_excluding :volatile => true
|
105
102
|
config.filter_run_excluding :volatile_on_solaris => true if solaris?
|
@@ -110,11 +107,8 @@ RSpec.configure do |config|
|
|
110
107
|
config.filter_run_excluding :not_supported_on_win2k3 => true if windows_win2k3?
|
111
108
|
config.filter_run_excluding :not_supported_on_solaris => true if solaris?
|
112
109
|
config.filter_run_excluding :win2k3_only => true unless windows_win2k3?
|
113
|
-
config.filter_run_excluding :windows_2008r2_or_later => true unless windows_2008r2_or_later?
|
114
110
|
config.filter_run_excluding :windows64_only => true unless windows64?
|
115
111
|
config.filter_run_excluding :windows32_only => true unless windows32?
|
116
|
-
config.filter_run_excluding :windows_powershell_dsc_only => true unless windows_powershell_dsc?
|
117
|
-
config.filter_run_excluding :windows_powershell_no_dsc_only => true unless ! windows_powershell_dsc?
|
118
112
|
config.filter_run_excluding :windows_domain_joined_only => true unless windows_domain_joined?
|
119
113
|
config.filter_run_excluding :solaris_only => true unless solaris?
|
120
114
|
config.filter_run_excluding :system_windows_service_gem_only => true unless system_windows_service_gem?
|
@@ -185,6 +179,3 @@ module WEBrick
|
|
185
179
|
end
|
186
180
|
end
|
187
181
|
end
|
188
|
-
|
189
|
-
# Enough stuff needs json serialization that I'm just adding it here for equality asserts
|
190
|
-
require 'chef/json_compat'
|
@@ -21,7 +21,8 @@
|
|
21
21
|
################################################################################
|
22
22
|
# You MUST specify the address of the server the API requests will be
|
23
23
|
# sent to. Only specify protocol, hostname, and port.
|
24
|
-
|
24
|
+
# NOTE this is assigned in run_pedant.rb, because it's possible 8889 will not be the port chosen.
|
25
|
+
#chef_server 'http://127.0.0.1:8889'
|
25
26
|
|
26
27
|
# If you are doing development testing, you can specify the address of
|
27
28
|
# the Solr server. The presence of this parameter will enable tests
|
@@ -26,7 +26,7 @@ def start_server(chef_repo_path)
|
|
26
26
|
chef_fs = Chef::ChefFS::Config.new.local_fs
|
27
27
|
data_store = Chef::ChefFS::ChefFSDataStore.new(chef_fs)
|
28
28
|
data_store = ChefZero::DataStore::V1ToV2Adapter.new(data_store, 'chef', :org_defaults => ChefZero::DataStore::V1ToV2Adapter::ORG_DEFAULTS)
|
29
|
-
server = ChefZero::Server.new(:port => 8889, :data_store => data_store)#, :log_level => :debug)
|
29
|
+
server = ChefZero::Server.new(:port => 8889.upto(9999), :data_store => data_store)#, :log_level => :debug)
|
30
30
|
server.start_background
|
31
31
|
server
|
32
32
|
end
|
@@ -46,6 +46,7 @@ begin
|
|
46
46
|
|
47
47
|
Pedant.config.suite = 'api'
|
48
48
|
Pedant.config[:config_file] = 'spec/support/pedant/pedant_config.rb'
|
49
|
+
Pedant.config.chef_server = server.url
|
49
50
|
Pedant.setup([
|
50
51
|
'--skip-knife',
|
51
52
|
'--skip-validation',
|
@@ -27,6 +27,11 @@ def windows?
|
|
27
27
|
!!(RUBY_PLATFORM =~ /mswin|mingw|windows/)
|
28
28
|
end
|
29
29
|
|
30
|
+
def ohai
|
31
|
+
# This is defined in spec_helper; it has the `platform` populated.
|
32
|
+
OHAI_SYSTEM
|
33
|
+
end
|
34
|
+
|
30
35
|
require 'wmi-lite/wmi' if windows?
|
31
36
|
|
32
37
|
def windows_domain_joined?
|
@@ -43,30 +48,6 @@ def windows_win2k3?
|
|
43
48
|
(host['version'] && host['version'].start_with?("5.2"))
|
44
49
|
end
|
45
50
|
|
46
|
-
def windows_2008r2_or_later?
|
47
|
-
return false unless windows?
|
48
|
-
wmi = WmiLite::Wmi.new
|
49
|
-
host = wmi.first_of('Win32_OperatingSystem')
|
50
|
-
version = host['version']
|
51
|
-
return false unless version
|
52
|
-
components = version.split('.').map do | component |
|
53
|
-
component.to_i
|
54
|
-
end
|
55
|
-
components.length >=2 && components[0] >= 6 && components[1] >= 1
|
56
|
-
end
|
57
|
-
|
58
|
-
def windows_powershell_dsc?
|
59
|
-
return false unless windows?
|
60
|
-
supports_dsc = false
|
61
|
-
begin
|
62
|
-
wmi = WmiLite::Wmi.new('root/microsoft/windows/desiredstateconfiguration')
|
63
|
-
lcm = wmi.query("SELECT * FROM meta_class WHERE __this ISA 'MSFT_DSCLocalConfigurationManager'")
|
64
|
-
supports_dsc = !! lcm
|
65
|
-
rescue WmiLite::WmiException
|
66
|
-
end
|
67
|
-
supports_dsc
|
68
|
-
end
|
69
|
-
|
70
51
|
def mac_osx_106?
|
71
52
|
if File.exists? "/usr/bin/sw_vers"
|
72
53
|
result = shell_out("/usr/bin/sw_vers")
|
@@ -21,6 +21,7 @@ require 'tmpdir'
|
|
21
21
|
require 'fileutils'
|
22
22
|
require 'chef/config'
|
23
23
|
require 'chef_zero/rspec'
|
24
|
+
require 'json'
|
24
25
|
require 'support/shared/integration/knife_support'
|
25
26
|
require 'support/shared/integration/app_server_support'
|
26
27
|
require 'spec_helper'
|
@@ -68,7 +69,7 @@ module IntegrationSupport
|
|
68
69
|
File.open(filename, 'w') do |file|
|
69
70
|
raw = case contents
|
70
71
|
when Hash
|
71
|
-
|
72
|
+
JSON.pretty_generate(contents)
|
72
73
|
when Array
|
73
74
|
contents.join("\n")
|
74
75
|
else
|