chef 10.34.6 → 11.0.0.beta.0
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.
- data/CONTRIBUTING.md +155 -0
- data/README.md +89 -0
- data/Rakefile +4 -12
- data/bin/chef-apply +25 -0
- data/bin/chef-shell +34 -0
- data/bin/shef +6 -5
- data/distro/common/html/chef-client.8.html +4 -4
- data/distro/common/html/chef-expander.8.html +4 -4
- data/distro/common/html/chef-expanderctl.8.html +4 -4
- data/distro/common/html/chef-server-webui.8.html +4 -4
- data/distro/common/html/chef-server.8.html +4 -4
- data/distro/common/html/{shef.1.html → chef-shell.1.html} +49 -46
- data/distro/common/html/chef-solo.8.html +18 -12
- data/distro/common/html/chef-solr.8.html +4 -4
- data/distro/common/html/knife-bootstrap.1.html +4 -4
- data/distro/common/html/knife-client.1.html +4 -4
- data/distro/common/html/knife-configure.1.html +4 -4
- data/distro/common/html/knife-cookbook-site.1.html +4 -4
- data/distro/common/html/knife-cookbook.1.html +10 -7
- data/distro/common/html/knife-data-bag.1.html +10 -7
- data/distro/common/html/knife-environment.1.html +8 -6
- data/distro/common/html/knife-exec.1.html +9 -9
- data/distro/common/html/knife-index.1.html +4 -4
- data/distro/common/html/knife-node.1.html +4 -4
- data/distro/common/html/knife-role.1.html +4 -4
- data/distro/common/html/knife-search.1.html +4 -4
- data/distro/common/html/knife-ssh.1.html +4 -4
- data/distro/common/html/knife-status.1.html +4 -4
- data/distro/common/html/knife-tag.1.html +4 -4
- data/distro/common/html/knife.1.html +8 -13
- data/distro/common/man/man1/{shef.1 → chef-shell.1} +21 -57
- data/distro/common/man/man1/knife-bootstrap.1 +1 -1
- data/distro/common/man/man1/knife-client.1 +1 -1
- data/distro/common/man/man1/knife-configure.1 +1 -1
- data/distro/common/man/man1/knife-cookbook-site.1 +1 -1
- data/distro/common/man/man1/knife-cookbook.1 +15 -2
- data/distro/common/man/man1/knife-data-bag.1 +15 -2
- data/distro/common/man/man1/knife-environment.1 +12 -2
- data/distro/common/man/man1/knife-exec.1 +4 -7
- data/distro/common/man/man1/knife-index.1 +1 -1
- data/distro/common/man/man1/knife-node.1 +1 -1
- data/distro/common/man/man1/knife-role.1 +1 -1
- data/distro/common/man/man1/knife-search.1 +1 -1
- data/distro/common/man/man1/knife-ssh.1 +1 -1
- data/distro/common/man/man1/knife-status.1 +1 -1
- data/distro/common/man/man1/knife-tag.1 +1 -1
- data/distro/common/man/man1/knife.1 +3 -6
- data/distro/common/man/man8/chef-client.8 +1 -1
- data/distro/common/man/man8/chef-expander.8 +1 -1
- data/distro/common/man/man8/chef-expanderctl.8 +1 -1
- data/distro/common/man/man8/chef-server-webui.8 +1 -1
- data/distro/common/man/man8/chef-server.8 +1 -1
- data/distro/common/man/man8/chef-solo.8 +36 -4
- data/distro/common/man/man8/chef-solr.8 +1 -1
- data/distro/common/markdown/man1/{shef.mkd → chef-shell.mkd} +49 -43
- data/distro/common/markdown/man1/knife-exec.mkd +11 -6
- data/distro/common/markdown/man1/knife.mkd +4 -9
- data/distro/debian/etc/default/chef-client +0 -1
- data/distro/debian/etc/init.d/chef-client +2 -2
- data/lib/chef.rb +2 -5
- data/lib/chef/api_client.rb +20 -130
- data/lib/chef/api_client/registration.rb +126 -0
- data/lib/chef/application.rb +71 -14
- data/lib/chef/application/apply.rb +160 -0
- data/lib/chef/application/client.rb +25 -18
- data/lib/chef/application/knife.rb +0 -2
- data/lib/chef/application/solo.rb +23 -8
- data/lib/chef/application/windows_service.rb +5 -2
- data/lib/chef/applications.rb +1 -0
- data/lib/chef/chef_fs.rb +11 -0
- data/lib/chef/chef_fs/command_line.rb +232 -0
- data/lib/chef/chef_fs/file_pattern.rb +312 -0
- data/lib/chef/chef_fs/file_system.rb +358 -0
- data/lib/chef/chef_fs/file_system/base_fs_dir.rb +47 -0
- data/lib/chef/chef_fs/file_system/base_fs_object.rb +121 -0
- data/lib/chef/chef_fs/file_system/chef_repository_file_system_entry.rb +109 -0
- data/{spec/unit/monkey_patches/uri_spec.rb → lib/chef/chef_fs/file_system/chef_repository_file_system_root_dir.rb} +12 -15
- data/lib/chef/chef_fs/file_system/chef_server_root_dir.rb +84 -0
- data/lib/chef/chef_fs/file_system/cookbook_dir.rb +188 -0
- data/lib/chef/chef_fs/file_system/cookbook_file.rb +78 -0
- data/lib/chef/chef_fs/file_system/cookbook_subdir.rb +54 -0
- data/lib/chef/chef_fs/file_system/cookbooks_dir.rb +68 -0
- data/lib/chef/chef_fs/file_system/data_bag_dir.rb +78 -0
- data/lib/chef/chef_fs/file_system/data_bag_item.rb +59 -0
- data/lib/chef/chef_fs/file_system/data_bags_dir.rb +66 -0
- data/lib/chef/chef_fs/file_system/file_system_entry.rb +90 -0
- data/lib/chef/{index_queue.rb → chef_fs/file_system/file_system_error.rb} +14 -12
- data/lib/chef/{resource/whyrun_safe_ruby_block.rb → chef_fs/file_system/file_system_root_dir.rb} +10 -10
- data/lib/chef/chef_fs/file_system/must_delete_recursively_error.rb +31 -0
- data/lib/chef/chef_fs/file_system/nodes_dir.rb +47 -0
- data/lib/chef/{provider/whyrun_safe_ruby_block.rb → chef_fs/file_system/nonexistent_fs_object.rb} +19 -9
- data/lib/chef/chef_fs/file_system/not_found_error.rb +31 -0
- data/lib/chef/chef_fs/file_system/rest_list_dir.rb +84 -0
- data/lib/chef/chef_fs/file_system/rest_list_entry.rb +123 -0
- data/lib/chef/chef_fs/knife.rb +77 -0
- data/lib/chef/chef_fs/path_utils.rb +64 -0
- data/lib/chef/client.rb +44 -21
- data/lib/chef/config.rb +52 -43
- data/lib/chef/cookbook/synchronizer.rb +6 -8
- data/lib/chef/cookbook/syntax_check.rb +61 -14
- data/lib/chef/cookbook_loader.rb +39 -26
- data/lib/chef/cookbook_uploader.rb +17 -19
- data/lib/chef/cookbook_version.rb +3 -302
- data/lib/chef/daemon.rb +3 -18
- data/lib/chef/data_bag.rb +4 -97
- data/lib/chef/data_bag_item.rb +2 -65
- data/lib/chef/digester.rb +73 -0
- data/lib/chef/dsl.rb +6 -0
- data/lib/chef/dsl/data_query.rb +66 -0
- data/lib/chef/dsl/include_attribute.rb +60 -0
- data/lib/chef/dsl/include_recipe.rb +42 -0
- data/lib/chef/dsl/platform_introspection.rb +213 -0
- data/lib/chef/dsl/recipe.rb +84 -0
- data/lib/chef/dsl/registry_helper.rb +59 -0
- data/lib/chef/encrypted_data_bag_item.rb +74 -19
- data/lib/chef/environment.rb +9 -180
- data/lib/chef/exceptions.rb +87 -14
- data/lib/chef/formatters/base.rb +4 -1
- data/lib/chef/formatters/error_inspectors/registration_error_inspector.rb +0 -4
- data/lib/chef/json_compat.rb +1 -97
- data/lib/chef/knife.rb +90 -41
- 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-full.erb +3 -3
- 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/configure.rb +1 -2
- data/lib/chef/knife/cookbook_metadata.rb +1 -0
- data/lib/chef/knife/cookbook_test.rb +3 -2
- data/lib/chef/knife/cookbook_upload.rb +12 -7
- data/lib/chef/knife/core/bootstrap_context.rb +1 -1
- data/lib/chef/knife/core/generic_presenter.rb +26 -13
- data/lib/chef/knife/core/node_editor.rb +36 -16
- data/lib/chef/knife/core/node_presenter.rb +1 -1
- data/lib/chef/knife/core/text_formatter.rb +23 -37
- data/lib/chef/knife/core/ui.rb +15 -9
- data/lib/chef/knife/delete.rb +39 -0
- data/lib/chef/knife/diff.rb +46 -0
- data/lib/chef/knife/download.rb +50 -0
- data/lib/chef/knife/environment_show.rb +7 -0
- data/lib/chef/knife/exec.rb +5 -5
- data/lib/chef/knife/help_topics.rb +1 -1
- data/lib/chef/knife/index_rebuild.rb +91 -7
- data/lib/chef/knife/list.rb +109 -0
- data/lib/chef/knife/raw.rb +108 -0
- data/lib/chef/knife/search.rb +40 -22
- data/lib/chef/knife/show.rb +32 -0
- data/lib/chef/knife/ssh.rb +6 -2
- data/lib/chef/knife/upload.rb +50 -0
- data/lib/chef/mixin/checksum.rb +3 -3
- data/lib/chef/mixin/deep_merge.rb +55 -197
- data/lib/chef/mixin/language.rb +9 -222
- data/lib/chef/mixin/language_include_attribute.rb +6 -38
- data/lib/chef/mixin/language_include_recipe.rb +3 -35
- data/lib/chef/mixin/params_validate.rb +6 -19
- data/lib/chef/mixin/recipe_definition_dsl_core.rb +8 -61
- data/lib/chef/mixin/securable.rb +32 -7
- data/lib/chef/mixin/template.rb +40 -0
- data/lib/chef/mixins.rb +0 -4
- data/lib/chef/monkey_patches/net_http.rb +0 -34
- data/lib/chef/node.rb +133 -309
- data/lib/chef/node/attribute.rb +333 -473
- data/lib/chef/node/attribute_collections.rb +199 -0
- data/lib/chef/node/immutable_collections.rb +186 -0
- data/lib/chef/platform.rb +7 -22
- data/lib/chef/provider.rb +2 -49
- data/lib/chef/provider/breakpoint.rb +6 -6
- data/lib/chef/provider/cookbook_file.rb +5 -33
- data/lib/chef/provider/deploy.rb +2 -1
- data/lib/chef/provider/directory.rb +14 -17
- data/lib/chef/provider/file.rb +19 -52
- data/lib/chef/provider/group.rb +31 -51
- data/lib/chef/provider/group/dscl.rb +13 -53
- data/lib/chef/provider/group/gpasswd.rb +19 -14
- data/lib/chef/provider/group/groupadd.rb +1 -41
- data/lib/chef/provider/group/groupmod.rb +36 -46
- data/lib/chef/provider/group/pw.rb +16 -59
- data/lib/chef/provider/group/suse.rb +13 -16
- data/lib/chef/provider/group/usermod.rb +18 -40
- data/lib/chef/provider/group/windows.rb +6 -13
- data/lib/chef/provider/http_request.rb +25 -42
- data/lib/chef/provider/link.rb +2 -0
- data/lib/chef/provider/lwrp_base.rb +150 -0
- data/lib/chef/provider/package/portage.rb +4 -9
- data/lib/chef/provider/package/rpm.rb +2 -2
- data/lib/chef/provider/package/rubygems.rb +9 -41
- data/lib/chef/provider/package/yum.rb +12 -19
- data/lib/chef/provider/registry_key.rb +156 -0
- data/lib/chef/provider/remote_directory.rb +2 -0
- data/lib/chef/provider/remote_file.rb +21 -12
- data/lib/chef/provider/ruby_block.rb +5 -2
- data/lib/chef/provider/service.rb +15 -0
- data/lib/chef/provider/service/init.rb +9 -7
- data/lib/chef/provider/service/macosx.rb +15 -73
- data/lib/chef/provider/service/simple.rb +1 -1
- data/lib/chef/provider/service/solaris.rb +3 -3
- data/lib/chef/provider/template.rb +22 -25
- data/lib/chef/provider/template_finder.rb +61 -0
- data/lib/chef/provider/user.rb +0 -1
- data/lib/chef/provider/user/dscl.rb +175 -568
- data/lib/chef/provider/user/useradd.rb +30 -47
- data/lib/chef/providers.rb +3 -2
- data/lib/chef/recipe.rb +14 -8
- data/lib/chef/resource.rb +13 -154
- data/lib/chef/resource/group.rb +1 -11
- data/lib/chef/resource/http_request.rb +2 -1
- data/lib/chef/resource/lwrp_base.rb +127 -0
- data/lib/chef/resource/mount.rb +10 -11
- data/lib/chef/resource/registry_key.rb +86 -0
- data/lib/chef/resource/remote_directory.rb +6 -5
- data/lib/chef/resource/remote_file.rb +22 -31
- data/lib/chef/resource/ruby_block.rb +2 -2
- data/lib/chef/resource/service.rb +14 -0
- data/lib/chef/resource/user.rb +0 -18
- data/lib/chef/resource_collection.rb +25 -21
- data/lib/chef/resources.rb +2 -1
- data/lib/chef/rest.rb +50 -131
- data/lib/chef/rest/auth_credentials.rb +4 -20
- data/lib/chef/rest/rest_request.rb +2 -7
- data/lib/chef/role.rb +1 -97
- data/lib/chef/run_context.rb +108 -130
- data/lib/chef/run_context/cookbook_compiler.rb +280 -0
- data/lib/chef/run_list.rb +0 -2
- data/lib/chef/run_list/run_list_expansion.rb +0 -15
- data/lib/chef/run_lock.rb +90 -0
- data/lib/chef/runner.rb +28 -5
- data/lib/chef/sandbox.rb +15 -148
- data/lib/chef/scan_access_control.rb +2 -4
- data/lib/chef/shef/ext.rb +3 -575
- data/lib/chef/{shef.rb → shell.rb} +35 -40
- data/lib/chef/shell/ext.rb +593 -0
- data/lib/chef/{shef → shell}/model_wrapper.rb +3 -3
- data/lib/chef/{shef/shef_rest.rb → shell/shell_rest.rb} +4 -4
- data/lib/chef/{shef/shef_session.rb → shell/shell_session.rb} +17 -15
- data/lib/chef/shell_out.rb +7 -0
- data/lib/chef/util/windows/net_group.rb +1 -5
- data/lib/chef/version.rb +3 -3
- data/lib/chef/win32/api/process.rb +0 -1
- data/lib/chef/win32/handle.rb +1 -8
- data/lib/chef/win32/registry.rb +371 -0
- data/spec/data/big_json.json +1 -2
- data/spec/data/big_json_plus_one.json +1 -2
- data/spec/data/cookbooks/openldap/attributes/default.rb +10 -9
- data/spec/data/cookbooks/openldap/attributes/smokey.rb +1 -1
- data/spec/data/lwrp/providers/inline_compiler.rb +26 -0
- data/spec/data/nodes/default.rb +3 -3
- data/spec/data/nodes/test.example.com.rb +3 -3
- data/spec/data/nodes/test.rb +3 -3
- data/spec/data/partial_one.erb +1 -0
- data/spec/data/run_context/cookbooks/circular-dep1/attributes/default.rb +4 -0
- data/spec/data/run_context/cookbooks/circular-dep1/definitions/circular_dep1_res.rb +1 -0
- data/spec/data/run_context/cookbooks/circular-dep1/libraries/lib.rb +2 -0
- data/spec/data/run_context/cookbooks/circular-dep1/metadata.rb +2 -0
- data/spec/data/run_context/cookbooks/circular-dep1/providers/provider.rb +1 -0
- data/spec/data/{knife-home/.chef/plugins/knife/example_home_subcommand.rb → run_context/cookbooks/circular-dep1/recipes/default.rb} +0 -0
- data/spec/data/run_context/cookbooks/circular-dep1/resources/resource.rb +1 -0
- data/spec/data/run_context/cookbooks/circular-dep2/attributes/default.rb +3 -0
- data/spec/data/run_context/cookbooks/circular-dep2/definitions/circular_dep2_res.rb +1 -0
- data/spec/data/run_context/cookbooks/circular-dep2/libraries/lib.rb +2 -0
- data/spec/data/run_context/cookbooks/circular-dep2/metadata.rb +2 -0
- data/spec/data/run_context/cookbooks/circular-dep2/providers/provider.rb +1 -0
- data/spec/data/{lwrp_const_scoping/resources/conflict.rb → run_context/cookbooks/circular-dep2/recipes/default.rb} +0 -0
- data/spec/data/run_context/cookbooks/circular-dep2/resources/resource.rb +1 -0
- data/spec/data/run_context/cookbooks/dependency1/attributes/aa_first.rb +2 -0
- data/spec/data/run_context/cookbooks/dependency1/attributes/default.rb +2 -0
- data/spec/data/run_context/cookbooks/dependency1/attributes/zz_last.rb +3 -0
- data/spec/data/run_context/cookbooks/dependency1/definitions/dependency1_res.rb +1 -0
- data/spec/data/run_context/cookbooks/dependency1/libraries/lib.rb +2 -0
- data/spec/data/run_context/cookbooks/dependency1/providers/provider.rb +1 -0
- data/spec/data/run_context/cookbooks/dependency1/recipes/default.rb +0 -0
- data/spec/data/run_context/cookbooks/dependency1/resources/resource.rb +1 -0
- data/spec/data/run_context/cookbooks/dependency2/attributes/default.rb +3 -0
- data/spec/data/run_context/cookbooks/dependency2/definitions/dependency2_res.rb +1 -0
- data/spec/data/run_context/cookbooks/dependency2/libraries/lib.rb +2 -0
- data/spec/data/run_context/cookbooks/dependency2/providers/provider.rb +1 -0
- data/spec/data/run_context/cookbooks/dependency2/recipes/default.rb +0 -0
- data/spec/data/run_context/cookbooks/dependency2/resources/resource.rb +1 -0
- data/spec/data/run_context/cookbooks/no-default-attr/attributes/server.rb +3 -0
- data/spec/data/run_context/cookbooks/no-default-attr/definitions/no_default-attr_res.rb +1 -0
- data/spec/data/run_context/cookbooks/no-default-attr/providers/provider.rb +1 -0
- data/spec/data/run_context/cookbooks/no-default-attr/recipes/default.rb +0 -0
- data/spec/data/run_context/cookbooks/no-default-attr/resources/resource.rb +1 -0
- data/spec/data/run_context/cookbooks/test-with-circular-deps/attributes/default.rb +3 -0
- data/spec/data/run_context/cookbooks/test-with-circular-deps/definitions/test_with-circular-deps_res.rb +1 -0
- data/spec/data/run_context/cookbooks/test-with-circular-deps/libraries/lib.rb +2 -0
- data/spec/data/run_context/cookbooks/test-with-circular-deps/metadata.rb +2 -0
- data/spec/data/run_context/cookbooks/test-with-circular-deps/providers/provider.rb +1 -0
- data/spec/data/run_context/cookbooks/test-with-circular-deps/recipes/default.rb +0 -0
- data/spec/data/run_context/cookbooks/test-with-circular-deps/resources/resource.rb +1 -0
- data/spec/data/run_context/cookbooks/test-with-deps/attributes/default.rb +3 -0
- data/spec/data/run_context/cookbooks/test-with-deps/definitions/test_with-deps_res.rb +1 -0
- data/spec/data/run_context/cookbooks/test-with-deps/libraries/lib.rb +1 -0
- data/spec/data/run_context/cookbooks/test-with-deps/metadata.rb +3 -0
- data/spec/data/run_context/cookbooks/test-with-deps/providers/provider.rb +1 -0
- data/spec/data/run_context/cookbooks/test-with-deps/recipes/default.rb +0 -0
- data/spec/data/run_context/cookbooks/test-with-deps/recipes/server.rb +0 -0
- data/spec/data/run_context/cookbooks/test-with-deps/resources/resource.rb +1 -0
- data/spec/data/run_context/cookbooks/test/attributes/default.rb +0 -0
- data/spec/data/run_context/cookbooks/test/attributes/george.rb +1 -1
- data/spec/data/run_context/cookbooks/test/definitions/test_res.rb +1 -0
- data/spec/data/run_context/cookbooks/test/providers/provider.rb +1 -0
- data/spec/data/run_context/cookbooks/test/resources/resource.rb +1 -0
- data/spec/data/shef-config.rb +7 -0
- data/spec/functional/dsl/registry_helper_spec.rb +63 -0
- data/spec/functional/knife/cookbook_delete_spec.rb +1 -1
- data/spec/functional/knife/exec_spec.rb +2 -2
- data/spec/functional/knife/ssh_spec.rb +5 -1
- data/spec/functional/resource/cookbook_file_spec.rb +7 -19
- data/spec/functional/resource/directory_spec.rb +4 -0
- data/spec/functional/resource/file_spec.rb +56 -22
- data/spec/functional/resource/link_spec.rb +2 -0
- data/spec/functional/resource/registry_spec.rb +576 -0
- data/spec/functional/resource/remote_directory_spec.rb +142 -36
- data/spec/functional/resource/remote_file_spec.rb +18 -0
- data/spec/functional/resource/template_spec.rb +23 -2
- data/spec/functional/run_lock_spec.rb +106 -0
- data/spec/functional/shell_spec.rb +100 -0
- data/spec/functional/win32/registry_helper_spec.rb +632 -0
- data/spec/spec_helper.rb +5 -29
- data/spec/stress/win32/security_spec.rb +1 -1
- data/spec/support/chef_helpers.rb +0 -2
- data/spec/support/platform_helpers.rb +8 -15
- data/spec/support/shared/functional/directory_resource.rb +84 -22
- data/spec/support/shared/functional/file_resource.rb +169 -71
- data/spec/support/shared/functional/securable_resource.rb +143 -119
- data/spec/support/shared/functional/securable_resource_with_reporting.rb +375 -0
- data/spec/support/shared/unit/file_system_support.rb +110 -0
- data/spec/support/shared/unit/platform_introspector.rb +162 -0
- data/spec/unit/api_client/registration_spec.rb +175 -0
- data/spec/unit/api_client_spec.rb +78 -156
- data/spec/unit/application/apply.rb +84 -0
- data/spec/unit/application/client_spec.rb +1 -37
- data/spec/unit/application/knife_spec.rb +5 -0
- data/spec/unit/application_spec.rb +57 -2
- data/spec/unit/checksum/storage/filesystem_spec.rb +1 -1
- data/spec/unit/chef_fs/diff_spec.rb +328 -0
- data/spec/unit/chef_fs/file_pattern_spec.rb +526 -0
- data/spec/unit/chef_fs/file_system/chef_server_root_dir_spec.rb +237 -0
- data/spec/unit/chef_fs/file_system/cookbooks_dir_spec.rb +568 -0
- data/spec/unit/chef_fs/file_system/data_bags_dir_spec.rb +220 -0
- data/spec/unit/chef_fs/file_system_spec.rb +136 -0
- data/spec/unit/client_spec.rb +124 -33
- data/spec/unit/config_spec.rb +46 -13
- data/spec/unit/cookbook/synchronizer_spec.rb +1 -49
- data/spec/unit/cookbook/syntax_check_spec.rb +48 -109
- data/spec/unit/cookbook_loader_spec.rb +153 -91
- data/spec/unit/cookbook_manifest_spec.rb +81 -81
- data/spec/unit/cookbook_spec.rb +3 -20
- data/spec/unit/cookbook_version_spec.rb +23 -122
- data/spec/unit/daemon_spec.rb +3 -24
- data/spec/unit/data_bag_spec.rb +6 -4
- data/spec/unit/digester_spec.rb +50 -0
- data/spec/unit/dsl/data_query_spec.rb +66 -0
- data/spec/unit/dsl/platform_introspection_spec.rb +130 -0
- data/spec/unit/dsl/regsitry_helper_spec.rb +55 -0
- data/spec/unit/encrypted_data_bag_item_spec.rb +50 -105
- data/spec/unit/environment_spec.rb +0 -130
- data/spec/unit/exceptions_spec.rb +2 -3
- data/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb +3 -3
- data/spec/unit/json_compat_spec.rb +15 -7
- data/spec/unit/knife/bootstrap_spec.rb +2 -0
- data/spec/unit/knife/configure_spec.rb +20 -14
- data/spec/unit/knife/cookbook_metadata_spec.rb +11 -4
- data/spec/unit/knife/cookbook_test_spec.rb +1 -0
- data/spec/unit/knife/cookbook_upload_spec.rb +43 -8
- data/spec/unit/knife/core/bootstrap_context_spec.rb +1 -1
- data/spec/unit/knife/core/ui_spec.rb +156 -125
- data/spec/unit/knife/data_bag_create_spec.rb +9 -0
- data/spec/unit/knife/data_bag_edit_spec.rb +1 -4
- data/spec/unit/knife/data_bag_from_file_spec.rb +4 -6
- data/spec/unit/knife/data_bag_show_spec.rb +11 -4
- data/spec/unit/knife/index_rebuild_spec.rb +96 -33
- data/spec/unit/knife/knife_help.rb +7 -7
- data/spec/unit/knife/node_edit_spec.rb +6 -33
- data/spec/unit/knife/node_run_list_remove_spec.rb +2 -1
- data/spec/unit/knife/ssh_spec.rb +12 -15
- data/spec/unit/knife/status_spec.rb +2 -2
- data/spec/unit/knife_spec.rb +53 -0
- data/spec/unit/lwrp_spec.rb +59 -42
- data/spec/unit/mixin/checksum_spec.rb +2 -2
- data/spec/unit/mixin/deep_merge_spec.rb +101 -799
- data/spec/unit/mixin/enforce_ownership_and_permissions_spec.rb +6 -1
- data/spec/unit/mixin/params_validate_spec.rb +4 -37
- data/spec/unit/mixin/securable_spec.rb +5 -3
- data/spec/unit/mixin/template_spec.rb +119 -0
- data/spec/unit/node/attribute_spec.rb +195 -173
- data/spec/unit/node/immutable_collections_spec.rb +139 -0
- data/spec/unit/node_spec.rb +366 -370
- data/spec/unit/platform_spec.rb +9 -10
- data/spec/unit/provider/breakpoint_spec.rb +8 -8
- data/spec/unit/provider/cookbook_file_spec.rb +4 -8
- data/spec/unit/provider/directory_spec.rb +96 -64
- data/spec/unit/provider/env_spec.rb +2 -2
- data/spec/unit/provider/file_spec.rb +48 -39
- data/spec/unit/provider/group/dscl_spec.rb +0 -36
- data/spec/unit/provider/group/gpasswd_spec.rb +9 -16
- data/spec/unit/provider/group/groupadd_spec.rb +4 -3
- data/spec/unit/provider/group/groupmod_spec.rb +1 -0
- data/spec/unit/provider/group/pw_spec.rb +15 -12
- data/spec/unit/provider/group/usermod_spec.rb +6 -21
- data/spec/unit/provider/group/windows_spec.rb +8 -0
- data/spec/unit/provider/group_spec.rb +6 -28
- data/spec/unit/provider/http_request_spec.rb +28 -69
- data/spec/unit/provider/ifconfig_spec.rb +2 -2
- data/spec/unit/provider/ohai_spec.rb +4 -4
- data/spec/unit/provider/package/apt_spec.rb +0 -1
- data/spec/unit/provider/package/ips_spec.rb +0 -1
- data/spec/unit/provider/package/portage_spec.rb +0 -44
- data/spec/unit/provider/package/rpm_spec.rb +0 -12
- data/spec/unit/provider/package/rubygems_spec.rb +1 -44
- data/spec/unit/provider/package/yum_spec.rb +39 -36
- data/spec/unit/provider/package_spec.rb +7 -5
- data/spec/unit/provider/registry_key_spec.rb +269 -0
- data/spec/unit/provider/remote_directory_spec.rb +7 -3
- data/spec/unit/provider/remote_file_spec.rb +36 -0
- data/spec/unit/provider/route_spec.rb +4 -3
- data/spec/unit/provider/ruby_block_spec.rb +8 -0
- data/spec/unit/provider/service/arch_service_spec.rb +5 -5
- data/spec/unit/provider/service/debian_service_spec.rb +1 -1
- data/spec/unit/provider/service/freebsd_service_spec.rb +5 -5
- data/spec/unit/provider/service/init_service_spec.rb +27 -4
- data/spec/unit/provider/service/insserv_service_spec.rb +1 -1
- data/spec/unit/provider/service/invokercd_service_spec.rb +4 -4
- data/spec/unit/provider/service/macosx_spec.rb +11 -66
- data/spec/unit/provider/service/redhat_spec.rb +1 -1
- data/spec/unit/provider/service/simple_service_spec.rb +3 -3
- data/spec/unit/provider/service/upstart_service_spec.rb +9 -9
- data/spec/unit/provider/subversion_spec.rb +1 -1
- data/spec/unit/provider/template_spec.rb +35 -11
- data/spec/unit/provider/user/dscl_spec.rb +285 -681
- data/spec/unit/provider/user/useradd_spec.rb +1 -22
- data/spec/unit/provider/user_spec.rb +1 -1
- data/spec/unit/recipe_spec.rb +10 -8
- data/spec/unit/registry_helper_spec.rb +374 -0
- data/spec/unit/resource/mount_spec.rb +0 -11
- data/spec/unit/resource/registry_key_spec.rb +171 -0
- data/spec/unit/resource/remote_file_spec.rb +21 -23
- data/spec/unit/resource/ruby_block_spec.rb +7 -3
- data/spec/unit/resource/service_spec.rb +11 -0
- data/spec/unit/resource_spec.rb +4 -19
- data/spec/unit/rest/auth_credentials_spec.rb +2 -19
- data/spec/unit/rest_spec.rb +130 -284
- data/spec/unit/run_context/cookbook_compiler_spec.rb +181 -0
- data/spec/unit/run_context_spec.rb +18 -4
- data/spec/unit/run_list_spec.rb +0 -209
- data/spec/unit/run_lock_spec.rb +37 -0
- data/spec/unit/runner_spec.rb +101 -2
- data/spec/unit/scan_access_control_spec.rb +4 -4
- data/spec/unit/{shef → shell}/model_wrapper_spec.rb +5 -5
- data/spec/unit/{shef/shef_ext_spec.rb → shell/shell_ext_spec.rb} +21 -21
- data/spec/unit/{shef/shef_session_spec.rb → shell/shell_session_spec.rb} +14 -69
- data/spec/unit/shell_out_spec.rb +18 -0
- data/spec/unit/{shef_spec.rb → shell_spec.rb} +20 -20
- metadata +275 -234
- checksums.yaml +0 -15
- data/README.rdoc +0 -177
- data/distro/common/html/knife-recipe.1.html +0 -92
- data/lib/chef/certificate.rb +0 -161
- data/lib/chef/checksum.rb +0 -167
- data/lib/chef/checksum_cache.rb +0 -190
- data/lib/chef/cookbook_version_selector.rb +0 -168
- data/lib/chef/couchdb.rb +0 -246
- data/lib/chef/index_queue/amqp_client.rb +0 -116
- data/lib/chef/index_queue/consumer.rb +0 -76
- data/lib/chef/index_queue/indexable.rb +0 -109
- data/lib/chef/knife/bootstrap/ubuntu12.10-gems.erb +0 -60
- data/lib/chef/monkey_patches/moneta.rb +0 -50
- data/lib/chef/monkey_patches/uri.rb +0 -70
- data/lib/chef/openid_registration.rb +0 -187
- data/lib/chef/provider/user/solaris.rb +0 -90
- data/lib/chef/solr_query.rb +0 -187
- data/lib/chef/solr_query/lucene.treetop +0 -150
- data/lib/chef/solr_query/lucene_nodes.rb +0 -285
- data/lib/chef/solr_query/query_transform.rb +0 -65
- data/lib/chef/solr_query/solr_http_request.rb +0 -132
- data/lib/chef/webui_user.rb +0 -231
- data/spec/data/cookbooks/openldap/files/default/.dotfile +0 -1
- data/spec/data/cookbooks/openldap/files/default/.ssh/id_rsa +0 -1
- data/spec/data/cookbooks/openldap/files/default/remotedir/.a_dotdir/.a_dotfile_in_a_dotdir +0 -1
- data/spec/data/cookbooks/openldap/files/default/remotedir/remotesubdir/.a_dotfile +0 -1
- 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/resource/base.rb +0 -40
- data/spec/functional/resource/group_spec.rb +0 -343
- data/spec/functional/resource/user/dscl_spec.rb +0 -199
- data/spec/unit/certificate_spec.rb +0 -76
- data/spec/unit/checksum_cache_spec.rb +0 -209
- data/spec/unit/checksum_spec.rb +0 -94
- data/spec/unit/couchdb_spec.rb +0 -274
- data/spec/unit/index_queue_spec.rb +0 -391
- data/spec/unit/mixin/language_spec.rb +0 -305
- data/spec/unit/openid_registration_spec.rb +0 -153
- data/spec/unit/provider/user/solaris_spec.rb +0 -414
- data/spec/unit/provider/whyrun_safe_ruby_block_spec.rb +0 -47
- data/spec/unit/solr_query/query_transform_spec.rb +0 -454
- data/spec/unit/solr_query/solr_http_request_spec.rb +0 -244
- data/spec/unit/solr_query_spec.rb +0 -203
- data/spec/unit/webui_user_spec.rb +0 -238
|
@@ -41,7 +41,10 @@ describe Chef::Provider::RemoteDirectory do
|
|
|
41
41
|
Chef::Cookbook::FileVendor.on_create { |manifest| Chef::Cookbook::FileSystemFileVendor.new(manifest, @cookbook_repo) }
|
|
42
42
|
|
|
43
43
|
@node = Chef::Node.new
|
|
44
|
-
|
|
44
|
+
cl = Chef::CookbookLoader.new(@cookbook_repo)
|
|
45
|
+
cl.load_cookbooks
|
|
46
|
+
@cookbook_collection = Chef::CookbookCollection.new(cl)
|
|
47
|
+
|
|
45
48
|
@events = Chef::EventDispatch::Dispatcher.new
|
|
46
49
|
@run_context = Chef::RunContext.new(@node, @cookbook_collection, @events)
|
|
47
50
|
|
|
@@ -103,8 +106,9 @@ describe Chef::Provider::RemoteDirectory do
|
|
|
103
106
|
|
|
104
107
|
describe "when creating the remote directory" do
|
|
105
108
|
before do
|
|
106
|
-
@node[:platform] = :just_testing
|
|
107
|
-
@node[:platform_version] = :just_testing
|
|
109
|
+
@node.automatic_attrs[:platform] = :just_testing
|
|
110
|
+
@node.automatic_attrs[:platform_version] = :just_testing
|
|
111
|
+
|
|
108
112
|
@destination_dir = Dir.mktmpdir << "/remote_directory_test"
|
|
109
113
|
@resource.path(@destination_dir)
|
|
110
114
|
end
|
|
@@ -79,6 +79,42 @@ describe Chef::Provider::RemoteFile, "action_create" do
|
|
|
79
79
|
end
|
|
80
80
|
end
|
|
81
81
|
|
|
82
|
+
shared_examples_for "source specified with multiple URIs" do
|
|
83
|
+
it "should try to download the next URI when the first one fails" do
|
|
84
|
+
@rest.should_receive(:streaming_request).with("http://foo", {}).once.and_raise(SocketError)
|
|
85
|
+
@rest.should_receive(:streaming_request).with("http://bar", {}).once.and_return(@tempfile)
|
|
86
|
+
@provider.run_action(:create)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
it "should raise an exception when all the URIs fail" do
|
|
90
|
+
@rest.should_receive(:streaming_request).with("http://foo", {}).once.and_raise(SocketError)
|
|
91
|
+
@rest.should_receive(:streaming_request).with("http://bar", {}).once.and_raise(SocketError)
|
|
92
|
+
lambda { @provider.run_action(:create) }.should raise_error(SocketError)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
it "should download from only one URI when the first one works" do
|
|
96
|
+
@rest.should_receive(:streaming_request).once.and_return(@tempfile)
|
|
97
|
+
@provider.run_action(:create)
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
describe "and the source specifies multiple URIs using multiple arguments" do
|
|
103
|
+
it_should_behave_like "source specified with multiple URIs"
|
|
104
|
+
|
|
105
|
+
before(:each) do
|
|
106
|
+
@resource.source("http://foo", "http://bar")
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
describe "and the source specifies multiple URIs using an array" do
|
|
111
|
+
it_should_behave_like "source specified with multiple URIs"
|
|
112
|
+
|
|
113
|
+
before(:each) do
|
|
114
|
+
@resource.source([ "http://foo", "http://bar" ])
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
82
118
|
describe "and the resource specifies a checksum" do
|
|
83
119
|
|
|
84
120
|
describe "and the existing file matches the checksum exactly" do
|
|
@@ -51,7 +51,7 @@ describe Chef::Provider::Route do
|
|
|
51
51
|
describe Chef::Provider::Route, "load_current_resource" do
|
|
52
52
|
context "on linux" do
|
|
53
53
|
before do
|
|
54
|
-
@node[:os] = 'linux'
|
|
54
|
+
@node.automatic_attrs[:os] = 'linux'
|
|
55
55
|
routing_table = "Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT\n" +
|
|
56
56
|
"eth0 0064A8C0 0984A8C0 0003 0 0 0 00FFFFFF 0 0 0\n"
|
|
57
57
|
route_file = StringIO.new(routing_table)
|
|
@@ -198,7 +198,7 @@ describe Chef::Provider::Route do
|
|
|
198
198
|
describe Chef::Provider::Route, "generate_config method" do
|
|
199
199
|
%w[ centos redhat fedora ].each do |platform|
|
|
200
200
|
it "should write a route file on #{platform} platform" do
|
|
201
|
-
@node[:platform] = platform
|
|
201
|
+
@node.automatic_attrs[:platform] = platform
|
|
202
202
|
|
|
203
203
|
route_file = StringIO.new
|
|
204
204
|
File.should_receive(:new).with("/etc/sysconfig/network-scripts/route-eth0", "w").and_return(route_file)
|
|
@@ -209,7 +209,8 @@ describe Chef::Provider::Route do
|
|
|
209
209
|
end
|
|
210
210
|
|
|
211
211
|
it "should put all routes for a device in a route config file" do
|
|
212
|
-
@node[:platform] = 'centos'
|
|
212
|
+
@node.automatic_attrs[:platform] = 'centos'
|
|
213
|
+
|
|
213
214
|
route_file = StringIO.new
|
|
214
215
|
File.should_receive(:new).and_return(route_file)
|
|
215
216
|
@run_context.resource_collection << Chef::Resource::Route.new('192.168.1.0/24 via 192.168.0.1')
|
|
@@ -30,6 +30,14 @@ describe Chef::Provider::RubyBlock, "initialize" do
|
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
it "should call the block and flag the resource as updated" do
|
|
33
|
+
@provider.run_action(:run)
|
|
34
|
+
$evil_global_evil_laugh.should == :mwahahaha
|
|
35
|
+
@new_resource.should be_updated
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it "accepts `create' as an alias for `run'" do
|
|
39
|
+
# SEE ALSO: CHEF-3500
|
|
40
|
+
# "create" used to be the default action, it was renamed.
|
|
33
41
|
@provider.run_action(:create)
|
|
34
42
|
$evil_global_evil_laugh.should == :mwahahaha
|
|
35
43
|
@new_resource.should be_updated
|
|
@@ -27,7 +27,7 @@ require 'ostruct'
|
|
|
27
27
|
describe Chef::Provider::Service::Arch, "load_current_resource" do
|
|
28
28
|
before(:each) do
|
|
29
29
|
@node = Chef::Node.new
|
|
30
|
-
@node[:command] = {:ps => "ps -ef"}
|
|
30
|
+
@node.automatic_attrs[:command] = {:ps => "ps -ef"}
|
|
31
31
|
|
|
32
32
|
@events = Chef::EventDispatch::Dispatcher.new
|
|
33
33
|
@run_context = Chef::RunContext.new(@node, {}, @events)
|
|
@@ -62,7 +62,7 @@ describe Chef::Provider::Service::Arch, "load_current_resource" do
|
|
|
62
62
|
@provider.load_current_resource
|
|
63
63
|
end
|
|
64
64
|
|
|
65
|
-
it "should set running to true if the status command returns 0" do
|
|
65
|
+
it "should set running to true if the the status command returns 0" do
|
|
66
66
|
@provider.stub!(:shell_out).with("/etc/rc.d/chef status").and_return(OpenStruct.new(:exitstatus => 0))
|
|
67
67
|
@provider.load_current_resource
|
|
68
68
|
@provider.current_resource.running.should be_true
|
|
@@ -96,14 +96,14 @@ describe Chef::Provider::Service::Arch, "load_current_resource" do
|
|
|
96
96
|
end
|
|
97
97
|
|
|
98
98
|
it "should raise error if the node has a nil ps attribute and no other means to get status" do
|
|
99
|
-
@node[:command] = {:ps => nil}
|
|
99
|
+
@node.automatic_attrs[:command] = {:ps => nil}
|
|
100
100
|
@provider.define_resource_requirements
|
|
101
101
|
@provider.action = :start
|
|
102
102
|
lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Service)
|
|
103
103
|
end
|
|
104
104
|
|
|
105
105
|
it "should raise error if the node has an empty ps attribute and no other means to get status" do
|
|
106
|
-
@node[:command] = {:ps => ""}
|
|
106
|
+
@node.automatic_attrs[:command] = {:ps => ""}
|
|
107
107
|
@provider.define_resource_requirements
|
|
108
108
|
@provider.action = :start
|
|
109
109
|
lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Service)
|
|
@@ -130,7 +130,7 @@ DEFAULT_PS
|
|
|
130
130
|
@status = mock("Status", :exitstatus => 0, :stdout => @stdout)
|
|
131
131
|
@provider.stub!(:shell_out!).and_return(@status)
|
|
132
132
|
|
|
133
|
-
@node[:command] = {:ps => "ps -ef"}
|
|
133
|
+
@node.automatic_attrs[:command] = {:ps => "ps -ef"}
|
|
134
134
|
end
|
|
135
135
|
|
|
136
136
|
it "determines the service is running when it appears in ps" do
|
|
@@ -21,7 +21,7 @@ require 'spec_helper'
|
|
|
21
21
|
describe Chef::Provider::Service::Debian, "load_current_resource" do
|
|
22
22
|
before(:each) do
|
|
23
23
|
@node = Chef::Node.new
|
|
24
|
-
@node[:command] = {:ps => 'fuuuu'}
|
|
24
|
+
@node.automatic_attrs[:command] = {:ps => 'fuuuu'}
|
|
25
25
|
@events = Chef::EventDispatch::Dispatcher.new
|
|
26
26
|
@run_context = Chef::RunContext.new(@node, {}, @events)
|
|
27
27
|
|
|
@@ -21,7 +21,7 @@ require 'spec_helper'
|
|
|
21
21
|
describe Chef::Provider::Service::Freebsd do
|
|
22
22
|
before do
|
|
23
23
|
@node = Chef::Node.new
|
|
24
|
-
@node[:command] = {:ps => "ps -ax"}
|
|
24
|
+
@node.automatic_attrs[:command] = {:ps => "ps -ax"}
|
|
25
25
|
@events = Chef::EventDispatch::Dispatcher.new
|
|
26
26
|
@run_context = Chef::RunContext.new(@node, {}, @events)
|
|
27
27
|
|
|
@@ -88,7 +88,7 @@ RC_SAMPLE
|
|
|
88
88
|
@provider.load_current_resource
|
|
89
89
|
end
|
|
90
90
|
|
|
91
|
-
it "should set running to true if the status command returns 0" do
|
|
91
|
+
it "should set running to true if the the status command returns 0" do
|
|
92
92
|
@provider.should_receive(:shell_out).with("/usr/local/etc/rc.d/#{@current_resource.service_name} status").and_return(@status)
|
|
93
93
|
@current_resource.should_receive(:running).with(true)
|
|
94
94
|
@provider.load_current_resource
|
|
@@ -115,13 +115,13 @@ RC_SAMPLE
|
|
|
115
115
|
end
|
|
116
116
|
|
|
117
117
|
it "should raise error if the node has a nil ps attribute and no other means to get status" do
|
|
118
|
-
@node[:command] = {:ps => nil}
|
|
118
|
+
@node.automatic_attrs[:command] = {:ps => nil}
|
|
119
119
|
@provider.define_resource_requirements
|
|
120
120
|
lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Service)
|
|
121
121
|
end
|
|
122
122
|
|
|
123
123
|
it "should raise error if the node has an empty ps attribute and no other means to get status" do
|
|
124
|
-
@node[:command] = {:ps => ""}
|
|
124
|
+
@node.automatic_attrs[:command] = {:ps => ""}
|
|
125
125
|
@provider.define_resource_requirements
|
|
126
126
|
lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Service)
|
|
127
127
|
end
|
|
@@ -180,7 +180,7 @@ RC_SAMPLE
|
|
|
180
180
|
|
|
181
181
|
describe "when we have a 'ps' attribute" do
|
|
182
182
|
before do
|
|
183
|
-
@node[:command] = {:ps => "ps -ax"}
|
|
183
|
+
@node.automatic_attrs[:command] = {:ps => "ps -ax"}
|
|
184
184
|
end
|
|
185
185
|
|
|
186
186
|
it "should shell_out! the node's ps command" do
|
|
@@ -21,7 +21,7 @@ require 'spec_helper'
|
|
|
21
21
|
describe Chef::Provider::Service::Init, "load_current_resource" do
|
|
22
22
|
before(:each) do
|
|
23
23
|
@node = Chef::Node.new
|
|
24
|
-
@node[:command] = {:ps => "ps -ef"}
|
|
24
|
+
@node.automatic_attrs[:command] = {:ps => "ps -ef"}
|
|
25
25
|
@events = Chef::EventDispatch::Dispatcher.new
|
|
26
26
|
@run_context = Chef::RunContext.new(@node, {}, @events)
|
|
27
27
|
|
|
@@ -61,7 +61,7 @@ PS
|
|
|
61
61
|
@provider.load_current_resource
|
|
62
62
|
end
|
|
63
63
|
|
|
64
|
-
it "should set running to true if the status command returns 0" do
|
|
64
|
+
it "should set running to true if the the status command returns 0" do
|
|
65
65
|
@provider.stub!(:shell_out).with("/etc/init.d/#{@current_resource.service_name} status").and_return(@status)
|
|
66
66
|
@provider.load_current_resource
|
|
67
67
|
@current_resource.running.should be_true
|
|
@@ -93,10 +93,23 @@ PS
|
|
|
93
93
|
|
|
94
94
|
end
|
|
95
95
|
|
|
96
|
+
describe "when an init command has been specified" do
|
|
97
|
+
before do
|
|
98
|
+
@new_resource.stub!(:init_command).and_return("/opt/chef-server/service/erchef")
|
|
99
|
+
@provider = Chef::Provider::Service::Init.new(@new_resource, @run_context)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
it "should use the init_command if one has been specified" do
|
|
103
|
+
@provider.should_receive(:shell_out!).with("/opt/chef-server/service/erchef start")
|
|
104
|
+
@provider.start_service
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
end
|
|
108
|
+
|
|
96
109
|
describe "when the node has not specified a ps command" do
|
|
97
110
|
|
|
98
111
|
it "should raise an error if the node has a nil ps attribute" do
|
|
99
|
-
@node[:command] = {:ps => nil}
|
|
112
|
+
@node.automatic_attrs[:command] = {:ps => nil}
|
|
100
113
|
@provider.load_current_resource
|
|
101
114
|
@provider.action = :start
|
|
102
115
|
@provider.define_resource_requirements
|
|
@@ -104,7 +117,7 @@ PS
|
|
|
104
117
|
end
|
|
105
118
|
|
|
106
119
|
it "should raise an error if the node has an empty ps attribute" do
|
|
107
|
-
@node[:command] = {:ps => ""}
|
|
120
|
+
@node.automatic_attrs[:command] = {:ps => ""}
|
|
108
121
|
@provider.load_current_resource
|
|
109
122
|
@provider.action = :start
|
|
110
123
|
@provider.define_resource_requirements
|
|
@@ -209,4 +222,14 @@ RUNNING_PS
|
|
|
209
222
|
@provider.reload_service()
|
|
210
223
|
end
|
|
211
224
|
end
|
|
225
|
+
|
|
226
|
+
describe "when a custom command has been specified" do
|
|
227
|
+
before do
|
|
228
|
+
@new_resource.start_command("/etc/init.d/chef startyousillysally")
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
it "should still pass all why run assertions" do
|
|
232
|
+
lambda { @provider.run_action(:start) }.should_not raise_error(Chef::Exceptions::Service)
|
|
233
|
+
end
|
|
234
|
+
end
|
|
212
235
|
end
|
|
@@ -23,7 +23,7 @@ describe Chef::Provider::Service::Insserv do
|
|
|
23
23
|
@node = Chef::Node.new
|
|
24
24
|
@events = Chef::EventDispatch::Dispatcher.new
|
|
25
25
|
@run_context = Chef::RunContext.new(@node, {}, @events)
|
|
26
|
-
@node[:command] = {:ps => "ps -ax"}
|
|
26
|
+
@node.automatic_attrs[:command] = {:ps => "ps -ax"}
|
|
27
27
|
|
|
28
28
|
@new_resource = Chef::Resource::Service.new("initgrediant")
|
|
29
29
|
@current_resource = Chef::Resource::Service.new("initgrediant")
|
|
@@ -21,7 +21,7 @@ require 'spec_helper'
|
|
|
21
21
|
describe Chef::Provider::Service::Invokercd, "load_current_resource" do
|
|
22
22
|
before(:each) do
|
|
23
23
|
@node = Chef::Node.new
|
|
24
|
-
@node[:command] = {:ps => "ps -ef"}
|
|
24
|
+
@node.automatic_attrs[:command] = {:ps => "ps -ef"}
|
|
25
25
|
@events = Chef::EventDispatch::Dispatcher.new
|
|
26
26
|
@run_context = Chef::RunContext.new(@node, {}, @events)
|
|
27
27
|
|
|
@@ -61,7 +61,7 @@ PS
|
|
|
61
61
|
@provider.load_current_resource
|
|
62
62
|
end
|
|
63
63
|
|
|
64
|
-
it "should set running to true if the status command returns 0" do
|
|
64
|
+
it "should set running to true if the the status command returns 0" do
|
|
65
65
|
@provider.stub!(:shell_out).with("/usr/sbin/invoke-rc.d #{@current_resource.service_name} status").and_return(@status)
|
|
66
66
|
@provider.load_current_resource
|
|
67
67
|
@current_resource.running.should be_true
|
|
@@ -95,14 +95,14 @@ PS
|
|
|
95
95
|
|
|
96
96
|
describe "when the node has not specified a ps command" do
|
|
97
97
|
it "should raise error if the node has a nil ps attribute and no other means to get status" do
|
|
98
|
-
@node[:command] = {:ps => nil}
|
|
98
|
+
@node.automatic_attrs[:command] = {:ps => nil}
|
|
99
99
|
@provider.action = :start
|
|
100
100
|
@provider.define_resource_requirements
|
|
101
101
|
lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Service)
|
|
102
102
|
end
|
|
103
103
|
|
|
104
104
|
it "should raise error if the node has an empty ps attribute and no other means to get status" do
|
|
105
|
-
@node[:command] = {:ps => ""}
|
|
105
|
+
@node.automatic_attrs[:command] = {:ps => ""}
|
|
106
106
|
@provider.action = :start
|
|
107
107
|
@provider.define_resource_requirements
|
|
108
108
|
lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Service)
|
|
@@ -23,31 +23,13 @@ describe Chef::Provider::Service::Macosx do
|
|
|
23
23
|
let(:events) {Chef::EventDispatch::Dispatcher.new}
|
|
24
24
|
let(:run_context) { Chef::RunContext.new(node, {}, events) }
|
|
25
25
|
let(:provider) { described_class.new(new_resource, run_context) }
|
|
26
|
-
let(:
|
|
27
|
-
let(:plutil_stdout) { String.new <<-XML }
|
|
28
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
29
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
30
|
-
<plist version="1.0">
|
|
31
|
-
<dict>
|
|
32
|
-
<key>Label</key>
|
|
33
|
-
<string>io.redis.redis-server</string>
|
|
34
|
-
</dict>
|
|
35
|
-
</plist>
|
|
36
|
-
XML
|
|
26
|
+
let(:stdout) { StringIO.new }
|
|
37
27
|
|
|
38
28
|
before do
|
|
39
29
|
Dir.stub!(:glob).and_return(["/Users/igor/Library/LaunchAgents/io.redis.redis-server.plist"], [])
|
|
40
30
|
provider.stub!(:shell_out!).
|
|
41
31
|
with("launchctl list", {:group => 1001, :user => 101}).
|
|
42
|
-
and_return(mock("
|
|
43
|
-
provider.stub!(:shell_out).
|
|
44
|
-
with(/launchctl list /,
|
|
45
|
-
{:group => nil, :user => nil}).
|
|
46
|
-
and_return(mock("Status",
|
|
47
|
-
:stdout => launchctl_stdout, :exitstatus => 0))
|
|
48
|
-
provider.stub!(:shell_out!).
|
|
49
|
-
with(/plutil -convert xml1 -o/).
|
|
50
|
-
and_return(mock("Status", :stdout => plutil_stdout))
|
|
32
|
+
and_return(mock("ouput", :stdout => stdout))
|
|
51
33
|
|
|
52
34
|
File.stub!(:stat).and_return(mock("stat", :gid => 1001, :uid => 101))
|
|
53
35
|
end
|
|
@@ -58,45 +40,8 @@ XML
|
|
|
58
40
|
let!(:current_resource) { Chef::Resource::Service.new(service_name) }
|
|
59
41
|
|
|
60
42
|
describe "#load_current_resource" do
|
|
61
|
-
|
|
62
|
-
# CHEF-5223 "you can't glob for a file that hasn't been converged
|
|
63
|
-
# onto the node yet."
|
|
64
|
-
context "when the plist doesn't exist" do
|
|
65
|
-
|
|
66
|
-
def run_resource_setup_for_action(action)
|
|
67
|
-
new_resource.action(action)
|
|
68
|
-
provider.action = action
|
|
69
|
-
provider.load_current_resource
|
|
70
|
-
provider.define_resource_requirements
|
|
71
|
-
provider.process_resource_requirements
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
before do
|
|
75
|
-
Dir.stub(:glob).and_return([])
|
|
76
|
-
provider.stub(:shell_out!).
|
|
77
|
-
with(/plutil -convert xml1 -o/).
|
|
78
|
-
and_raise(Mixlib::ShellOut::ShellCommandFailed)
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
it "works for action :nothing" do
|
|
82
|
-
lambda { run_resource_setup_for_action(:nothing) }.should_not raise_error
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
it "works for action :start" do
|
|
86
|
-
lambda { run_resource_setup_for_action(:start) }.should_not raise_error
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
it "errors if action is :enable" do
|
|
90
|
-
lambda { run_resource_setup_for_action(:enable) }.should raise_error(Chef::Exceptions::Service)
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
it "errors if action is :disable" do
|
|
94
|
-
lambda { run_resource_setup_for_action(:disable) }.should raise_error(Chef::Exceptions::Service)
|
|
95
|
-
end
|
|
96
|
-
end
|
|
97
|
-
|
|
98
43
|
context "when launchctl returns pid in service list" do
|
|
99
|
-
let(:
|
|
44
|
+
let(:stdout) { StringIO.new <<-SVC_LIST }
|
|
100
45
|
12761 - 0x100114220.old.machinit.thing
|
|
101
46
|
7777 - io.redis.redis-server
|
|
102
47
|
- - com.lol.stopped-thing
|
|
@@ -116,21 +61,21 @@ SVC_LIST
|
|
|
116
61
|
end
|
|
117
62
|
|
|
118
63
|
describe "running unsupported actions" do
|
|
119
|
-
let(:launchctl_stdout) { StringIO.new <<-SVC_LIST }
|
|
120
|
-
12761 - 0x100114220.old.machinit.thing
|
|
121
|
-
7777 - io.redis.redis-server
|
|
122
|
-
- - com.lol.stopped-thing
|
|
123
|
-
SVC_LIST
|
|
124
|
-
|
|
125
64
|
before do
|
|
126
65
|
Dir.stub!(:glob).and_return(["/Users/igor/Library/LaunchAgents/io.redis.redis-server.plist"], [])
|
|
127
66
|
end
|
|
67
|
+
it "should throw an exception when enable action is attempted" do
|
|
68
|
+
lambda {provider.run_action(:enable)}.should raise_error(Chef::Exceptions::UnsupportedAction)
|
|
69
|
+
end
|
|
128
70
|
it "should throw an exception when reload action is attempted" do
|
|
129
71
|
lambda {provider.run_action(:reload)}.should raise_error(Chef::Exceptions::UnsupportedAction)
|
|
130
72
|
end
|
|
73
|
+
it "should throw an exception when disable action is attempted" do
|
|
74
|
+
lambda {provider.run_action(:disable)}.should raise_error(Chef::Exceptions::UnsupportedAction)
|
|
75
|
+
end
|
|
131
76
|
end
|
|
132
77
|
context "when launchctl returns empty service pid" do
|
|
133
|
-
let(:
|
|
78
|
+
let(:stdout) { StringIO.new <<-SVC_LIST }
|
|
134
79
|
12761 - 0x100114220.old.machinit.thing
|
|
135
80
|
- - io.redis.redis-server
|
|
136
81
|
- - com.lol.stopped-thing
|
|
@@ -150,7 +95,7 @@ SVC_LIST
|
|
|
150
95
|
end
|
|
151
96
|
|
|
152
97
|
context "when launchctl doesn't return service entry at all" do
|
|
153
|
-
let(:
|
|
98
|
+
let(:stdout) { StringIO.new <<-SVC_LIST }
|
|
154
99
|
12761 - 0x100114220.old.machinit.thing
|
|
155
100
|
- - com.lol.stopped-thing
|
|
156
101
|
SVC_LIST
|
|
@@ -44,7 +44,7 @@ describe "Chef::Provider::Service::Redhat" do
|
|
|
44
44
|
|
|
45
45
|
before(:each) do
|
|
46
46
|
@node = Chef::Node.new
|
|
47
|
-
@node[:command] = {:ps => 'foo'}
|
|
47
|
+
@node.automatic_attrs[:command] = {:ps => 'foo'}
|
|
48
48
|
@events = Chef::EventDispatch::Dispatcher.new
|
|
49
49
|
@run_context = Chef::RunContext.new(@node, {}, @events)
|
|
50
50
|
|
|
@@ -21,7 +21,7 @@ require 'spec_helper'
|
|
|
21
21
|
describe Chef::Provider::Service::Simple, "load_current_resource" do
|
|
22
22
|
before(:each) do
|
|
23
23
|
@node = Chef::Node.new
|
|
24
|
-
@node[:command] = {:ps => "ps -ef"}
|
|
24
|
+
@node.automatic_attrs[:command] = {:ps => "ps -ef"}
|
|
25
25
|
@events = Chef::EventDispatch::Dispatcher.new
|
|
26
26
|
@run_context = Chef::RunContext.new(@node, {}, @events)
|
|
27
27
|
|
|
@@ -51,13 +51,13 @@ NOMOCKINGSTRINGSPLZ
|
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
it "should raise error if the node has a nil ps attribute and no other means to get status" do
|
|
54
|
-
@node[:command] = {:ps => nil}
|
|
54
|
+
@node.automatic_attrs[:command] = {:ps => nil}
|
|
55
55
|
@provider.define_resource_requirements
|
|
56
56
|
lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Service)
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
it "should raise error if the node has an empty ps attribute and no other means to get status" do
|
|
60
|
-
@node[:command] = {:ps => ""}
|
|
60
|
+
@node.automatic_attrs[:command] = {:ps => ""}
|
|
61
61
|
@provider.define_resource_requirements
|
|
62
62
|
lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Service)
|
|
63
63
|
end
|