chef 11.10.0.rc.0-x86-mingw32 → 11.10.0.rc.1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +0 -75
- data/distro/common/html/_sources/ctl_chef_client.txt +36 -0
- data/distro/common/html/_sources/ctl_chef_server.txt +26 -0
- data/distro/common/html/_sources/ctl_chef_shell.txt +15 -0
- data/distro/common/html/_sources/ctl_chef_solo.txt +25 -0
- data/distro/common/html/_sources/index.txt +126 -0
- data/distro/common/html/_sources/knife.txt +74 -0
- data/distro/common/html/_sources/knife_bootstrap.txt +56 -0
- data/distro/common/html/_sources/knife_client.txt +151 -0
- data/distro/common/html/_sources/knife_common_options.txt +6 -0
- data/distro/common/html/_sources/knife_configure.txt +29 -0
- data/distro/common/html/_sources/knife_cookbook.txt +236 -0
- data/distro/common/html/_sources/knife_cookbook_site.txt +157 -0
- data/distro/common/html/_sources/knife_data_bag.txt +160 -0
- data/distro/common/html/_sources/knife_delete.txt +26 -0
- data/distro/common/html/_sources/knife_deps.txt +61 -0
- data/distro/common/html/_sources/knife_diff.txt +34 -0
- data/distro/common/html/_sources/knife_download.txt +44 -0
- data/distro/common/html/_sources/knife_edit.txt +26 -0
- data/distro/common/html/_sources/knife_environment.txt +158 -0
- data/distro/common/html/_sources/knife_exec.txt +47 -0
- data/distro/common/html/_sources/knife_index_rebuild.txt +21 -0
- data/distro/common/html/_sources/knife_list.txt +33 -0
- data/distro/common/html/_sources/knife_node.txt +250 -0
- data/distro/common/html/_sources/knife_raw.txt +35 -0
- data/distro/common/html/_sources/knife_recipe_list.txt +23 -0
- data/distro/common/html/_sources/knife_role.txt +157 -0
- data/distro/common/html/_sources/knife_search.txt +53 -0
- data/distro/common/html/_sources/knife_show.txt +27 -0
- data/distro/common/html/_sources/knife_ssh.txt +43 -0
- data/distro/common/html/_sources/knife_status.txt +37 -0
- data/distro/common/html/_sources/knife_tag.txt +69 -0
- data/distro/common/html/_sources/knife_upload.txt +49 -0
- data/distro/common/html/_sources/knife_user.txt +127 -0
- data/distro/common/html/_sources/knife_using.txt +43 -0
- data/distro/common/html/_sources/knife_xargs.txt +30 -0
- data/distro/common/html/_static/ajax-loader.gif +0 -0
- data/distro/common/html/_static/basic.css +540 -0
- data/distro/common/html/_static/chef.css +507 -0
- data/distro/common/html/_static/chef.ico +0 -0
- data/distro/common/html/_static/chef_html_logo.png +0 -0
- data/distro/common/html/_static/chef_logo.png +0 -0
- data/distro/common/html/_static/comment-bright.png +0 -0
- data/distro/common/html/_static/comment-close.png +0 -0
- data/distro/common/html/_static/comment.png +0 -0
- data/distro/common/html/_static/contents.png +0 -0
- data/distro/common/html/_static/doctools.js +247 -0
- data/distro/common/html/_static/down-pressed.png +0 -0
- data/distro/common/html/_static/down.png +0 -0
- data/distro/common/html/_static/file.png +0 -0
- data/distro/common/html/_static/guide.css +505 -0
- data/distro/common/html/_static/jquery.js +154 -0
- data/distro/common/html/_static/minus.png +0 -0
- data/distro/common/html/_static/navigation.png +0 -0
- data/distro/common/html/_static/plus.png +0 -0
- data/distro/common/html/_static/pygments.css +62 -0
- data/distro/common/html/_static/searchtools.js +560 -0
- data/distro/common/html/_static/underscore.js +23 -0
- data/distro/common/html/_static/up-pressed.png +0 -0
- data/distro/common/html/_static/up.png +0 -0
- data/distro/common/html/_static/websupport.js +808 -0
- data/distro/common/html/ctl_chef_client.html +219 -0
- data/distro/common/html/ctl_chef_server.html +111 -0
- data/distro/common/html/ctl_chef_shell.html +120 -0
- data/distro/common/html/ctl_chef_solo.html +144 -0
- data/distro/common/html/index.html +185 -0
- data/distro/common/html/knife.html +172 -0
- data/distro/common/html/knife_bootstrap.html +250 -0
- data/distro/common/html/knife_client.html +283 -0
- data/distro/common/html/knife_common_options.html +98 -0
- data/distro/common/html/knife_configure.html +107 -0
- data/distro/common/html/knife_cookbook.html +481 -0
- data/distro/common/html/knife_cookbook_site.html +372 -0
- data/distro/common/html/knife_data_bag.html +359 -0
- data/distro/common/html/knife_delete.html +95 -0
- data/distro/common/html/knife_deps.html +145 -0
- data/distro/common/html/knife_diff.html +125 -0
- data/distro/common/html/knife_download.html +147 -0
- data/distro/common/html/knife_edit.html +91 -0
- data/distro/common/html/knife_environment.html +328 -0
- data/distro/common/html/knife_exec.html +222 -0
- data/distro/common/html/knife_index_rebuild.html +85 -0
- data/distro/common/html/knife_list.html +116 -0
- data/distro/common/html/knife_node.html +450 -0
- data/distro/common/html/knife_raw.html +112 -0
- data/distro/common/html/knife_recipe_list.html +93 -0
- data/distro/common/html/knife_role.html +295 -0
- data/distro/common/html/knife_search.html +204 -0
- data/distro/common/html/knife_show.html +106 -0
- data/distro/common/html/knife_ssh.html +179 -0
- data/distro/common/html/knife_status.html +142 -0
- data/distro/common/html/knife_tag.html +140 -0
- data/distro/common/html/knife_upload.html +155 -0
- data/distro/common/html/knife_user.html +244 -0
- data/distro/common/html/knife_using.html +211 -0
- data/distro/common/html/knife_xargs.html +115 -0
- data/distro/common/html/objects.inv +0 -0
- data/distro/common/html/search.html +84 -0
- data/distro/common/html/searchindex.js +1 -0
- data/distro/common/man/man1/chef-shell.1 +5 -5
- data/distro/common/man/man1/knife-bootstrap.1 +6 -9
- data/distro/common/man/man1/knife-client.1 +1 -9
- data/distro/common/man/man1/knife-configure.1 +10 -6
- data/distro/common/man/man1/knife-cookbook-site.1 +1 -9
- data/distro/common/man/man1/knife-cookbook.1 +11 -21
- data/distro/common/man/man1/knife-data-bag.1 +8 -22
- data/distro/common/man/man1/knife-delete.1 +1 -1
- data/distro/common/man/man1/knife-deps.1 +4 -12
- data/distro/common/man/man1/knife-diff.1 +1 -1
- data/distro/common/man/man1/knife-download.1 +2 -2
- data/distro/common/man/man1/knife-edit.1 +1 -1
- data/distro/common/man/man1/knife-environment.1 +108 -9
- data/distro/common/man/man1/knife-exec.1 +1 -15
- data/distro/common/man/man1/knife-index-rebuild.1 +1 -1
- data/distro/common/man/man1/knife-list.1 +1 -1
- data/distro/common/man/man1/knife-node.1 +3 -13
- data/distro/common/man/man1/knife-raw.1 +1 -1
- data/distro/common/man/man1/knife-recipe-list.1 +1 -1
- data/distro/common/man/man1/knife-role.1 +2 -12
- data/distro/common/man/man1/knife-search.1 +5 -5
- data/distro/common/man/man1/knife-show.1 +1 -3
- data/distro/common/man/man1/knife-ssh.1 +1 -5
- data/distro/common/man/man1/knife-status.1 +1 -1
- data/distro/common/man/man1/knife-tag.1 +1 -9
- data/distro/common/man/man1/knife-upload.1 +7 -9
- data/distro/common/man/man1/knife-user.1 +3 -17
- data/distro/common/man/man1/knife-xargs.1 +1 -3
- data/distro/common/man/man8/chef-client.8 +18 -18
- data/distro/common/man/man8/chef-solo.8 +12 -6
- data/lib/chef/client.rb +9 -5
- data/lib/chef/cookbook_uploader.rb +1 -1
- data/lib/chef/dsl/recipe.rb +119 -38
- data/lib/chef/exceptions.rb +4 -0
- data/lib/chef/policy_builder/expand_node_object.rb +11 -4
- data/lib/chef/policy_builder/policyfile.rb +7 -1
- data/lib/chef/provider/file.rb +1 -0
- data/lib/chef/resource_platform_map.rb +1 -1
- data/lib/chef/resource_reporter.rb +2 -2
- data/lib/chef/version.rb +1 -1
- data/spec/functional/knife/cookbook_delete_spec.rb +9 -9
- data/spec/functional/knife/ssh_spec.rb +1 -1
- data/spec/functional/resource/link_spec.rb +6 -6
- data/spec/functional/resource/registry_spec.rb +7 -7
- data/spec/functional/run_lock_spec.rb +1 -1
- data/spec/integration/knife/download_spec.rb +1 -1
- data/spec/integration/solo/solo_spec.rb +1 -1
- data/spec/spec_helper.rb +0 -1
- data/spec/stress/win32/file_spec.rb +6 -0
- data/spec/support/lib/chef/resource/zen_master.rb +1 -1
- data/spec/support/mock/platform.rb +1 -1
- data/spec/support/shared/functional/file_resource.rb +0 -2
- data/spec/support/shared/functional/securable_resource.rb +2 -2
- data/spec/support/shared/unit/api_error_inspector.rb +7 -7
- data/spec/support/shared/unit/provider/file.rb +47 -8
- data/spec/support/shared/unit/provider/useradd_based_user_provider.rb +23 -23
- data/spec/unit/api_client/registration_spec.rb +5 -5
- data/spec/unit/api_client_spec.rb +2 -2
- data/spec/unit/application/apply.rb +6 -6
- data/spec/unit/application/client_spec.rb +6 -6
- data/spec/unit/application/knife_spec.rb +5 -5
- data/spec/unit/application/solo_spec.rb +13 -13
- data/spec/unit/application_spec.rb +19 -19
- data/spec/unit/checksum/storage/filesystem_spec.rb +2 -2
- data/spec/unit/client_spec.rb +23 -23
- data/spec/unit/config_spec.rb +4 -4
- data/spec/unit/cookbook/metadata_spec.rb +22 -22
- data/spec/unit/cookbook/synchronizer_spec.rb +17 -17
- data/spec/unit/daemon_spec.rb +21 -22
- data/spec/unit/data_bag_item_spec.rb +8 -8
- data/spec/unit/data_bag_spec.rb +6 -6
- data/spec/unit/deprecation_spec.rb +1 -1
- data/spec/unit/dsl/data_query_spec.rb +1 -1
- data/spec/unit/environment_spec.rb +5 -5
- data/spec/unit/file_access_control_spec.rb +5 -5
- data/spec/unit/file_cache_spec.rb +1 -1
- data/spec/unit/file_content_management/deploy/mv_unix_spec.rb +1 -1
- data/spec/unit/file_content_management/deploy/mv_windows_spec.rb +12 -12
- data/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb +4 -4
- data/spec/unit/formatters/error_inspectors/cookbook_resolve_error_inspector_spec.rb +4 -4
- data/spec/unit/formatters/error_inspectors/cookbook_sync_error_inspector_spec.rb +1 -1
- data/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb +6 -6
- data/spec/unit/formatters/error_inspectors/run_list_expansion_error_inspector_spec.rb +4 -4
- data/spec/unit/handler/json_file_spec.rb +1 -1
- data/spec/unit/handler_spec.rb +3 -3
- data/spec/unit/knife/bootstrap_spec.rb +17 -17
- data/spec/unit/knife/client_bulk_delete_spec.rb +4 -4
- data/spec/unit/knife/client_create_spec.rb +7 -7
- data/spec/unit/knife/client_reregister_spec.rb +2 -2
- data/spec/unit/knife/client_show_spec.rb +1 -1
- data/spec/unit/knife/config_file_selection_spec.rb +4 -4
- data/spec/unit/knife/configure_client_spec.rb +4 -4
- data/spec/unit/knife/configure_spec.rb +16 -16
- data/spec/unit/knife/cookbook_bulk_delete_spec.rb +10 -10
- data/spec/unit/knife/cookbook_create_spec.rb +5 -5
- data/spec/unit/knife/cookbook_delete_spec.rb +6 -6
- data/spec/unit/knife/cookbook_download_spec.rb +10 -10
- data/spec/unit/knife/cookbook_list_spec.rb +3 -3
- data/spec/unit/knife/cookbook_metadata_from_file_spec.rb +2 -2
- data/spec/unit/knife/cookbook_metadata_spec.rb +8 -8
- data/spec/unit/knife/cookbook_show_spec.rb +4 -4
- data/spec/unit/knife/cookbook_site_download_spec.rb +3 -3
- data/spec/unit/knife/cookbook_site_install_spec.rb +8 -8
- data/spec/unit/knife/cookbook_site_share_spec.rb +22 -22
- data/spec/unit/knife/cookbook_site_unshare_spec.rb +8 -8
- data/spec/unit/knife/cookbook_test_spec.rb +7 -7
- data/spec/unit/knife/cookbook_upload_spec.rb +20 -20
- data/spec/unit/knife/core/cookbook_scm_repo_spec.rb +6 -6
- data/spec/unit/knife/core/object_loader_spec.rb +1 -1
- data/spec/unit/knife/core/ui_spec.rb +19 -21
- data/spec/unit/knife/data_bag_create_spec.rb +4 -4
- data/spec/unit/knife/data_bag_edit_spec.rb +7 -7
- data/spec/unit/knife/data_bag_from_file_spec.rb +15 -15
- data/spec/unit/knife/data_bag_show_spec.rb +5 -5
- data/spec/unit/knife/environment_create_spec.rb +6 -6
- data/spec/unit/knife/environment_delete_spec.rb +6 -6
- data/spec/unit/knife/environment_edit_spec.rb +5 -5
- data/spec/unit/knife/environment_from_file_spec.rb +7 -7
- data/spec/unit/knife/environment_list_spec.rb +4 -4
- data/spec/unit/knife/environment_show_spec.rb +4 -4
- data/spec/unit/knife/index_rebuild_spec.rb +2 -2
- data/spec/unit/knife/knife_help.rb +11 -11
- data/spec/unit/knife/node_bulk_delete_spec.rb +4 -4
- data/spec/unit/knife/node_delete_spec.rb +5 -5
- data/spec/unit/knife/node_edit_spec.rb +2 -2
- data/spec/unit/knife/node_from_file_spec.rb +5 -5
- data/spec/unit/knife/node_list_spec.rb +3 -3
- data/spec/unit/knife/node_run_list_add_spec.rb +3 -3
- data/spec/unit/knife/node_run_list_remove_spec.rb +4 -4
- data/spec/unit/knife/node_run_list_set_spec.rb +5 -5
- data/spec/unit/knife/node_show_spec.rb +2 -2
- data/spec/unit/knife/role_bulk_delete_spec.rb +4 -4
- data/spec/unit/knife/role_create_spec.rb +5 -5
- data/spec/unit/knife/role_delete_spec.rb +5 -5
- data/spec/unit/knife/role_edit_spec.rb +5 -5
- data/spec/unit/knife/role_from_file_spec.rb +5 -5
- data/spec/unit/knife/role_list_spec.rb +2 -2
- data/spec/unit/knife/ssh_spec.rb +6 -6
- data/spec/unit/knife/status_spec.rb +4 -4
- data/spec/unit/knife/tag_create_spec.rb +3 -3
- data/spec/unit/knife/tag_delete_spec.rb +3 -3
- data/spec/unit/knife/tag_list_spec.rb +2 -2
- data/spec/unit/knife/user_create_spec.rb +7 -7
- data/spec/unit/knife/user_reregister_spec.rb +3 -3
- data/spec/unit/knife/user_show_spec.rb +1 -1
- data/spec/unit/knife_spec.rb +29 -29
- data/spec/unit/lwrp_spec.rb +2 -2
- data/spec/unit/mixin/checksum_spec.rb +2 -2
- data/spec/unit/mixin/command_spec.rb +1 -1
- data/spec/unit/mixin/enforce_ownership_and_permissions_spec.rb +4 -4
- data/spec/unit/mixin/params_validate_spec.rb +17 -17
- data/spec/unit/mixin/path_sanity_spec.rb +8 -8
- data/spec/unit/mixin/securable_spec.rb +87 -87
- data/spec/unit/mixin/shell_out_spec.rb +1 -1
- data/spec/unit/mixin/template_spec.rb +2 -2
- data/spec/unit/node/attribute_spec.rb +3 -3
- data/spec/unit/node_spec.rb +12 -12
- data/spec/unit/platform_spec.rb +1 -1
- data/spec/unit/policy_builder/expand_node_object_spec.rb +16 -0
- data/spec/unit/policy_builder/policyfile_spec.rb +4 -0
- data/spec/unit/provider/breakpoint_spec.rb +8 -8
- data/spec/unit/provider/cookbook_file/content_spec.rb +4 -4
- data/spec/unit/provider/cookbook_file_spec.rb +1 -1
- data/spec/unit/provider/cron/unix_spec.rb +11 -11
- data/spec/unit/provider/cron_spec.rb +40 -40
- data/spec/unit/provider/deploy/revision_spec.rb +11 -12
- data/spec/unit/provider/deploy/timestamped_spec.rb +3 -3
- data/spec/unit/provider/deploy_spec.rb +50 -50
- data/spec/unit/provider/directory_spec.rb +18 -18
- data/spec/unit/provider/env_spec.rb +15 -15
- data/spec/unit/provider/erl_call_spec.rb +1 -1
- data/spec/unit/provider/execute_spec.rb +5 -5
- data/spec/unit/provider/file/content_spec.rb +5 -5
- data/spec/unit/provider/file_spec.rb +1 -1
- data/spec/unit/provider/git_spec.rb +47 -47
- data/spec/unit/provider/group/dscl_spec.rb +16 -15
- data/spec/unit/provider/group/gpasswd_spec.rb +6 -5
- data/spec/unit/provider/group/groupadd_spec.rb +10 -10
- data/spec/unit/provider/group/groupmod_spec.rb +3 -3
- data/spec/unit/provider/group/pw_spec.rb +9 -8
- data/spec/unit/provider/group/usermod_spec.rb +13 -12
- data/spec/unit/provider/group/windows_spec.rb +9 -9
- data/spec/unit/provider/group_spec.rb +31 -31
- data/spec/unit/provider/http_request_spec.rb +3 -3
- data/spec/unit/provider/ifconfig/aix_spec.rb +7 -7
- data/spec/unit/provider/ifconfig/debian_spec.rb +3 -3
- data/spec/unit/provider/ifconfig/redhat_spec.rb +5 -5
- data/spec/unit/provider/ifconfig_spec.rb +13 -13
- data/spec/unit/provider/link_spec.rb +33 -33
- data/spec/unit/provider/mdadm_spec.rb +4 -4
- data/spec/unit/provider/mount/aix_spec.rb +5 -5
- data/spec/unit/provider/mount/mount_spec.rb +49 -50
- data/spec/unit/provider/mount/windows_spec.rb +18 -18
- data/spec/unit/provider/mount_spec.rb +12 -12
- data/spec/unit/provider/ohai_spec.rb +6 -6
- data/spec/unit/provider/package/aix_spec.rb +14 -14
- data/spec/unit/provider/package/apt_spec.rb +10 -10
- data/spec/unit/provider/package/dpkg_spec.rb +13 -13
- data/spec/unit/provider/package/easy_install_spec.rb +6 -6
- data/spec/unit/provider/package/freebsd_spec.rb +29 -29
- data/spec/unit/provider/package/ips_spec.rb +4 -4
- data/spec/unit/provider/package/macports_spec.rb +6 -6
- data/spec/unit/provider/package/pacman_spec.rb +17 -17
- data/spec/unit/provider/package/portage_spec.rb +18 -18
- data/spec/unit/provider/package/rpm_spec.rb +7 -7
- data/spec/unit/provider/package/rubygems_spec.rb +31 -31
- data/spec/unit/provider/package/smartos_spec.rb +4 -4
- data/spec/unit/provider/package/solaris_spec.rb +15 -15
- data/spec/unit/provider/package/yum_spec.rb +100 -100
- data/spec/unit/provider/package/zypper_spec.rb +10 -10
- data/spec/unit/provider/package_spec.rb +21 -21
- data/spec/unit/provider/registry_key_spec.rb +2 -2
- data/spec/unit/provider/remote_file/content_spec.rb +31 -31
- data/spec/unit/provider/remote_file/fetcher_spec.rb +8 -8
- data/spec/unit/provider/remote_file/ftp_spec.rb +10 -10
- data/spec/unit/provider/remote_file/http_spec.rb +4 -4
- data/spec/unit/provider/remote_file/local_file_spec.rb +2 -2
- data/spec/unit/provider/remote_file_spec.rb +1 -1
- data/spec/unit/provider/route_spec.rb +23 -23
- data/spec/unit/provider/script_spec.rb +5 -5
- data/spec/unit/provider/service/arch_service_spec.rb +41 -41
- data/spec/unit/provider/service/debian_service_spec.rb +23 -23
- data/spec/unit/provider/service/freebsd_service_spec.rb +33 -33
- data/spec/unit/provider/service/gentoo_service_spec.rb +16 -16
- data/spec/unit/provider/service/init_service_spec.rb +13 -13
- data/spec/unit/provider/service/insserv_service_spec.rb +4 -4
- data/spec/unit/provider/service/invokercd_service_spec.rb +12 -12
- data/spec/unit/provider/service/macosx_spec.rb +20 -20
- data/spec/unit/provider/service/redhat_spec.rb +15 -15
- data/spec/unit/provider/service/simple_service_spec.rb +9 -9
- data/spec/unit/provider/service/solaris_smf_service_spec.rb +13 -13
- data/spec/unit/provider/service/systemd_service_spec.rb +28 -28
- data/spec/unit/provider/service/upstart_service_spec.rb +41 -41
- data/spec/unit/provider/service/windows_spec.rb +37 -37
- data/spec/unit/provider/service_spec.rb +9 -9
- data/spec/unit/provider/subversion_spec.rb +36 -36
- data/spec/unit/provider/template/content_spec.rb +8 -8
- data/spec/unit/provider/template_spec.rb +1 -1
- data/spec/unit/provider/user/dscl_spec.rb +9 -9
- data/spec/unit/provider/user/pw_spec.rb +20 -20
- data/spec/unit/provider/user/solaris_spec.rb +5 -5
- data/spec/unit/provider/user/windows_spec.rb +8 -8
- data/spec/unit/provider/user_spec.rb +34 -34
- data/spec/unit/provider_spec.rb +3 -3
- data/spec/unit/recipe_spec.rb +79 -4
- data/spec/unit/registry_helper_spec.rb +2 -2
- data/spec/unit/resource/cron_spec.rb +2 -2
- data/spec/unit/resource/directory_spec.rb +5 -5
- data/spec/unit/resource/env_spec.rb +2 -2
- data/spec/unit/resource/erl_call_spec.rb +1 -1
- data/spec/unit/resource/file_spec.rb +8 -8
- data/spec/unit/resource/group_spec.rb +3 -3
- data/spec/unit/resource/link_spec.rb +8 -8
- data/spec/unit/resource/mdadm_spec.rb +3 -3
- data/spec/unit/resource/mount_spec.rb +3 -3
- data/spec/unit/resource/route_spec.rb +2 -2
- data/spec/unit/resource/user_spec.rb +2 -2
- data/spec/unit/resource/yum_package_spec.rb +2 -2
- data/spec/unit/resource_collection_spec.rb +1 -1
- data/spec/unit/resource_definition_spec.rb +2 -2
- data/spec/unit/resource_reporter_spec.rb +71 -16
- data/spec/unit/resource_spec.rb +3 -3
- data/spec/unit/rest/auth_credentials_spec.rb +2 -2
- data/spec/unit/rest_spec.rb +3 -40
- data/spec/unit/run_list/run_list_expansion_spec.rb +3 -3
- data/spec/unit/run_list_spec.rb +9 -9
- data/spec/unit/run_status_spec.rb +1 -1
- data/spec/unit/runner_spec.rb +8 -8
- data/spec/unit/scan_access_control_spec.rb +3 -3
- data/spec/unit/search/query_spec.rb +7 -7
- data/spec/unit/shell/model_wrapper_spec.rb +2 -2
- data/spec/unit/shell/shell_ext_spec.rb +15 -15
- data/spec/unit/shell/shell_session_spec.rb +9 -9
- data/spec/unit/shell_spec.rb +1 -2
- data/spec/unit/user_spec.rb +4 -4
- data/spec/unit/util/backup_spec.rb +1 -1
- data/spec/unit/util/selinux_spec.rb +7 -7
- metadata +106 -51
- data/distro/common/html/chef-client.8.html +0 -145
- data/distro/common/html/chef-expander.8.html +0 -164
- data/distro/common/html/chef-expanderctl.8.html +0 -146
- data/distro/common/html/chef-server-webui.8.html +0 -185
- data/distro/common/html/chef-server.8.html +0 -182
- data/distro/common/html/chef-shell.1.html +0 -286
- data/distro/common/html/chef-solo.8.html +0 -185
- data/distro/common/html/chef-solr.8.html +0 -165
- data/distro/common/html/knife-bootstrap.1.html +0 -241
- data/distro/common/html/knife-client.1.html +0 -219
- data/distro/common/html/knife-configure.1.html +0 -170
- data/distro/common/html/knife-cookbook-site.1.html +0 -241
- data/distro/common/html/knife-cookbook.1.html +0 -381
- data/distro/common/html/knife-data-bag.1.html +0 -235
- data/distro/common/html/knife-environment.1.html +0 -265
- data/distro/common/html/knife-exec.1.html +0 -134
- data/distro/common/html/knife-index.1.html +0 -125
- data/distro/common/html/knife-node.1.html +0 -250
- data/distro/common/html/knife-role.1.html +0 -200
- data/distro/common/html/knife-search.1.html +0 -288
- data/distro/common/html/knife-ssh.1.html +0 -156
- data/distro/common/html/knife-status.1.html +0 -128
- data/distro/common/html/knife-tag.1.html +0 -137
- data/distro/common/html/knife.1.html +0 -315
@@ -29,26 +29,26 @@ describe Chef::Provider::Package::Rpm do
|
|
29
29
|
|
30
30
|
@provider = Chef::Provider::Package::Rpm.new(@new_resource, @run_context)
|
31
31
|
|
32
|
-
@status =
|
33
|
-
::File.stub
|
32
|
+
@status = double("Status", :exitstatus => 0)
|
33
|
+
::File.stub(:exists?).and_return(true)
|
34
34
|
end
|
35
35
|
|
36
36
|
describe "when determining the current state of the package" do
|
37
37
|
|
38
38
|
it "should create a current resource with the name of new_resource" do
|
39
|
-
@provider.stub
|
39
|
+
@provider.stub(:popen4).and_return(@status)
|
40
40
|
@provider.load_current_resource
|
41
41
|
@provider.current_resource.name.should == "emacs"
|
42
42
|
end
|
43
43
|
|
44
44
|
it "should set the current reource package name to the new resource package name" do
|
45
|
-
@provider.stub
|
45
|
+
@provider.stub(:popen4).and_return(@status)
|
46
46
|
@provider.load_current_resource
|
47
47
|
@provider.current_resource.package_name.should == 'emacs'
|
48
48
|
end
|
49
49
|
|
50
50
|
it "should raise an exception if a source is supplied but not found" do
|
51
|
-
::File.stub
|
51
|
+
::File.stub(:exists?).and_return(false)
|
52
52
|
lambda { @provider.run_action(:any) }.should raise_error(Chef::Exceptions::Package)
|
53
53
|
end
|
54
54
|
|
@@ -76,8 +76,8 @@ describe Chef::Provider::Package::Rpm do
|
|
76
76
|
end
|
77
77
|
|
78
78
|
it "should raise an exception if rpm fails to run" do
|
79
|
-
status =
|
80
|
-
@provider.stub
|
79
|
+
status = double("Status", :exitstatus => -1)
|
80
|
+
@provider.stub(:popen4).and_return(status)
|
81
81
|
lambda { @provider.run_action(:any) }.should raise_error(Chef::Exceptions::Package)
|
82
82
|
end
|
83
83
|
end
|
@@ -89,7 +89,7 @@ describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do
|
|
89
89
|
it "finds a matching gem candidate version" do
|
90
90
|
dep = Gem::Dependency.new('rspec', '>= 0')
|
91
91
|
dep_installer = Gem::DependencyInstaller.new
|
92
|
-
@gem_env.stub
|
92
|
+
@gem_env.stub(:dependency_installer).and_return(dep_installer)
|
93
93
|
latest = [[gemspec("rspec", Gem::Version.new("1.3.0")), "http://rubygems.org/"]]
|
94
94
|
dep_installer.should_receive(:find_gems_with_sources).with(dep).and_return(latest)
|
95
95
|
@gem_env.candidate_version_from_remote(Gem::Dependency.new('rspec', '>= 0')).should == Gem::Version.new('1.3.0')
|
@@ -98,9 +98,9 @@ describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do
|
|
98
98
|
it "finds a matching gem candidate version on rubygems 2.0.0+" do
|
99
99
|
dep = Gem::Dependency.new('rspec', '>= 0')
|
100
100
|
dep_installer = Gem::DependencyInstaller.new
|
101
|
-
@gem_env.stub
|
102
|
-
best_gem =
|
103
|
-
available_set =
|
101
|
+
@gem_env.stub(:dependency_installer).and_return(dep_installer)
|
102
|
+
best_gem = double("best gem match", :spec => gemspec("rspec", Gem::Version.new("1.3.0")), :source => "https://rubygems.org")
|
103
|
+
available_set = double("Gem::AvailableSet test double")
|
104
104
|
available_set.should_receive(:pick_best!)
|
105
105
|
available_set.should_receive(:set).and_return([best_gem])
|
106
106
|
dep_installer.should_receive(:find_gems_with_sources).with(dep).and_return(available_set)
|
@@ -121,7 +121,7 @@ describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do
|
|
121
121
|
Gem.const_set(:Format, Object.new)
|
122
122
|
@remove_gem_format = true
|
123
123
|
end
|
124
|
-
Gem::Package.stub
|
124
|
+
Gem::Package.stub(:respond_to?).with(:open).and_return(false)
|
125
125
|
end
|
126
126
|
|
127
127
|
after do
|
@@ -131,7 +131,7 @@ describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do
|
|
131
131
|
end
|
132
132
|
|
133
133
|
it "finds a matching gem candidate version on rubygems 2.0+ with some rubygems 1.8 code loaded" do
|
134
|
-
package =
|
134
|
+
package = double("Gem::Package", :spec => "a gemspec from package")
|
135
135
|
Gem::Package.should_receive(:new).with("/path/to/package.gem").and_return(package)
|
136
136
|
@gem_env.spec_from_file("/path/to/package.gem").should == "a gemspec from package"
|
137
137
|
end
|
@@ -142,7 +142,7 @@ describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do
|
|
142
142
|
dep = Gem::Dependency.new('rspec', '>= 0')
|
143
143
|
latest = []
|
144
144
|
dep_installer = Gem::DependencyInstaller.new
|
145
|
-
@gem_env.stub
|
145
|
+
@gem_env.stub(:dependency_installer).and_return(dep_installer)
|
146
146
|
dep_installer.should_receive(:find_gems_with_sources).with(dep).and_return(latest)
|
147
147
|
@gem_env.candidate_version_from_remote(Gem::Dependency.new('rspec', '>= 0')).should be_nil
|
148
148
|
end
|
@@ -159,7 +159,7 @@ describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do
|
|
159
159
|
|
160
160
|
@gem_env.should_receive(:with_gem_sources).with('http://gems.example.com').and_yield
|
161
161
|
dep_installer = Gem::DependencyInstaller.new
|
162
|
-
@gem_env.stub
|
162
|
+
@gem_env.stub(:dependency_installer).and_return(dep_installer)
|
163
163
|
dep_installer.should_receive(:find_gems_with_sources).with(dep).and_return(latest)
|
164
164
|
@gem_env.candidate_version_from_remote(Gem::Dependency.new('rspec', '>=0'), 'http://gems.example.com').should == Gem::Version.new('1.3.0')
|
165
165
|
end
|
@@ -180,14 +180,14 @@ describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do
|
|
180
180
|
end
|
181
181
|
|
182
182
|
it "uninstalls all versions of a gem" do
|
183
|
-
uninstaller =
|
183
|
+
uninstaller = double('gem uninstaller')
|
184
184
|
uninstaller.should_receive(:uninstall)
|
185
185
|
@gem_env.should_receive(:uninstaller).with('rspec', :all => true).and_return(uninstaller)
|
186
186
|
@gem_env.uninstall('rspec')
|
187
187
|
end
|
188
188
|
|
189
189
|
it "uninstalls a specific version of a gem" do
|
190
|
-
uninstaller =
|
190
|
+
uninstaller = double('gem uninstaller')
|
191
191
|
uninstaller.should_receive(:uninstall)
|
192
192
|
@gem_env.should_receive(:uninstaller).with('rspec', :version => '1.2.3').and_return(uninstaller)
|
193
193
|
@gem_env.uninstall('rspec', '1.2.3')
|
@@ -230,7 +230,7 @@ describe Chef::Provider::Package::Rubygems::AlternateGemEnvironment do
|
|
230
230
|
end
|
231
231
|
|
232
232
|
it "builds the gems source index from the gem paths" do
|
233
|
-
@gem_env.stub
|
233
|
+
@gem_env.stub(:gem_paths).and_return(['/path/to/gems', '/another/path/to/gems'])
|
234
234
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.8.0')
|
235
235
|
@gem_env.gem_specification
|
236
236
|
Gem::Specification.dirs.should == [ '/path/to/gems/specifications', '/another/path/to/gems/specifications' ]
|
@@ -244,17 +244,17 @@ describe Chef::Provider::Package::Rubygems::AlternateGemEnvironment do
|
|
244
244
|
gems = [gemspec('rspec', Gem::Version.new('1.2.9')), gemspec('rspec', Gem::Version.new('1.3.0'))]
|
245
245
|
rspec_dep = Gem::Dependency.new('rspec', nil)
|
246
246
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.8.0')
|
247
|
-
@gem_env.stub
|
247
|
+
@gem_env.stub(:gem_specification).and_return(Gem::Specification)
|
248
248
|
@gem_env.gem_specification.should_receive(:find_all_by_name).with(rspec_dep.name, rspec_dep.requirement).and_return(gems)
|
249
249
|
else
|
250
|
-
@gem_env.stub
|
250
|
+
@gem_env.stub(:gem_source_index).and_return(Gem.source_index)
|
251
251
|
@gem_env.gem_source_index.should_receive(:search).with(rspec_dep).and_return(gems)
|
252
252
|
end
|
253
253
|
@gem_env.installed_versions(Gem::Dependency.new('rspec', nil)).should == gems
|
254
254
|
end
|
255
255
|
|
256
256
|
it "determines the installed versions of gems from the source index (part2: the unmockening)" do
|
257
|
-
$stdout.stub
|
257
|
+
$stdout.stub(:write)
|
258
258
|
path_to_gem = if windows?
|
259
259
|
`where gem`.split[1]
|
260
260
|
else
|
@@ -295,7 +295,7 @@ RubyGems Environment:
|
|
295
295
|
- http://rubygems.org/
|
296
296
|
- http://gems.github.com/
|
297
297
|
JRUBY_GEM_ENV
|
298
|
-
@gem_env.should_receive(:shell_out!).with('/usr/weird/bin/gem env').and_return(
|
298
|
+
@gem_env.should_receive(:shell_out!).with('/usr/weird/bin/gem env').and_return(double('jruby_gem_env', :stdout => gem_env_out))
|
299
299
|
expected = ['ruby', Gem::Platform.new('universal-java-1.6')]
|
300
300
|
@gem_env.gem_platforms.should == expected
|
301
301
|
# it should also cache the result
|
@@ -337,7 +337,7 @@ RubyGems Environment:
|
|
337
337
|
- http://rubygems.org/
|
338
338
|
- http://gems.github.com/
|
339
339
|
RBX_GEM_ENV
|
340
|
-
@gem_env.should_receive(:shell_out!).with('/usr/weird/bin/gem env').and_return(
|
340
|
+
@gem_env.should_receive(:shell_out!).with('/usr/weird/bin/gem env').and_return(double('rbx_gem_env', :stdout => gem_env_out))
|
341
341
|
@gem_env.gem_platforms.should == Gem.platforms
|
342
342
|
Chef::Provider::Package::Rubygems::AlternateGemEnvironment.platform_cache['/usr/weird/bin/gem'].should == Gem.platforms
|
343
343
|
end
|
@@ -367,7 +367,7 @@ describe Chef::Provider::Package::Rubygems do
|
|
367
367
|
@run_context = Chef::RunContext.new(@node, {}, @events)
|
368
368
|
|
369
369
|
# We choose detect omnibus via RbConfig::CONFIG['bindir'] in Chef::Provider::Package::Rubygems.new
|
370
|
-
RbConfig::CONFIG.stub
|
370
|
+
RbConfig::CONFIG.stub(:[]).with('bindir').and_return("/usr/bin/ruby")
|
371
371
|
@provider = Chef::Provider::Package::Rubygems.new(@new_resource, @run_context)
|
372
372
|
end
|
373
373
|
|
@@ -388,11 +388,11 @@ describe Chef::Provider::Package::Rubygems do
|
|
388
388
|
|
389
389
|
it "searches for a gem binary when running on Omnibus on Unix" do
|
390
390
|
platform_mock :unix do
|
391
|
-
RbConfig::CONFIG.stub
|
392
|
-
ENV.stub
|
393
|
-
File.stub
|
394
|
-
File.stub
|
395
|
-
File.stub
|
391
|
+
RbConfig::CONFIG.stub(:[]).with('bindir').and_return("/opt/chef/embedded/bin")
|
392
|
+
ENV.stub(:[]).with('PATH').and_return("/usr/bin:/usr/sbin:/opt/chef/embedded/bin")
|
393
|
+
File.stub(:exists?).with('/usr/bin/gem').and_return(false)
|
394
|
+
File.stub(:exists?).with('/usr/sbin/gem').and_return(true)
|
395
|
+
File.stub(:exists?).with('/opt/chef/embedded/bin/gem').and_return(true) # should not get here
|
396
396
|
provider = Chef::Provider::Package::Rubygems.new(@new_resource, @run_context)
|
397
397
|
provider.gem_env.gem_binary_location.should == '/usr/sbin/gem'
|
398
398
|
end
|
@@ -400,13 +400,13 @@ describe Chef::Provider::Package::Rubygems do
|
|
400
400
|
|
401
401
|
it "searches for a gem binary when running on Omnibus on Windows" do
|
402
402
|
platform_mock :windows do
|
403
|
-
RbConfig::CONFIG.stub
|
404
|
-
ENV.stub
|
405
|
-
File.stub
|
406
|
-
File.stub
|
407
|
-
File.stub
|
408
|
-
File.stub
|
409
|
-
File.stub
|
403
|
+
RbConfig::CONFIG.stub(:[]).with('bindir').and_return("d:/opscode/chef/embedded/bin")
|
404
|
+
ENV.stub(:[]).with('PATH').and_return('C:\windows\system32;C:\windows;C:\Ruby186\bin;d:\opscode\chef\embedded\bin')
|
405
|
+
File.stub(:exists?).with('C:\\windows\\system32\\gem').and_return(false)
|
406
|
+
File.stub(:exists?).with('C:\\windows\\gem').and_return(false)
|
407
|
+
File.stub(:exists?).with('C:\\Ruby186\\bin\\gem').and_return(true)
|
408
|
+
File.stub(:exists?).with('d:\\opscode\\chef\\bin\\gem').and_return(false) # should not get here
|
409
|
+
File.stub(:exists?).with('d:\\opscode\\chef\\embedded\\bin\\gem').and_return(false) # should not get here
|
410
410
|
provider = Chef::Provider::Package::Rubygems.new(@new_resource, @run_context)
|
411
411
|
provider.gem_env.gem_binary_location.should == 'C:\Ruby186\bin\gem'
|
412
412
|
end
|
@@ -475,7 +475,7 @@ describe Chef::Provider::Package::Rubygems do
|
|
475
475
|
@current_resource = Chef::Resource::GemPackage.new('rspec-core')
|
476
476
|
@provider.current_resource = @current_resource
|
477
477
|
@gem_dep = Gem::Dependency.new('rspec-core', @spec_version)
|
478
|
-
@provider.stub
|
478
|
+
@provider.stub(:load_current_resource)
|
479
479
|
end
|
480
480
|
|
481
481
|
describe "in the current gem environment" do
|
@@ -508,7 +508,7 @@ describe Chef::Provider::Package::Rubygems do
|
|
508
508
|
|
509
509
|
# this catches 'gem_package "foo"' when "./foo" is a file in the cwd, and instead of installing './foo' it fetches the remote gem
|
510
510
|
it "installs the gem via the gems api, when the package has no file separator characters in it, but a matching file exists in cwd" do
|
511
|
-
::File.stub
|
511
|
+
::File.stub(:exists?).and_return(true)
|
512
512
|
@new_resource.package_name('rspec-core')
|
513
513
|
@provider.gem_env.should_receive(:install).with(@gem_dep, :sources => nil)
|
514
514
|
@provider.action_install.should be_true
|
@@ -29,9 +29,9 @@ describe Chef::Provider::Package::SmartOS, "load_current_resource" do
|
|
29
29
|
@current_resource = Chef::Resource::Package.new("varnish")
|
30
30
|
|
31
31
|
|
32
|
-
@status =
|
32
|
+
@status = double("Status", :exitstatus => 0)
|
33
33
|
@provider = Chef::Provider::Package::SmartOS.new(@new_resource, @run_context)
|
34
|
-
Chef::Resource::Package.stub
|
34
|
+
Chef::Resource::Package.stub(:new).and_return(@current_resource)
|
35
35
|
@stdin = StringIO.new
|
36
36
|
@stdout = "varnish-2.1.5nb2\n"
|
37
37
|
@stderr = StringIO.new
|
@@ -77,11 +77,11 @@ describe Chef::Provider::Package::SmartOS, "load_current_resource" do
|
|
77
77
|
end
|
78
78
|
|
79
79
|
it "should lookup the candidate_version if the variable is not already set" do
|
80
|
-
search =
|
80
|
+
search = double()
|
81
81
|
search.should_receive(:each_line).
|
82
82
|
and_yield("something-varnish-1.1.1 something varnish like\n").
|
83
83
|
and_yield("varnish-2.3.4 actual varnish\n")
|
84
|
-
@shell_out =
|
84
|
+
@shell_out = double('shell_out!', :stdout => search)
|
85
85
|
@provider.should_receive(:shell_out!).with('/opt/local/bin/pkgin se varnish', :env => nil, :returns => [0,1]).and_return(@shell_out)
|
86
86
|
@provider.candidate_version.should == "2.3.4"
|
87
87
|
end
|
@@ -27,7 +27,7 @@ describe Chef::Provider::Package::Solaris do
|
|
27
27
|
@new_resource.source("/tmp/bash.pkg")
|
28
28
|
|
29
29
|
@provider = Chef::Provider::Package::Solaris.new(@new_resource, @run_context)
|
30
|
-
::File.stub
|
30
|
+
::File.stub(:exists?).and_return(true)
|
31
31
|
end
|
32
32
|
|
33
33
|
describe "assessing the current package status" do
|
@@ -46,24 +46,24 @@ INSTDATE: Nov 04 2009 01:02
|
|
46
46
|
HOTLINE: Please contact your local service provider
|
47
47
|
PKGINFO
|
48
48
|
|
49
|
-
@status =
|
49
|
+
@status = double("Status", :exitstatus => 0)
|
50
50
|
end
|
51
51
|
|
52
52
|
it "should create a current resource with the name of new_resource" do
|
53
|
-
@provider.stub
|
53
|
+
@provider.stub(:popen4).and_return(@status)
|
54
54
|
@provider.load_current_resource
|
55
55
|
@provider.current_resource.name.should == "SUNWbash"
|
56
56
|
end
|
57
57
|
|
58
58
|
it "should set the current reource package name to the new resource package name" do
|
59
|
-
@provider.stub
|
59
|
+
@provider.stub(:popen4).and_return(@status)
|
60
60
|
@provider.load_current_resource
|
61
61
|
@provider.current_resource.package_name.should == "SUNWbash"
|
62
62
|
end
|
63
63
|
|
64
64
|
it "should raise an exception if a source is supplied but not found" do
|
65
|
-
@provider.stub
|
66
|
-
::File.stub
|
65
|
+
@provider.stub(:popen4).and_return(@status)
|
66
|
+
::File.stub(:exists?).and_return(false)
|
67
67
|
@provider.define_resource_requirements
|
68
68
|
@provider.load_current_resource
|
69
69
|
lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Package)
|
@@ -93,13 +93,13 @@ PKGINFO
|
|
93
93
|
it "should raise an exception if the source is not set but we are installing" do
|
94
94
|
@new_resource = Chef::Resource::Package.new("SUNWbash")
|
95
95
|
@provider = Chef::Provider::Package::Solaris.new(@new_resource, @run_context)
|
96
|
-
@provider.stub
|
96
|
+
@provider.stub(:popen4).and_return(@status)
|
97
97
|
lambda { @provider.run_action(:install) }.should raise_error(Chef::Exceptions::Package)
|
98
98
|
end
|
99
99
|
|
100
100
|
it "should raise an exception if pkginfo fails to run" do
|
101
|
-
@status =
|
102
|
-
@provider.stub
|
101
|
+
@status = double("Status", :exitstatus => -1)
|
102
|
+
@provider.stub(:popen4).and_return(@status)
|
103
103
|
lambda { @provider.load_current_resource }.should raise_error(Chef::Exceptions::Package)
|
104
104
|
end
|
105
105
|
|
@@ -120,15 +120,15 @@ PKGINFO
|
|
120
120
|
end
|
121
121
|
|
122
122
|
it "should lookup the candidate_version if the variable is not already set" do
|
123
|
-
@status =
|
124
|
-
@provider.stub
|
123
|
+
@status = double("Status", :exitstatus => 0)
|
124
|
+
@provider.stub(:popen4).and_return(@status)
|
125
125
|
@provider.should_receive(:popen4)
|
126
126
|
@provider.candidate_version
|
127
127
|
end
|
128
128
|
|
129
129
|
it "should throw and exception if the exitstatus is not 0" do
|
130
|
-
@status =
|
131
|
-
@provider.stub
|
130
|
+
@status = double("Status", :exitstatus => 1)
|
131
|
+
@provider.stub(:popen4).and_return(@status)
|
132
132
|
lambda { @provider.candidate_version }.should raise_error(Chef::Exceptions::Package)
|
133
133
|
end
|
134
134
|
|
@@ -153,7 +153,7 @@ PKGINFO
|
|
153
153
|
end
|
154
154
|
|
155
155
|
it "should run pkgadd -n -a /tmp/myadmin -d with the package options -a /tmp/myadmin" do
|
156
|
-
@new_resource.stub
|
156
|
+
@new_resource.stub(:options).and_return("-a /tmp/myadmin")
|
157
157
|
@provider.should_receive(:run_command_with_systems_locale).with({
|
158
158
|
:command => "pkgadd -n -a /tmp/myadmin -d /tmp/bash.pkg all"
|
159
159
|
})
|
@@ -170,7 +170,7 @@ PKGINFO
|
|
170
170
|
end
|
171
171
|
|
172
172
|
it "should run pkgrm -n -a /tmp/myadmin with options -a /tmp/myadmin" do
|
173
|
-
@new_resource.stub
|
173
|
+
@new_resource.stub(:options).and_return("-a /tmp/myadmin")
|
174
174
|
@provider.should_receive(:run_command_with_systems_locale).with({
|
175
175
|
:command => "pkgrm -n -a /tmp/myadmin SUNWbash"
|
176
176
|
})
|
@@ -24,8 +24,8 @@ describe Chef::Provider::Package::Yum do
|
|
24
24
|
@events = Chef::EventDispatch::Dispatcher.new
|
25
25
|
@run_context = Chef::RunContext.new(@node, {}, @events)
|
26
26
|
@new_resource = Chef::Resource::Package.new('cups')
|
27
|
-
@status =
|
28
|
-
@yum_cache =
|
27
|
+
@status = double("Status", :exitstatus => 0)
|
28
|
+
@yum_cache = double(
|
29
29
|
'Chef::Provider::Yum::YumCache',
|
30
30
|
:reload_installed => true,
|
31
31
|
:reset => true,
|
@@ -37,9 +37,9 @@ describe Chef::Provider::Package::Yum do
|
|
37
37
|
:package_repository => "base",
|
38
38
|
:disable_extra_repo_control => true
|
39
39
|
)
|
40
|
-
Chef::Provider::Package::Yum::YumCache.stub
|
40
|
+
Chef::Provider::Package::Yum::YumCache.stub(:instance).and_return(@yum_cache)
|
41
41
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
42
|
-
@pid =
|
42
|
+
@pid = double("PID")
|
43
43
|
end
|
44
44
|
|
45
45
|
describe "when loading the current system state" do
|
@@ -54,7 +54,7 @@ describe Chef::Provider::Package::Yum do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
it "should set the installed version to nil on the current resource if no installed package" do
|
57
|
-
@yum_cache.stub
|
57
|
+
@yum_cache.stub(:installed_version).and_return(nil)
|
58
58
|
@provider.load_current_resource
|
59
59
|
@provider.current_resource.version.should be_nil
|
60
60
|
end
|
@@ -76,14 +76,14 @@ describe Chef::Provider::Package::Yum do
|
|
76
76
|
describe "when arch in package_name" do
|
77
77
|
it "should set the arch if no existing package_name is found and new_package_name+new_arch is available" do
|
78
78
|
@new_resource = Chef::Resource::YumPackage.new('testing.noarch')
|
79
|
-
@yum_cache =
|
79
|
+
@yum_cache = double(
|
80
80
|
'Chef::Provider::Yum::YumCache'
|
81
81
|
)
|
82
|
-
@yum_cache.stub
|
82
|
+
@yum_cache.stub(:installed_version) do |package_name, arch|
|
83
83
|
# nothing installed for package_name/new_package_name
|
84
84
|
nil
|
85
85
|
end
|
86
|
-
@yum_cache.stub
|
86
|
+
@yum_cache.stub(:candidate_version) do |package_name, arch|
|
87
87
|
if package_name == "testing.noarch" || package_name == "testing.more.noarch"
|
88
88
|
nil
|
89
89
|
# candidate for new_package_name
|
@@ -91,9 +91,9 @@ describe Chef::Provider::Package::Yum do
|
|
91
91
|
"1.1"
|
92
92
|
end
|
93
93
|
end
|
94
|
-
@yum_cache.stub
|
95
|
-
@yum_cache.stub
|
96
|
-
Chef::Provider::Package::Yum::YumCache.stub
|
94
|
+
@yum_cache.stub(:package_available?).and_return(true)
|
95
|
+
@yum_cache.stub(:disable_extra_repo_control).and_return(true)
|
96
|
+
Chef::Provider::Package::Yum::YumCache.stub(:instance).and_return(@yum_cache)
|
97
97
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
98
98
|
@provider.load_current_resource
|
99
99
|
@provider.new_resource.package_name.should == "testing"
|
@@ -110,10 +110,10 @@ describe Chef::Provider::Package::Yum do
|
|
110
110
|
|
111
111
|
it "should not set the arch when an existing package_name is found" do
|
112
112
|
@new_resource = Chef::Resource::YumPackage.new('testing.beta3')
|
113
|
-
@yum_cache =
|
113
|
+
@yum_cache = double(
|
114
114
|
'Chef::Provider::Yum::YumCache'
|
115
115
|
)
|
116
|
-
@yum_cache.stub
|
116
|
+
@yum_cache.stub(:installed_version) do |package_name, arch|
|
117
117
|
# installed for package_name
|
118
118
|
if package_name == "testing.beta3" || package_name == "testing.beta3.more"
|
119
119
|
"1.1"
|
@@ -121,13 +121,13 @@ describe Chef::Provider::Package::Yum do
|
|
121
121
|
nil
|
122
122
|
end
|
123
123
|
end
|
124
|
-
@yum_cache.stub
|
124
|
+
@yum_cache.stub(:candidate_version) do |package_name, arch|
|
125
125
|
# no candidate for package_name/new_package_name
|
126
126
|
nil
|
127
127
|
end
|
128
|
-
@yum_cache.stub
|
129
|
-
@yum_cache.stub
|
130
|
-
Chef::Provider::Package::Yum::YumCache.stub
|
128
|
+
@yum_cache.stub(:package_available?).and_return(true)
|
129
|
+
@yum_cache.stub(:disable_extra_repo_control).and_return(true)
|
130
|
+
Chef::Provider::Package::Yum::YumCache.stub(:instance).and_return(@yum_cache)
|
131
131
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
132
132
|
# annoying side effect of the fun stub'ing above
|
133
133
|
@provider.load_current_resource
|
@@ -145,20 +145,20 @@ describe Chef::Provider::Package::Yum do
|
|
145
145
|
|
146
146
|
it "should not set the arch when no existing package_name or new_package_name+new_arch is found" do
|
147
147
|
@new_resource = Chef::Resource::YumPackage.new('testing.beta3')
|
148
|
-
@yum_cache =
|
148
|
+
@yum_cache = double(
|
149
149
|
'Chef::Provider::Yum::YumCache'
|
150
150
|
)
|
151
|
-
@yum_cache.stub
|
151
|
+
@yum_cache.stub(:installed_version) do |package_name, arch|
|
152
152
|
# nothing installed for package_name/new_package_name
|
153
153
|
nil
|
154
154
|
end
|
155
|
-
@yum_cache.stub
|
155
|
+
@yum_cache.stub(:candidate_version) do |package_name, arch|
|
156
156
|
# no candidate for package_name/new_package_name
|
157
157
|
nil
|
158
158
|
end
|
159
|
-
@yum_cache.stub
|
160
|
-
@yum_cache.stub
|
161
|
-
Chef::Provider::Package::Yum::YumCache.stub
|
159
|
+
@yum_cache.stub(:package_available?).and_return(true)
|
160
|
+
@yum_cache.stub(:disable_extra_repo_control).and_return(true)
|
161
|
+
Chef::Provider::Package::Yum::YumCache.stub(:instance).and_return(@yum_cache)
|
162
162
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
163
163
|
@provider.load_current_resource
|
164
164
|
@provider.new_resource.package_name.should == "testing.beta3"
|
@@ -176,14 +176,14 @@ describe Chef::Provider::Package::Yum do
|
|
176
176
|
it "should ensure it doesn't clobber an existing arch if passed" do
|
177
177
|
@new_resource = Chef::Resource::YumPackage.new('testing.i386')
|
178
178
|
@new_resource.arch("x86_64")
|
179
|
-
@yum_cache =
|
179
|
+
@yum_cache = double(
|
180
180
|
'Chef::Provider::Yum::YumCache'
|
181
181
|
)
|
182
|
-
@yum_cache.stub
|
182
|
+
@yum_cache.stub(:installed_version) do |package_name, arch|
|
183
183
|
# nothing installed for package_name/new_package_name
|
184
184
|
nil
|
185
185
|
end
|
186
|
-
@yum_cache.stub
|
186
|
+
@yum_cache.stub(:candidate_version) do |package_name, arch|
|
187
187
|
if package_name == "testing.noarch"
|
188
188
|
nil
|
189
189
|
# candidate for new_package_name
|
@@ -191,9 +191,9 @@ describe Chef::Provider::Package::Yum do
|
|
191
191
|
"1.1"
|
192
192
|
end
|
193
193
|
end.and_return("something")
|
194
|
-
@yum_cache.stub
|
195
|
-
@yum_cache.stub
|
196
|
-
Chef::Provider::Package::Yum::YumCache.stub
|
194
|
+
@yum_cache.stub(:package_available?).and_return(true)
|
195
|
+
@yum_cache.stub(:disable_extra_repo_control).and_return(true)
|
196
|
+
Chef::Provider::Package::Yum::YumCache.stub(:instance).and_return(@yum_cache)
|
197
197
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
198
198
|
@provider.load_current_resource
|
199
199
|
@provider.new_resource.package_name.should == "testing.i386"
|
@@ -202,37 +202,37 @@ describe Chef::Provider::Package::Yum do
|
|
202
202
|
end
|
203
203
|
|
204
204
|
it "should flush the cache if :before is true" do
|
205
|
-
@new_resource.stub
|
205
|
+
@new_resource.stub(:flush_cache).and_return({:after => false, :before => true})
|
206
206
|
@yum_cache.should_receive(:reload).once
|
207
207
|
@provider.load_current_resource
|
208
208
|
end
|
209
209
|
|
210
210
|
it "should flush the cache if :before is false" do
|
211
|
-
@new_resource.stub
|
211
|
+
@new_resource.stub(:flush_cache).and_return({:after => false, :before => false})
|
212
212
|
@yum_cache.should_not_receive(:reload)
|
213
213
|
@provider.load_current_resource
|
214
214
|
end
|
215
215
|
|
216
216
|
it "should detect --enablerepo or --disablerepo when passed among options, collect them preserving order and notify the yum cache" do
|
217
|
-
@new_resource.stub
|
217
|
+
@new_resource.stub(:options).and_return("--stuff --enablerepo=foo --otherthings --disablerepo=a,b,c --enablerepo=bar")
|
218
218
|
@yum_cache.should_receive(:enable_extra_repo_control).with("--enablerepo=foo --disablerepo=a,b,c --enablerepo=bar")
|
219
219
|
@provider.load_current_resource
|
220
220
|
end
|
221
221
|
|
222
222
|
it "should let the yum cache know extra repos are disabled if --enablerepo or --disablerepo aren't among options" do
|
223
|
-
@new_resource.stub
|
223
|
+
@new_resource.stub(:options).and_return("--stuff --otherthings")
|
224
224
|
@yum_cache.should_receive(:disable_extra_repo_control)
|
225
225
|
@provider.load_current_resource
|
226
226
|
end
|
227
227
|
|
228
228
|
it "should let the yum cache know extra repos are disabled if options aren't set" do
|
229
|
-
@new_resource.stub
|
229
|
+
@new_resource.stub(:options).and_return(nil)
|
230
230
|
@yum_cache.should_receive(:disable_extra_repo_control)
|
231
231
|
@provider.load_current_resource
|
232
232
|
end
|
233
233
|
|
234
234
|
it "should search provides if package name can't be found then set package_name to match" do
|
235
|
-
@yum_cache =
|
235
|
+
@yum_cache = double(
|
236
236
|
'Chef::Provider::Yum::YumCache',
|
237
237
|
:reload_installed => true,
|
238
238
|
:reset => true,
|
@@ -242,7 +242,7 @@ describe Chef::Provider::Package::Yum do
|
|
242
242
|
:version_available? => true,
|
243
243
|
:disable_extra_repo_control => true
|
244
244
|
)
|
245
|
-
Chef::Provider::Package::Yum::YumCache.stub
|
245
|
+
Chef::Provider::Package::Yum::YumCache.stub(:instance).and_return(@yum_cache)
|
246
246
|
pkg = Chef::Provider::Package::Yum::RPMPackage.new("test-package", "1.2.4-11.18.el5", "x86_64", [])
|
247
247
|
@yum_cache.should_receive(:packages_from_require).and_return([pkg])
|
248
248
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
@@ -251,7 +251,7 @@ describe Chef::Provider::Package::Yum do
|
|
251
251
|
end
|
252
252
|
|
253
253
|
it "should search provides if package name can't be found, warn about multiple matches, but use the first one" do
|
254
|
-
@yum_cache =
|
254
|
+
@yum_cache = double(
|
255
255
|
'Chef::Provider::Yum::YumCache',
|
256
256
|
:reload_installed => true,
|
257
257
|
:reset => true,
|
@@ -261,7 +261,7 @@ describe Chef::Provider::Package::Yum do
|
|
261
261
|
:version_available? => true,
|
262
262
|
:disable_extra_repo_control => true
|
263
263
|
)
|
264
|
-
Chef::Provider::Package::Yum::YumCache.stub
|
264
|
+
Chef::Provider::Package::Yum::YumCache.stub(:instance).and_return(@yum_cache)
|
265
265
|
pkg_x = Chef::Provider::Package::Yum::RPMPackage.new("test-package-x", "1.2.4-11.18.el5", "x86_64", [])
|
266
266
|
pkg_y = Chef::Provider::Package::Yum::RPMPackage.new("test-package-y", "1.2.6-11.3.el5", "i386", [])
|
267
267
|
@yum_cache.should_receive(:packages_from_require).and_return([pkg_x, pkg_y])
|
@@ -272,7 +272,7 @@ describe Chef::Provider::Package::Yum do
|
|
272
272
|
end
|
273
273
|
|
274
274
|
it "should search provides if no package is available - if no match in installed provides then load the complete set" do
|
275
|
-
@yum_cache =
|
275
|
+
@yum_cache = double(
|
276
276
|
'Chef::Provider::Yum::YumCache',
|
277
277
|
:reload_installed => true,
|
278
278
|
:reset => true,
|
@@ -282,7 +282,7 @@ describe Chef::Provider::Package::Yum do
|
|
282
282
|
:version_available? => true,
|
283
283
|
:disable_extra_repo_control => true
|
284
284
|
)
|
285
|
-
Chef::Provider::Package::Yum::YumCache.stub
|
285
|
+
Chef::Provider::Package::Yum::YumCache.stub(:instance).and_return(@yum_cache)
|
286
286
|
@yum_cache.should_receive(:packages_from_require).twice.and_return([])
|
287
287
|
@yum_cache.should_receive(:reload_provides)
|
288
288
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
@@ -290,7 +290,7 @@ describe Chef::Provider::Package::Yum do
|
|
290
290
|
end
|
291
291
|
|
292
292
|
it "should search provides if no package is available and not load the complete set if action is :remove or :purge" do
|
293
|
-
@yum_cache =
|
293
|
+
@yum_cache = double(
|
294
294
|
'Chef::Provider::Yum::YumCache',
|
295
295
|
:reload_installed => true,
|
296
296
|
:reset => true,
|
@@ -300,7 +300,7 @@ describe Chef::Provider::Package::Yum do
|
|
300
300
|
:version_available? => true,
|
301
301
|
:disable_extra_repo_control => true
|
302
302
|
)
|
303
|
-
Chef::Provider::Package::Yum::YumCache.stub
|
303
|
+
Chef::Provider::Package::Yum::YumCache.stub(:instance).and_return(@yum_cache)
|
304
304
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
305
305
|
@yum_cache.should_receive(:packages_from_require).once.and_return([])
|
306
306
|
@yum_cache.should_not_receive(:reload_provides)
|
@@ -313,7 +313,7 @@ describe Chef::Provider::Package::Yum do
|
|
313
313
|
end
|
314
314
|
|
315
315
|
it "should search provides if no package is available - if no match in provides leave the name intact" do
|
316
|
-
@yum_cache =
|
316
|
+
@yum_cache = double(
|
317
317
|
'Chef::Provider::Yum::YumCache',
|
318
318
|
:reload_provides => true,
|
319
319
|
:reload_installed => true,
|
@@ -324,7 +324,7 @@ describe Chef::Provider::Package::Yum do
|
|
324
324
|
:version_available? => true,
|
325
325
|
:disable_extra_repo_control => true
|
326
326
|
)
|
327
|
-
Chef::Provider::Package::Yum::YumCache.stub
|
327
|
+
Chef::Provider::Package::Yum::YumCache.stub(:instance).and_return(@yum_cache)
|
328
328
|
@yum_cache.should_receive(:packages_from_require).twice.and_return([])
|
329
329
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
330
330
|
@provider.load_current_resource
|
@@ -335,7 +335,7 @@ describe Chef::Provider::Package::Yum do
|
|
335
335
|
describe "when installing a package" do
|
336
336
|
it "should run yum install with the package name and version" do
|
337
337
|
@provider.load_current_resource
|
338
|
-
Chef::Provider::Package::Yum::RPMUtils.stub
|
338
|
+
Chef::Provider::Package::Yum::RPMUtils.stub(:rpmvercmp).and_return(-1)
|
339
339
|
@provider.should_receive(:yum_command).with(
|
340
340
|
"yum -d0 -e0 -y install emacs-1.0"
|
341
341
|
)
|
@@ -343,7 +343,7 @@ describe Chef::Provider::Package::Yum do
|
|
343
343
|
end
|
344
344
|
|
345
345
|
it "should run yum localinstall if given a path to an rpm" do
|
346
|
-
@new_resource.stub
|
346
|
+
@new_resource.stub(:source).and_return("/tmp/emacs-21.4-20.el5.i386.rpm")
|
347
347
|
@provider.should_receive(:yum_command).with(
|
348
348
|
"yum -d0 -e0 -y localinstall /tmp/emacs-21.4-20.el5.i386.rpm"
|
349
349
|
)
|
@@ -352,7 +352,7 @@ describe Chef::Provider::Package::Yum do
|
|
352
352
|
|
353
353
|
it "should run yum localinstall if given a path to an rpm as the package" do
|
354
354
|
@new_resource = Chef::Resource::Package.new("/tmp/emacs-21.4-20.el5.i386.rpm")
|
355
|
-
::File.stub
|
355
|
+
::File.stub(:exists?).and_return(true)
|
356
356
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
357
357
|
@new_resource.source.should == "/tmp/emacs-21.4-20.el5.i386.rpm"
|
358
358
|
@provider.should_receive(:yum_command).with(
|
@@ -363,8 +363,8 @@ describe Chef::Provider::Package::Yum do
|
|
363
363
|
|
364
364
|
it "should run yum install with the package name, version and arch" do
|
365
365
|
@provider.load_current_resource
|
366
|
-
@new_resource.stub
|
367
|
-
Chef::Provider::Package::Yum::RPMUtils.stub
|
366
|
+
@new_resource.stub(:arch).and_return("i386")
|
367
|
+
Chef::Provider::Package::Yum::RPMUtils.stub(:rpmvercmp).and_return(-1)
|
368
368
|
@provider.should_receive(:yum_command).with(
|
369
369
|
"yum -d0 -e0 -y install emacs-21.4-20.el5.i386"
|
370
370
|
)
|
@@ -374,8 +374,8 @@ describe Chef::Provider::Package::Yum do
|
|
374
374
|
it "installs the package with the options given in the resource" do
|
375
375
|
@provider.load_current_resource
|
376
376
|
@provider.candidate_version = '11'
|
377
|
-
@new_resource.stub
|
378
|
-
Chef::Provider::Package::Yum::RPMUtils.stub
|
377
|
+
@new_resource.stub(:options).and_return("--disablerepo epmd")
|
378
|
+
Chef::Provider::Package::Yum::RPMUtils.stub(:rpmvercmp).and_return(-1)
|
379
379
|
@provider.should_receive(:yum_command).with(
|
380
380
|
"yum -d0 -e0 -y --disablerepo epmd install cups-11"
|
381
381
|
)
|
@@ -383,7 +383,7 @@ describe Chef::Provider::Package::Yum do
|
|
383
383
|
end
|
384
384
|
|
385
385
|
it "should raise an exception if the package is not available" do
|
386
|
-
@yum_cache =
|
386
|
+
@yum_cache = double(
|
387
387
|
'Chef::Provider::Yum::YumCache',
|
388
388
|
:reload_from_cache => true,
|
389
389
|
:reset => true,
|
@@ -393,14 +393,14 @@ describe Chef::Provider::Package::Yum do
|
|
393
393
|
:version_available? => nil,
|
394
394
|
:disable_extra_repo_control => true
|
395
395
|
)
|
396
|
-
Chef::Provider::Package::Yum::YumCache.stub
|
396
|
+
Chef::Provider::Package::Yum::YumCache.stub(:instance).and_return(@yum_cache)
|
397
397
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
398
398
|
lambda { @provider.install_package("lolcats", "0.99") }.should raise_error(Chef::Exceptions::Package, %r{Version .* not found})
|
399
399
|
end
|
400
400
|
|
401
401
|
it "should raise an exception if candidate version is older than the installed version and allow_downgrade is false" do
|
402
|
-
@new_resource.stub
|
403
|
-
@yum_cache =
|
402
|
+
@new_resource.stub(:allow_downgrade).and_return(false)
|
403
|
+
@yum_cache = double(
|
404
404
|
'Chef::Provider::Yum::YumCache',
|
405
405
|
:reload_installed => true,
|
406
406
|
:reset => true,
|
@@ -411,14 +411,14 @@ describe Chef::Provider::Package::Yum do
|
|
411
411
|
:allow_multi_install => [ "kernel" ],
|
412
412
|
:disable_extra_repo_control => true
|
413
413
|
)
|
414
|
-
Chef::Provider::Package::Yum::YumCache.stub
|
414
|
+
Chef::Provider::Package::Yum::YumCache.stub(:instance).and_return(@yum_cache)
|
415
415
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
416
416
|
@provider.load_current_resource
|
417
417
|
lambda { @provider.install_package("cups", "1.2.4-11.15.el5") }.should raise_error(Chef::Exceptions::Package, %r{is newer than candidate package})
|
418
418
|
end
|
419
419
|
|
420
420
|
it "should not raise an exception if candidate version is older than the installed version and the package is list in yum's installonlypkg option" do
|
421
|
-
@yum_cache =
|
421
|
+
@yum_cache = double(
|
422
422
|
'Chef::Provider::Yum::YumCache',
|
423
423
|
:reload_installed => true,
|
424
424
|
:reset => true,
|
@@ -430,7 +430,7 @@ describe Chef::Provider::Package::Yum do
|
|
430
430
|
:package_repository => "base",
|
431
431
|
:disable_extra_repo_control => true
|
432
432
|
)
|
433
|
-
Chef::Provider::Package::Yum::YumCache.stub
|
433
|
+
Chef::Provider::Package::Yum::YumCache.stub(:instance).and_return(@yum_cache)
|
434
434
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
435
435
|
@provider.load_current_resource
|
436
436
|
@provider.should_receive(:yum_command).with(
|
@@ -440,8 +440,8 @@ describe Chef::Provider::Package::Yum do
|
|
440
440
|
end
|
441
441
|
|
442
442
|
it "should run yum downgrade if candidate version is older than the installed version and allow_downgrade is true" do
|
443
|
-
@new_resource.stub
|
444
|
-
@yum_cache =
|
443
|
+
@new_resource.stub(:allow_downgrade).and_return(true)
|
444
|
+
@yum_cache = double(
|
445
445
|
'Chef::Provider::Yum::YumCache',
|
446
446
|
:reload_installed => true,
|
447
447
|
:reset => true,
|
@@ -453,7 +453,7 @@ describe Chef::Provider::Package::Yum do
|
|
453
453
|
:package_repository => "base",
|
454
454
|
:disable_extra_repo_control => true
|
455
455
|
)
|
456
|
-
Chef::Provider::Package::Yum::YumCache.stub
|
456
|
+
Chef::Provider::Package::Yum::YumCache.stub(:instance).and_return(@yum_cache)
|
457
457
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
458
458
|
@provider.load_current_resource
|
459
459
|
@provider.should_receive(:yum_command).with(
|
@@ -463,9 +463,9 @@ describe Chef::Provider::Package::Yum do
|
|
463
463
|
end
|
464
464
|
|
465
465
|
it "should run yum install then flush the cache if :after is true" do
|
466
|
-
@new_resource.stub
|
466
|
+
@new_resource.stub(:flush_cache).and_return({:after => true, :before => false})
|
467
467
|
@provider.load_current_resource
|
468
|
-
Chef::Provider::Package::Yum::RPMUtils.stub
|
468
|
+
Chef::Provider::Package::Yum::RPMUtils.stub(:rpmvercmp).and_return(-1)
|
469
469
|
@provider.should_receive(:yum_command).with(
|
470
470
|
"yum -d0 -e0 -y install emacs-1.0"
|
471
471
|
)
|
@@ -474,9 +474,9 @@ describe Chef::Provider::Package::Yum do
|
|
474
474
|
end
|
475
475
|
|
476
476
|
it "should run yum install then not flush the cache if :after is false" do
|
477
|
-
@new_resource.stub
|
477
|
+
@new_resource.stub(:flush_cache).and_return({:after => false, :before => false})
|
478
478
|
@provider.load_current_resource
|
479
|
-
Chef::Provider::Package::Yum::RPMUtils.stub
|
479
|
+
Chef::Provider::Package::Yum::RPMUtils.stub(:rpmvercmp).and_return(-1)
|
480
480
|
@provider.should_receive(:yum_command).with(
|
481
481
|
"yum -d0 -e0 -y install emacs-1.0"
|
482
482
|
)
|
@@ -489,7 +489,7 @@ describe Chef::Provider::Package::Yum do
|
|
489
489
|
it "should run yum install if the package is installed and a version is given" do
|
490
490
|
@provider.load_current_resource
|
491
491
|
@provider.candidate_version = '11'
|
492
|
-
Chef::Provider::Package::Yum::RPMUtils.stub
|
492
|
+
Chef::Provider::Package::Yum::RPMUtils.stub(:rpmvercmp).and_return(-1)
|
493
493
|
@provider.should_receive(:yum_command).with(
|
494
494
|
"yum -d0 -e0 -y install cups-11"
|
495
495
|
)
|
@@ -500,7 +500,7 @@ describe Chef::Provider::Package::Yum do
|
|
500
500
|
@provider.load_current_resource
|
501
501
|
@current_resource = Chef::Resource::Package.new('cups')
|
502
502
|
@provider.candidate_version = '11'
|
503
|
-
Chef::Provider::Package::Yum::RPMUtils.stub
|
503
|
+
Chef::Provider::Package::Yum::RPMUtils.stub(:rpmvercmp).and_return(-1)
|
504
504
|
@provider.should_receive(:yum_command).with(
|
505
505
|
"yum -d0 -e0 -y install cups-11"
|
506
506
|
)
|
@@ -508,7 +508,7 @@ describe Chef::Provider::Package::Yum do
|
|
508
508
|
end
|
509
509
|
|
510
510
|
it "should raise an exception if candidate version is older than the installed version" do
|
511
|
-
@yum_cache =
|
511
|
+
@yum_cache = double(
|
512
512
|
'Chef::Provider::Yum::YumCache',
|
513
513
|
:reload_installed => true,
|
514
514
|
:reset => true,
|
@@ -519,7 +519,7 @@ describe Chef::Provider::Package::Yum do
|
|
519
519
|
:allow_multi_install => [ "kernel" ],
|
520
520
|
:disable_extra_repo_control => true
|
521
521
|
)
|
522
|
-
Chef::Provider::Package::Yum::YumCache.stub
|
522
|
+
Chef::Provider::Package::Yum::YumCache.stub(:instance).and_return(@yum_cache)
|
523
523
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
524
524
|
@provider.load_current_resource
|
525
525
|
lambda { @provider.upgrade_package("cups", "1.2.4-11.15.el5") }.should raise_error(Chef::Exceptions::Package, %r{is newer than candidate package})
|
@@ -527,7 +527,7 @@ describe Chef::Provider::Package::Yum do
|
|
527
527
|
|
528
528
|
# Test our little workaround, some crossover into Chef::Provider::Package territory
|
529
529
|
it "should call action_upgrade in the parent if the current resource version is nil" do
|
530
|
-
@yum_cache.stub
|
530
|
+
@yum_cache.stub(:installed_version).and_return(nil)
|
531
531
|
@provider.load_current_resource
|
532
532
|
@current_resource = Chef::Resource::Package.new('cups')
|
533
533
|
@provider.candidate_version = '11'
|
@@ -558,7 +558,7 @@ describe Chef::Provider::Package::Yum do
|
|
558
558
|
end
|
559
559
|
|
560
560
|
it "should not call action_upgrade in the parent if the candidate is older" do
|
561
|
-
@yum_cache.stub
|
561
|
+
@yum_cache.stub(:installed_version).and_return("12")
|
562
562
|
@provider.load_current_resource
|
563
563
|
@current_resource = Chef::Resource::Package.new('cups')
|
564
564
|
@provider.candidate_version = '11'
|
@@ -576,7 +576,7 @@ describe Chef::Provider::Package::Yum do
|
|
576
576
|
end
|
577
577
|
|
578
578
|
it "should run yum remove with the package name and arch" do
|
579
|
-
@new_resource.stub
|
579
|
+
@new_resource.stub(:arch).and_return("x86_64")
|
580
580
|
@provider.should_receive(:yum_command).with(
|
581
581
|
"yum -d0 -e0 -y remove emacs-1.0.x86_64"
|
582
582
|
)
|
@@ -595,8 +595,8 @@ describe Chef::Provider::Package::Yum do
|
|
595
595
|
|
596
596
|
describe "when running yum" do
|
597
597
|
it "should run yum once if it exits with a return code of 0" do
|
598
|
-
@status =
|
599
|
-
@provider.stub
|
598
|
+
@status = double("Status", :exitstatus => 0)
|
599
|
+
@provider.stub(:output_of_command).and_return([@status, "", ""])
|
600
600
|
@provider.should_receive(:output_of_command).once.with(
|
601
601
|
"yum -d0 -e0 -y install emacs-1.0",
|
602
602
|
{:timeout => Chef::Config[:yum_timeout]}
|
@@ -605,8 +605,8 @@ describe Chef::Provider::Package::Yum do
|
|
605
605
|
end
|
606
606
|
|
607
607
|
it "should run yum once if it exits with a return code > 0 and no scriptlet failures" do
|
608
|
-
@status =
|
609
|
-
@provider.stub
|
608
|
+
@status = double("Status", :exitstatus => 2)
|
609
|
+
@provider.stub(:output_of_command).and_return([@status, "failure failure", "problem problem"])
|
610
610
|
@provider.should_receive(:output_of_command).once.with(
|
611
611
|
"yum -d0 -e0 -y install emacs-1.0",
|
612
612
|
{:timeout => Chef::Config[:yum_timeout]}
|
@@ -615,8 +615,8 @@ describe Chef::Provider::Package::Yum do
|
|
615
615
|
end
|
616
616
|
|
617
617
|
it "should run yum once if it exits with a return code of 1 and %pre scriptlet failures" do
|
618
|
-
@status =
|
619
|
-
@provider.stub
|
618
|
+
@status = double("Status", :exitstatus => 1)
|
619
|
+
@provider.stub(:output_of_command).and_return([@status, "error: %pre(demo-1-1.el5.centos.x86_64) scriptlet failed, exit status 2", ""])
|
620
620
|
@provider.should_receive(:output_of_command).once.with(
|
621
621
|
"yum -d0 -e0 -y install emacs-1.0",
|
622
622
|
{:timeout => Chef::Config[:yum_timeout]}
|
@@ -626,8 +626,8 @@ describe Chef::Provider::Package::Yum do
|
|
626
626
|
end
|
627
627
|
|
628
628
|
it "should run yum twice if it exits with a return code of 1 and %post scriptlet failures" do
|
629
|
-
@status =
|
630
|
-
@provider.stub
|
629
|
+
@status = double("Status", :exitstatus => 1)
|
630
|
+
@provider.stub(:output_of_command).and_return([@status, "error: %post(demo-1-1.el5.centos.x86_64) scriptlet failed, exit status 2", ""])
|
631
631
|
@provider.should_receive(:output_of_command).twice.with(
|
632
632
|
"yum -d0 -e0 -y install emacs-1.0",
|
633
633
|
{:timeout => Chef::Config[:yum_timeout]}
|
@@ -1543,8 +1543,8 @@ describe Chef::Provider::Package::Yum::YumCache do
|
|
1543
1543
|
end
|
1544
1544
|
|
1545
1545
|
before(:each) do
|
1546
|
-
@stdin =
|
1547
|
-
@stdout =
|
1546
|
+
@stdin = double("STDIN", :nil_object => true)
|
1547
|
+
@stdout = double("STDOUT", :nil_object => true)
|
1548
1548
|
|
1549
1549
|
@stdout_good = <<EOF
|
1550
1550
|
[option installonlypkgs] kernel kernel-bigmem kernel-enterprise
|
@@ -1586,13 +1586,13 @@ yum-dump Config Error: File contains no section headers.
|
|
1586
1586
|
file: file://///etc/yum.repos.d/CentOS-Base.repo, line: 12
|
1587
1587
|
'qeqwewe\n'
|
1588
1588
|
EOF
|
1589
|
-
@status =
|
1589
|
+
@status = double("Status", :exitstatus => 0, :stdin => @stdin, :stdout => @stdout_good, :stderr => @stderr)
|
1590
1590
|
|
1591
1591
|
# new singleton each time
|
1592
1592
|
Chef::Provider::Package::Yum::YumCache.reset_instance
|
1593
1593
|
@yc = Chef::Provider::Package::Yum::YumCache.instance
|
1594
1594
|
# load valid data
|
1595
|
-
@yc.stub
|
1595
|
+
@yc.stub(:shell_out!).and_return(@status)
|
1596
1596
|
end
|
1597
1597
|
|
1598
1598
|
describe "initialize" do
|
@@ -1642,29 +1642,29 @@ EOF
|
|
1642
1642
|
end
|
1643
1643
|
|
1644
1644
|
it "should warn about invalid data with too many separators" do
|
1645
|
-
@status =
|
1646
|
-
@yc.stub
|
1645
|
+
@status = double("Status", :exitstatus => 0, :stdin => @stdin, :stdout => @stdout_bad_separators, :stderr => @stderr)
|
1646
|
+
@yc.stub(:shell_out!).and_return(@status)
|
1647
1647
|
Chef::Log.should_receive(:warn).exactly(3).times.with(%r{Problem parsing})
|
1648
1648
|
@yc.refresh
|
1649
1649
|
end
|
1650
1650
|
|
1651
1651
|
it "should warn about invalid data with an incorrect type" do
|
1652
|
-
@status =
|
1653
|
-
@yc.stub
|
1652
|
+
@status = double("Status", :exitstatus => 0, :stdin => @stdin, :stdout => @stdout_bad_type, :stderr => @stderr)
|
1653
|
+
@yc.stub(:shell_out!).and_return(@status)
|
1654
1654
|
Chef::Log.should_receive(:warn).exactly(2).times.with(%r{Problem parsing})
|
1655
1655
|
@yc.refresh
|
1656
1656
|
end
|
1657
1657
|
|
1658
1658
|
it "should warn about no output from yum-dump.py" do
|
1659
|
-
@status =
|
1660
|
-
@yc.stub
|
1659
|
+
@status = double("Status", :exitstatus => 0, :stdin => @stdin, :stdout => @stdout_no_output, :stderr => @stderr)
|
1660
|
+
@yc.stub(:shell_out!).and_return(@status)
|
1661
1661
|
Chef::Log.should_receive(:warn).exactly(1).times.with(%r{no output from yum-dump.py})
|
1662
1662
|
@yc.refresh
|
1663
1663
|
end
|
1664
1664
|
|
1665
1665
|
it "should raise exception yum-dump.py exits with a non zero status" do
|
1666
|
-
@status =
|
1667
|
-
@yc.stub
|
1666
|
+
@status = double("Status", :exitstatus => 1, :stdin => @stdin, :stdout => @stdout_no_output, :stderr => @stderr)
|
1667
|
+
@yc.stub(:shell_out!).and_return(@status)
|
1668
1668
|
lambda { @yc.refresh}.should raise_error(Chef::Exceptions::Package, %r{CentOS-Base.repo, line: 12})
|
1669
1669
|
end
|
1670
1670
|
|
@@ -1690,8 +1690,8 @@ EOF
|
|
1690
1690
|
|
1691
1691
|
describe "installed_version" do
|
1692
1692
|
it "should take one or two arguments" do
|
1693
|
-
lambda { @yc.installed_version("zip") }.should_not raise_error
|
1694
|
-
lambda { @yc.installed_version("zip", "i386") }.should_not raise_error
|
1693
|
+
lambda { @yc.installed_version("zip") }.should_not raise_error
|
1694
|
+
lambda { @yc.installed_version("zip", "i386") }.should_not raise_error
|
1695
1695
|
lambda { @yc.installed_version("zip", "i386", "extra") }.should raise_error(ArgumentError)
|
1696
1696
|
end
|
1697
1697
|
|
@@ -1714,8 +1714,8 @@ EOF
|
|
1714
1714
|
|
1715
1715
|
describe "available_version" do
|
1716
1716
|
it "should take one or two arguments" do
|
1717
|
-
lambda { @yc.available_version("zisofs-tools") }.should_not raise_error
|
1718
|
-
lambda { @yc.available_version("zisofs-tools", "i386") }.should_not raise_error
|
1717
|
+
lambda { @yc.available_version("zisofs-tools") }.should_not raise_error
|
1718
|
+
lambda { @yc.available_version("zisofs-tools", "i386") }.should_not raise_error
|
1719
1719
|
lambda { @yc.available_version("zisofs-tools", "i386", "extra") }.should raise_error(ArgumentError)
|
1720
1720
|
end
|
1721
1721
|
|
@@ -1739,8 +1739,8 @@ EOF
|
|
1739
1739
|
describe "version_available?" do
|
1740
1740
|
it "should take two or three arguments" do
|
1741
1741
|
lambda { @yc.version_available?("zisofs-tools") }.should raise_error(ArgumentError)
|
1742
|
-
lambda { @yc.version_available?("zisofs-tools", "1.0.6-3.2.2") }.should_not raise_error
|
1743
|
-
lambda { @yc.version_available?("zisofs-tools", "1.0.6-3.2.2", "x86_64") }.should_not raise_error
|
1742
|
+
lambda { @yc.version_available?("zisofs-tools", "1.0.6-3.2.2") }.should_not raise_error
|
1743
|
+
lambda { @yc.version_available?("zisofs-tools", "1.0.6-3.2.2", "x86_64") }.should_not raise_error
|
1744
1744
|
end
|
1745
1745
|
|
1746
1746
|
it "should return true if our package-version-arch is available" do
|
@@ -1768,8 +1768,8 @@ EOF
|
|
1768
1768
|
describe "package_repository" do
|
1769
1769
|
it "should take two or three arguments" do
|
1770
1770
|
lambda { @yc.package_repository("zisofs-tools") }.should raise_error(ArgumentError)
|
1771
|
-
lambda { @yc.package_repository("zisofs-tools", "1.0.6-3.2.2") }.should_not raise_error
|
1772
|
-
lambda { @yc.package_repository("zisofs-tools", "1.0.6-3.2.2", "x86_64") }.should_not raise_error
|
1771
|
+
lambda { @yc.package_repository("zisofs-tools", "1.0.6-3.2.2") }.should_not raise_error
|
1772
|
+
lambda { @yc.package_repository("zisofs-tools", "1.0.6-3.2.2", "x86_64") }.should_not raise_error
|
1773
1773
|
end
|
1774
1774
|
|
1775
1775
|
it "should return repoid for package-version-arch" do
|