cuken 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +5 -3
- data/Gemfile.lock +61 -18
- data/LICENSE +13 -0
- data/NOTICE +3 -0
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/cucumber.yml +8 -0
- data/cuken.gemspec +397 -13
- data/examples/chef/features/support/env.rb +16 -0
- data/features/chef/cookbooks/cookbook.feature +14 -0
- data/features/chef/cookbooks/metadata.feature +40 -0
- data/features/chef/cookbooks/repo.feature +13 -0
- data/features/chef/knife.feature +140 -0
- data/features/chef/knife_steps.feature +19 -0
- data/features/command_steps.feature +68 -0
- data/features/commands.feature +5 -5
- data/features/common_steps.feature +13 -0
- data/features/data/Rakefile +38 -0
- data/features/data/apt/chef-integration-test-1.0/debian/changelog +5 -0
- data/features/data/apt/chef-integration-test-1.0/debian/compat +1 -0
- data/features/data/apt/chef-integration-test-1.0/debian/control +13 -0
- data/features/data/apt/chef-integration-test-1.0/debian/copyright +34 -0
- data/features/data/apt/chef-integration-test-1.0/debian/files +1 -0
- data/features/data/apt/chef-integration-test-1.0/debian/rules +13 -0
- data/features/data/apt/chef-integration-test-1.0/debian/source/format +1 -0
- data/features/data/apt/chef-integration-test-1.1/debian/changelog +11 -0
- data/features/data/apt/chef-integration-test-1.1/debian/compat +1 -0
- data/features/data/apt/chef-integration-test-1.1/debian/control +13 -0
- data/features/data/apt/chef-integration-test-1.1/debian/copyright +34 -0
- data/features/data/apt/chef-integration-test-1.1/debian/files +1 -0
- data/features/data/apt/chef-integration-test-1.1/debian/rules +13 -0
- data/features/data/apt/chef-integration-test-1.1/debian/source/format +1 -0
- data/features/data/apt/chef-integration-test_1.0-1_amd64.changes +22 -0
- data/features/data/apt/chef-integration-test_1.0-1_amd64.deb +0 -0
- data/features/data/apt/chef-integration-test_1.0.orig.tar.gz +0 -0
- data/features/data/apt/chef-integration-test_1.1-1_amd64.changes +22 -0
- data/features/data/apt/chef-integration-test_1.1-1_amd64.deb +0 -0
- data/features/data/apt/chef-integration-test_1.1.orig.tar.gz +0 -0
- data/features/data/apt/var/www/apt/conf/distributions +7 -0
- data/features/data/apt/var/www/apt/conf/incoming +4 -0
- data/features/data/apt/var/www/apt/conf/pulls +3 -0
- data/features/data/apt/var/www/apt/db/checksums.db +0 -0
- data/features/data/apt/var/www/apt/db/contents.cache.db +0 -0
- data/features/data/apt/var/www/apt/db/packages.db +0 -0
- data/features/data/apt/var/www/apt/db/references.db +0 -0
- data/features/data/apt/var/www/apt/db/release.caches.db +0 -0
- data/features/data/apt/var/www/apt/db/version +4 -0
- data/features/data/apt/var/www/apt/dists/sid/Release +19 -0
- data/features/data/apt/var/www/apt/dists/sid/main/binary-amd64/Packages +16 -0
- data/features/data/apt/var/www/apt/dists/sid/main/binary-amd64/Packages.gz +0 -0
- data/features/data/apt/var/www/apt/dists/sid/main/binary-amd64/Release +5 -0
- data/features/data/apt/var/www/apt/pool/main/c/chef-integration-test/chef-integration-test_1.0-1_amd64.deb +0 -0
- data/features/data/apt/var/www/apt/pool/main/c/chef-integration-test/chef-integration-test_1.1-1_amd64.deb +0 -0
- data/features/data/config/client.rb +23 -0
- data/features/data/config/client_with_checksum_caching.rb +23 -0
- data/features/data/config/knife-stephen.rb +12 -0
- data/features/data/config/knife.rb +11 -0
- data/features/data/config/rake.rb +57 -0
- data/features/data/config/server.rb +52 -0
- data/features/data/cookbook_tarballs/empty_tarball.tar.gz +0 -0
- data/features/data/cookbook_tarballs/new.tar.gz +0 -0
- data/features/data/cookbook_tarballs/not_a_tarball.txt +1 -0
- data/features/data/cookbook_tarballs/original.tar.gz +0 -0
- data/features/data/cookbooks/attribute_include/README.rdoc +8 -0
- data/features/data/cookbooks/attribute_include/attributes/a.rb +4 -0
- data/features/data/cookbooks/attribute_include/attributes/b.rb +2 -0
- data/features/data/cookbooks/attribute_include/metadata.rb +6 -0
- data/features/data/cookbooks/attribute_include/recipes/default.rb +23 -0
- data/features/data/cookbooks/attribute_include_default/README.rdoc +8 -0
- data/features/data/cookbooks/attribute_include_default/attributes/a.rb +5 -0
- data/features/data/cookbooks/attribute_include_default/attributes/default.rb +2 -0
- data/features/data/cookbooks/attribute_include_default/metadata.rb +6 -0
- data/features/data/cookbooks/attribute_include_default/recipes/default.rb +23 -0
- data/features/data/cookbooks/attribute_settings/README.rdoc +8 -0
- data/features/data/cookbooks/attribute_settings/attributes/default.rb +3 -0
- data/features/data/cookbooks/attribute_settings/default.rb +1 -0
- data/features/data/cookbooks/attribute_settings/metadata.rb +6 -0
- data/features/data/cookbooks/attribute_settings/recipes/default.rb +21 -0
- data/features/data/cookbooks/attribute_settings/recipes/default_in_recipe.rb +25 -0
- data/features/data/cookbooks/attribute_settings_normal/README.rdoc +8 -0
- data/features/data/cookbooks/attribute_settings_normal/attributes/.default.rb.swo +0 -0
- data/features/data/cookbooks/attribute_settings_normal/attributes/default.rb +2 -0
- data/features/data/cookbooks/attribute_settings_normal/default.rb +1 -0
- data/features/data/cookbooks/attribute_settings_normal/metadata.rb +6 -0
- data/features/data/cookbooks/attribute_settings_normal/recipes/.default.rb.swo +0 -0
- data/features/data/cookbooks/attribute_settings_normal/recipes/.default_in_recipe.rb.swo +0 -0
- data/features/data/cookbooks/attribute_settings_normal/recipes/default.rb +21 -0
- data/features/data/cookbooks/attribute_settings_normal/recipes/normal_in_recipe.rb +25 -0
- data/features/data/cookbooks/attribute_settings_override/README.rdoc +8 -0
- data/features/data/cookbooks/attribute_settings_override/attributes/default.rb +2 -0
- data/features/data/cookbooks/attribute_settings_override/default.rb +1 -0
- data/features/data/cookbooks/attribute_settings_override/metadata.rb +6 -0
- data/features/data/cookbooks/attribute_settings_override/recipes/default.rb +21 -0
- data/features/data/cookbooks/attribute_settings_override/recipes/normal_in_recipe.rb +25 -0
- data/features/data/cookbooks/attribute_settings_override/recipes/override_in_recipe.rb +21 -0
- data/features/data/cookbooks/delayed_notifications/recipes/bad_syntax_notifies.rb +14 -0
- data/features/data/cookbooks/delayed_notifications/recipes/default.rb +18 -0
- data/features/data/cookbooks/delayed_notifications/recipes/forward_references.rb +10 -0
- data/features/data/cookbooks/delayed_notifications/recipes/invalid_forward_reference.rb +16 -0
- data/features/data/cookbooks/delayed_notifications/recipes/notify_a_resource_from_a_single_source.rb +26 -0
- data/features/data/cookbooks/delayed_notifications/recipes/notify_a_resource_from_multiple_sources.rb +31 -0
- data/features/data/cookbooks/delayed_notifications/recipes/notify_different_resources_for_different_actions.rb +31 -0
- data/features/data/cookbooks/deploy/recipes/callbacks.rb +78 -0
- data/features/data/cookbooks/deploy/recipes/default.rb +51 -0
- data/features/data/cookbooks/deploy/recipes/deploy_commit1.rb +25 -0
- data/features/data/cookbooks/deploy/recipes/deploy_commit2.rb +25 -0
- data/features/data/cookbooks/deploy/recipes/embedded_recipe_callbacks.rb +70 -0
- data/features/data/cookbooks/deploy/recipes/revision_deploy.rb +51 -0
- data/features/data/cookbooks/deploy/recipes/rollback_commit2.rb +24 -0
- data/features/data/cookbooks/deploy/templates/default/app_config.yml.erb +23 -0
- data/features/data/cookbooks/deploy/templates/default/database.yml.erb +18 -0
- data/features/data/cookbooks/deploy/templates/default/embedded_recipe_before_symlink.rb.erb +4 -0
- data/features/data/cookbooks/deploy/templates/default/sneaky_after_restart_hook.rb.erb +4 -0
- data/features/data/cookbooks/deploy/templates/default/sneaky_before_migrate_hook.rb.erb +2 -0
- data/features/data/cookbooks/deploy/templates/default/sneaky_before_restart_hook.rb.erb +4 -0
- data/features/data/cookbooks/deploy/templates/default/sneaky_before_symlink_hook.rb.erb +2 -0
- data/features/data/cookbooks/directory_provider/recipes/create.rb +25 -0
- data/features/data/cookbooks/directory_provider/recipes/default.rb +18 -0
- data/features/data/cookbooks/directory_provider/recipes/delete.rb +29 -0
- data/features/data/cookbooks/directory_provider/recipes/delete_nonexistent.rb +23 -0
- data/features/data/cookbooks/directory_provider/recipes/owner_update.rb +31 -0
- data/features/data/cookbooks/directory_provider/recipes/set_the_accessibility_of_a_created_directory.rb +55 -0
- data/features/data/cookbooks/execute_commands/metadata.rb +5 -0
- data/features/data/cookbooks/execute_commands/recipes/4k.rb +25 -0
- data/features/data/cookbooks/execute_commands/recipes/debug.rb +22 -0
- data/features/data/cookbooks/execute_commands/recipes/default.rb +22 -0
- data/features/data/cookbooks/execute_commands/recipes/umask.rb +23 -0
- data/features/data/cookbooks/integration_setup/attributes/integration.rb +25 -0
- data/features/data/cookbooks/integration_setup/recipes/default.rb +24 -0
- data/features/data/cookbooks/lwrp/providers/default.rb +9 -0
- data/features/data/cookbooks/lwrp/providers/lwp_non_default.rb +3 -0
- data/features/data/cookbooks/lwrp/providers/lwp_overridden_load_current_resource.rb +8 -0
- data/features/data/cookbooks/lwrp/providers/provider_is_omitted.rb +3 -0
- data/features/data/cookbooks/lwrp/recipes/default_everything.rb +4 -0
- data/features/data/cookbooks/lwrp/recipes/non_default_provider.rb +6 -0
- data/features/data/cookbooks/lwrp/recipes/non_default_resource.rb +6 -0
- data/features/data/cookbooks/lwrp/recipes/overridden_provider_load_current_resource.rb +6 -0
- data/features/data/cookbooks/lwrp/recipes/overridden_resource_initialize.rb +6 -0
- data/features/data/cookbooks/lwrp/recipes/provider_invokes_resource.rb +6 -0
- data/features/data/cookbooks/lwrp/recipes/provider_is_a_class.rb +6 -0
- data/features/data/cookbooks/lwrp/recipes/provider_is_a_string.rb +6 -0
- data/features/data/cookbooks/lwrp/recipes/provider_is_a_symbol.rb +6 -0
- data/features/data/cookbooks/lwrp/recipes/provider_is_omitted.rb +3 -0
- data/features/data/cookbooks/lwrp/resources/default.rb +4 -0
- data/features/data/cookbooks/lwrp/resources/lwr_non_default.rb +3 -0
- data/features/data/cookbooks/lwrp/resources/lwr_overridden_initialize.rb +8 -0
- data/features/data/cookbooks/lwrp/resources/provider_is_omitted.rb +1 -0
- data/features/data/cookbooks/manage_files/recipes/create_a_file.rb +22 -0
- data/features/data/cookbooks/manage_files/recipes/default.rb +19 -0
- data/features/data/cookbooks/manage_files/recipes/delete_a_file.rb +24 -0
- data/features/data/cookbooks/manage_files/recipes/delete_a_file_that_does_not_already_exist.rb +22 -0
- data/features/data/cookbooks/manage_files/recipes/manage_file_contents.rb +23 -0
- data/features/data/cookbooks/manage_files/recipes/set_the_accessibility_of_a_created_file.rb +79 -0
- data/features/data/cookbooks/manage_files/recipes/set_the_owner_of_a_created_file.rb +23 -0
- data/features/data/cookbooks/manage_files/recipes/touch_a_file.rb +22 -0
- data/features/data/cookbooks/metadata/metadata.rb +17 -0
- data/features/data/cookbooks/metadata/recipes/default.rb +18 -0
- data/features/data/cookbooks/no_attributes/README.rdoc +8 -0
- data/features/data/cookbooks/no_attributes/metadata.rb +6 -0
- data/features/data/cookbooks/no_attributes/recipes/default.rb +21 -0
- data/features/data/cookbooks/node_cookbook_sync/README.rdoc +8 -0
- data/features/data/cookbooks/node_cookbook_sync/attributes/attr_file.rb +0 -0
- data/features/data/cookbooks/node_cookbook_sync/definitions/def_file.rb +0 -0
- data/features/data/cookbooks/node_cookbook_sync/libraries/lib_file.rb +0 -0
- data/features/data/cookbooks/node_cookbook_sync/metadata.rb +6 -0
- data/features/data/cookbooks/node_cookbook_sync/recipes/default.rb +18 -0
- data/features/data/cookbooks/packages/recipes/default.rb +0 -0
- data/features/data/cookbooks/packages/recipes/gem_package.rb +26 -0
- data/features/data/cookbooks/packages/recipes/install_apt_package.rb +3 -0
- data/features/data/cookbooks/packages/recipes/install_dpkg_package.rb +4 -0
- data/features/data/cookbooks/packages/recipes/install_gem_noshell.rb +26 -0
- data/features/data/cookbooks/packages/recipes/install_gem_package_twice.rb +26 -0
- data/features/data/cookbooks/packages/recipes/macports_install_bad_package.rb +3 -0
- data/features/data/cookbooks/packages/recipes/macports_install_yydecode.rb +3 -0
- data/features/data/cookbooks/packages/recipes/macports_purge_yydecode.rb +3 -0
- data/features/data/cookbooks/packages/recipes/macports_remove_yydecode.rb +3 -0
- data/features/data/cookbooks/packages/recipes/macports_upgrade_yydecode.rb +7 -0
- data/features/data/cookbooks/packages/recipes/manually_upgrade_gem_package.rb +32 -0
- data/features/data/cookbooks/packages/recipes/upgrade_gem_noshell.rb +33 -0
- data/features/data/cookbooks/packages/recipes/upgrade_gem_package.rb +33 -0
- data/features/data/cookbooks/recipe_include/README.rdoc +8 -0
- data/features/data/cookbooks/recipe_include/metadata.rb +6 -0
- data/features/data/cookbooks/recipe_include/recipes/default.rb +21 -0
- data/features/data/cookbooks/recipe_include/recipes/second.rb +23 -0
- data/features/data/cookbooks/roles/recipes/default.rb +26 -0
- data/features/data/cookbooks/roles/recipes/env_test.rb +25 -0
- data/features/data/cookbooks/run_interval/recipes/default.rb +27 -0
- data/features/data/cookbooks/scm/metadata.rb +8 -0
- data/features/data/cookbooks/scm/recipes/git.rb +25 -0
- data/features/data/cookbooks/search/attributes/search_attrs.rb +1 -0
- data/features/data/cookbooks/search/recipes/default.rb +18 -0
- data/features/data/cookbooks/search/recipes/search_data.rb +28 -0
- data/features/data/cookbooks/search/recipes/search_data_manual.rb +33 -0
- data/features/data/cookbooks/search/recipes/search_data_noblock.rb +32 -0
- data/features/data/cookbooks/show_cookbook/README.rdoc +8 -0
- data/features/data/cookbooks/show_cookbook/attributes/attr_file.rb +0 -0
- data/features/data/cookbooks/show_cookbook/definitions/def_file.rb +0 -0
- data/features/data/cookbooks/show_cookbook/files/default/prime_time.txt +0 -0
- data/features/data/cookbooks/show_cookbook/files/host-latte/prime_time.txt +0 -0
- data/features/data/cookbooks/show_cookbook/files/mac_os_x-10.5/prime_time.txt +0 -0
- data/features/data/cookbooks/show_cookbook/files/mac_os_x/prime_time.txt +0 -0
- data/features/data/cookbooks/show_cookbook/libraries/lib_file.rb +0 -0
- data/features/data/cookbooks/show_cookbook/metadata.rb +6 -0
- data/features/data/cookbooks/show_cookbook/recipes/default.rb +18 -0
- data/features/data/cookbooks/show_cookbook/templates/default/prime_time.txt.erb +0 -0
- data/features/data/cookbooks/show_cookbook/templates/host-latte/prime_time.txt.erb +0 -0
- data/features/data/cookbooks/show_cookbook/templates/mac_os_x-10.5/prime_time.txt.erb +0 -0
- data/features/data/cookbooks/show_cookbook/templates/mac_os_x/prime_time.txt.erb +0 -0
- data/features/data/cookbooks/synchronize/recipes/default.rb +18 -0
- data/features/data/cookbooks/synchronize_deps/metadata.json +30 -0
- data/features/data/cookbooks/synchronize_deps/metadata.rb +1 -0
- data/features/data/cookbooks/synchronize_deps/recipes/default.rb +18 -0
- data/features/data/cookbooks/template/README.rdoc +8 -0
- data/features/data/cookbooks/template/metadata.rb +6 -0
- data/features/data/cookbooks/template/recipes/default.rb +26 -0
- data/features/data/cookbooks/template/recipes/interval.rb +37 -0
- data/features/data/cookbooks/template/recipes/render_node_attrs.rb +26 -0
- data/features/data/cookbooks/template/templates/default/node.txt.erb +3 -0
- data/features/data/cookbooks/template/templates/default/template.txt.erb +1 -0
- data/features/data/cookbooks/transfer_remote_directories/files/default/transfer_directory_feature/bar.txt +1 -0
- data/features/data/cookbooks/transfer_remote_directories/files/default/transfer_directory_feature/baz.txt +1 -0
- data/features/data/cookbooks/transfer_remote_directories/files/default/transfer_directory_feature/foo.txt +1 -0
- data/features/data/cookbooks/transfer_remote_directories/recipes/transfer_directory.rb +29 -0
- data/features/data/cookbooks/transfer_remote_files/files/default/transfer_a_file_from_a_cookbook.txt +1 -0
- data/features/data/cookbooks/transfer_remote_files/metadata.json +30 -0
- data/features/data/cookbooks/transfer_remote_files/metadata.rb +1 -0
- data/features/data/cookbooks/transfer_remote_files/recipes/change_remote_file_perms_trickery.rb +33 -0
- data/features/data/cookbooks/transfer_remote_files/recipes/default.rb +18 -0
- data/features/data/cookbooks/transfer_remote_files/recipes/should_prefer_the_file_for_this_specific_host.rb +22 -0
- data/features/data/cookbooks/transfer_remote_files/recipes/transfer_a_file_from_a_cookbook.rb +22 -0
- data/features/data/cookbooks/transfer_remote_files/recipes/transfer_a_file_from_a_specific_cookbook.rb +20 -0
- data/features/data/cookbooks/transfer_remote_files/recipes/transfer_a_non-existent_file_from_a_cookbook.rb +22 -0
- data/features/data/cookbooks/transfer_remote_files_definition/definitions/transfer.rb +6 -0
- data/features/data/cookbooks/transfer_remote_files_definition/files/default/easy.txt +1 -0
- data/features/data/cookbooks/transfer_some_cookbook_files/files/default/should_be_transferred.txt +3 -0
- data/features/data/cookbooks/transfer_some_cookbook_files/files/default/should_not_be_transferred.txt +2 -0
- data/features/data/cookbooks/transfer_some_cookbook_files/recipes/default.rb +26 -0
- data/features/data/cookbooks/transfer_some_cookbook_files/templates/default/should_be_transferred.erb +2 -0
- data/features/data/cookbooks/transfer_some_cookbook_files/templates/default/should_not_be_transferred.erb +3 -0
- data/features/data/cookbooks/version_deps/metadata.rb +1 -0
- data/features/data/cookbooks/version_deps/recipes/default.rb +1 -0
- data/features/data/cookbooks/versions/metadata.rb +5 -0
- data/features/data/cookbooks/versions/recipes/default.rb +5 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_1.0.0/metadata.json +31 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_1.0.0/metadata.rb +8 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_1.0.0/recipes/default.rb +18 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_2.0.0/metadata.json +29 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_2.0.0/metadata.rb +6 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_2.0.0/recipes/default.rb +18 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_3.0.0/metadata.json +30 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_3.0.0/metadata.rb +7 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_3.0.0/recipes/default.rb +18 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_1.0.0/metadata.json +31 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_1.0.0/metadata.rb +8 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_1.0.0/recipes/default.rb +18 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_2.0.0/metadata.json +31 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_2.0.0/metadata.rb +8 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_2.0.0/recipes/default.rb +18 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_3.0.0/metadata.json +30 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_3.0.0/metadata.rb +7 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_3.0.0/recipes/default.rb +18 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_1.0.0/metadata.json +31 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_1.0.0/metadata.rb +8 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_1.0.0/recipes/default.rb +18 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_2.0.0/metadata.json +29 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_2.0.0/metadata.rb +6 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_2.0.0/recipes/default.rb +18 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_3.0.0/metadata.json +29 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_3.0.0/metadata.rb +6 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_3.0.0/recipes/default.rb +18 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/test_cookbook/attributes/attr1.rb +1 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/test_cookbook/attributes/attr2.rb +1 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/test_cookbook/recipes/default.rb +2 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_invalid_empty_except_metadata/metadata.json +38 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_invalid_empty_except_metadata/metadata.rb +6 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_invalid_nometadata/attributes/attributes.rb +1 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_invalid_nometadata/recipes/default.rb +2 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid/attributes/attributes.rb +1 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid/metadata.json +38 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid/metadata.rb +6 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid/recipes/default.rb +2 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.1.0_with_different_dependencies/attributes/attributes.rb +1 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.1.0_with_different_dependencies/metadata.json +40 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.1.0_with_different_dependencies/metadata.rb +7 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.1.0_with_different_dependencies/recipes/default.rb +2 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.2.0/attributes/attributes.rb +1 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.2.0/metadata.json +38 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.2.0/metadata.rb +6 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.2.0/recipes/default.rb +2 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_wrong_metadata/metadata.json +40 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_wrong_metadata/recipes/default.rb +1 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.1.0/metadata.json +39 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.1.0/metadata.rb +6 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.1.0/recipes/default.rb +18 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.1.1/metadata.json +39 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.1.1/metadata.rb +6 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.1.1/recipes/default.rb +18 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.10.0/metadata.json +39 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.10.0/metadata.rb +6 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.10.0/recipes/default.rb +18 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.2.0/metadata.json +39 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.2.0/metadata.rb +6 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.2.0/recipes/default.rb +18 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.0/metadata.json +39 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.0/metadata.rb +6 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.0/recipes/default.rb +18 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.7/metadata.json +39 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.7/metadata.rb +6 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.7/recipes/default.rb +18 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/version_updated/attributes/attributes.rb +1 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/version_updated/metadata.json +29 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/version_updated/metadata.rb +6 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/version_updated/recipes/default.rb +2 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/versions/metadata.json +38 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/versions/metadata.rb +5 -0
- data/features/data/cookbooks_not_uploaded_at_feature_start/versions/recipes/default.rb +5 -0
- data/features/data/gems/Marshal.4.8 +0 -0
- data/features/data/gems/Marshal.4.8.Z +0 -0
- data/features/data/gems/latest_specs.4.8 +0 -0
- data/features/data/gems/latest_specs.4.8.gz +0 -0
- data/features/data/gems/prerelease_specs.4.8 +0 -0
- data/features/data/gems/prerelease_specs.4.8.gz +0 -0
- data/features/data/gems/quick/Marshal.4.8/chef-integration-test-0.1.0.gemspec.rz +0 -0
- data/features/data/gems/quick/Marshal.4.8/chef-integration-test-0.1.1.gemspec.rz +0 -0
- data/features/data/gems/quick/chef-integration-test-0.1.0.gemspec.rz +0 -0
- data/features/data/gems/quick/chef-integration-test-0.1.1.gemspec.rz +0 -0
- data/features/data/gems/quick/index +2 -0
- data/features/data/gems/quick/index.rz +0 -0
- data/features/data/gems/quick/latest_index +1 -0
- data/features/data/gems/quick/latest_index.rz +0 -0
- data/features/data/gems/specs.4.8 +0 -0
- data/features/data/gems/specs.4.8.gz +0 -0
- data/features/data/gems/yaml +122 -0
- data/features/data/gems/yaml.Z +0 -0
- data/features/data/json_attribs/attribute_settings.json +3 -0
- data/features/data/json_attribs/json_runlist_and_attrs.json +4 -0
- data/features/data/myapp.bundle +0 -0
- data/features/data/node-load-test.rb +84 -0
- data/features/data/node-simple.rb +18 -0
- data/features/data/repositories/chef-repo/.gitignore +2 -0
- data/features/data/repositories/chef-repo/README.md +66 -0
- data/features/data/repositories/chef-repo/Rakefile +65 -0
- data/features/data/repositories/chef-repo/certificates/README.md +19 -0
- data/features/data/repositories/chef-repo/config/rake.rb +38 -0
- data/features/data/repositories/chef-repo/cookbooks/README.md +53 -0
- data/features/data/repositories/chef-repo/data_bags/README.md +23 -0
- data/features/data/repositories/chef-repo/roles/README.md +16 -0
- data/features/data/repositories/cookbooks/hosts/attributes/hosts.rb +1 -0
- data/features/data/repositories/cookbooks/hosts/cc.gemspec +36 -0
- data/features/data/repositories/cookbooks/hosts/metadata.json +41 -0
- data/features/data/repositories/cookbooks/hosts/metadata.rb +4 -0
- data/features/data/repositories/cookbooks/hosts/recipes/default.rb +6 -0
- data/features/data/repositories/cookbooks/hosts/templates/default/hosts.erb +27 -0
- data/features/data/search-tests/do_knife_search_test.rb +175 -0
- data/features/data/search-tests/search-test-nodes.rb +174 -0
- data/features/data/test_git_repo.tar.gz +0 -0
- data/features/file_steps.feature +70 -0
- data/features/files.feature +30 -16
- data/features/ssh.feature +2 -1
- data/features/ssh_steps.feature +20 -0
- data/features/step_definitions/cuken_steps.rb +10 -0
- data/features/support/env.rb +1 -0
- data/lib/cuken/api/chef.rb +115 -0
- data/lib/cuken/api/chef/common.rb +80 -0
- data/lib/cuken/api/file.rb +23 -3
- data/lib/cuken/chef.rb +3 -0
- data/lib/cuken/common.rb +0 -1
- data/lib/cuken/cucumber/chef.rb +16 -0
- data/lib/cuken/cucumber/chef/common.rb +68 -0
- data/lib/cuken/cucumber/chef/cookbook.rb +75 -0
- data/lib/cuken/cucumber/chef/cookbook_steps.rb +406 -0
- data/lib/cuken/cucumber/chef/deploy_steps.rb +84 -0
- data/lib/cuken/cucumber/chef/done_directory_steps.rb +41 -0
- data/lib/cuken/cucumber/chef/done_file_steps.rb +107 -0
- data/lib/cuken/cucumber/chef/done_knife_steps.rb +34 -0
- data/lib/cuken/cucumber/chef/fixture_steps.rb +413 -0
- data/lib/cuken/cucumber/chef/knife.rb +34 -0
- data/lib/cuken/cucumber/chef/node.rb +27 -0
- data/lib/cuken/cucumber/chef/node_steps.rb +88 -0
- data/lib/cuken/cucumber/chef/packages.rb +144 -0
- data/lib/cuken/cucumber/chef/pending_steps.rb +21 -0
- data/lib/cuken/cucumber/chef/recipe_steps.rb +23 -0
- data/lib/cuken/cucumber/chef/request_steps.rb +98 -0
- data/lib/cuken/cucumber/chef/response_steps.rb +233 -0
- data/lib/cuken/cucumber/chef/result_steps.rb +15 -0
- data/lib/cuken/cucumber/chef/run_client_steps.rb +260 -0
- data/lib/cuken/cucumber/chef/run_solo.rb +78 -0
- data/lib/cuken/cucumber/chef/sandbox_steps.rb +137 -0
- data/lib/cuken/cucumber/chef/search_steps.rb +70 -0
- data/lib/cuken/cucumber/chef/webrat_steps.rb +39 -0
- data/lib/cuken/cucumber/cmd.rb +18 -1
- data/lib/cuken/cucumber/common.rb +4 -0
- data/lib/cuken/cucumber/file.rb +25 -27
- data/lib/cuken/cucumber/ssh.rb +6 -6
- metadata +427 -27
- data/LICENSE.txt +0 -20
@@ -0,0 +1,15 @@
|
|
1
|
+
Then /^I should see "(.*)"$/ do |text|
|
2
|
+
response.body.to_s.should =~ /#{text}/m
|
3
|
+
end
|
4
|
+
|
5
|
+
Then /^I should not see "(.*)"$/ do |text|
|
6
|
+
response.body.to_s.should_not =~ /#{text}/m
|
7
|
+
end
|
8
|
+
|
9
|
+
Then /^I should see an? (\w+) message$/ do |message_type|
|
10
|
+
response.should have_xpath("//*[@class='#{message_type}']")
|
11
|
+
end
|
12
|
+
|
13
|
+
Then /^the (.*) ?request should fail/ do |_|
|
14
|
+
response.should_not be_successful
|
15
|
+
end
|
@@ -0,0 +1,260 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Adam Jacob (<adam@opscode.com>)
|
3
|
+
# Copyright:: Copyright (c) 2008 Opscode, Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require 'chef/shell_out'
|
20
|
+
require 'chef/mixin/shell_out'
|
21
|
+
|
22
|
+
include Chef::Mixin::ShellOut
|
23
|
+
|
24
|
+
CHEF_CLIENT = File.join(CHEF_PROJECT_ROOT, "chef", "bin", "chef-client")
|
25
|
+
|
26
|
+
def chef_client_command_string
|
27
|
+
@log_level ||= ENV["LOG_LEVEL"] ? ENV["LOG_LEVEL"] : "error"
|
28
|
+
@chef_args ||= ""
|
29
|
+
@config_file ||= File.expand_path(File.join(configdir, 'client.rb'))
|
30
|
+
|
31
|
+
"#{File.join(File.dirname(__FILE__), "..", "..", "chef", "bin", "chef-client")} -l #{@log_level} -c #{@config_file} #{@chef_args}"
|
32
|
+
end
|
33
|
+
|
34
|
+
###
|
35
|
+
# When
|
36
|
+
###
|
37
|
+
When /^I run the chef\-client$/ do
|
38
|
+
status = Chef::Mixin::Command.popen4(chef_client_command_string()) do |p, i, o, e|
|
39
|
+
@stdout = o.gets(nil)
|
40
|
+
@stderr = e.gets(nil)
|
41
|
+
end
|
42
|
+
@status = status
|
43
|
+
end
|
44
|
+
|
45
|
+
When "I run the chef-client for no more than '$timeout' seconds" do |timeout|
|
46
|
+
cmd = shell_out("#{CHEF_CLIENT} -l info -i 1 -s 1 -c #{File.expand_path(File.join(configdir, 'client.rb'))}", :timeout => timeout.to_i)
|
47
|
+
@status = cmd.status
|
48
|
+
end
|
49
|
+
|
50
|
+
When /^I run the chef\-client again$/ do
|
51
|
+
When "I run the chef-client"
|
52
|
+
end
|
53
|
+
|
54
|
+
When /^I run the chef\-client with '(.+)'$/ do |args|
|
55
|
+
@chef_args = args
|
56
|
+
When "I run the chef-client"
|
57
|
+
end
|
58
|
+
|
59
|
+
When "I run the chef-client with '$options' and the '$config_file' config" do |options, config_file|
|
60
|
+
@config_file = File.expand_path(File.join(configdir, "#{config_file}.rb"))
|
61
|
+
@chef_args = options
|
62
|
+
When "I run the chef-client"
|
63
|
+
end
|
64
|
+
|
65
|
+
When /^I run the chef\-client with '(.+)' for '(.+)' seconds$/ do |args, run_for|
|
66
|
+
@chef_args = args
|
67
|
+
When "I run the chef-client for '#{run_for}' seconds"
|
68
|
+
end
|
69
|
+
|
70
|
+
When /^I run the chef\-client for '(.+)' seconds$/ do |run_for|
|
71
|
+
# Normal behavior depends on the run_interval/recipes/default.rb to count down
|
72
|
+
# and exit subordinate chef-client after two runs. However, we will forcably
|
73
|
+
# kill the client if that didn't work.
|
74
|
+
begin
|
75
|
+
stdout_filename = "/tmp/chef.run_interval.stdout.#{$$}.txt"
|
76
|
+
stderr_filename = "/tmp/chef.run_interval.stderr.#{$$}.txt"
|
77
|
+
client_pid = Process.fork do
|
78
|
+
STDOUT.reopen(File.open(stdout_filename, "w"))
|
79
|
+
STDERR.reopen(File.open(stderr_filename, "w"))
|
80
|
+
exec chef_client_command_string()
|
81
|
+
exit 2
|
82
|
+
end
|
83
|
+
|
84
|
+
killer_pid = Process.fork {
|
85
|
+
sleep run_for.to_i
|
86
|
+
|
87
|
+
# Send KILL to the child chef-client. Due to OHAI-223, where ohai sometimes
|
88
|
+
# ignores/doesn't exit correctly on receipt of SIGINT, brutally kill the
|
89
|
+
# subprocess.
|
90
|
+
begin
|
91
|
+
Process.kill("KILL", client_pid)
|
92
|
+
rescue Errno::ESRCH
|
93
|
+
# Kill didn't work; the process exited while we were waiting, like
|
94
|
+
# it's supposed to.
|
95
|
+
end
|
96
|
+
}
|
97
|
+
|
98
|
+
Process.waitpid2(killer_pid)
|
99
|
+
@status = Process.waitpid2(client_pid).last
|
100
|
+
|
101
|
+
# Read these in so they can be used in later steps.
|
102
|
+
@stdout = IO.read(stdout_filename)
|
103
|
+
@stderr = IO.read(stderr_filename)
|
104
|
+
ensure
|
105
|
+
# clean up after ourselves.
|
106
|
+
File.delete(stdout_filename)
|
107
|
+
File.delete(stderr_filename)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
When /^I run the chef\-client at log level '(.+)'$/ do |log_level|
|
112
|
+
@log_level = log_level.to_sym
|
113
|
+
When "I run the chef-client"
|
114
|
+
end
|
115
|
+
|
116
|
+
When 'I run the chef-client with json attributes' do
|
117
|
+
@log_level = :debug
|
118
|
+
@chef_args = "-j #{File.join(FEATURES_DATA, 'json_attribs', 'attribute_settings.json')}"
|
119
|
+
When "I run the chef-client"
|
120
|
+
end
|
121
|
+
|
122
|
+
When "I run the chef-client with json attributes '$json_file_basename'" do |json_file_basename|
|
123
|
+
@log_level = :debug
|
124
|
+
@chef_args = "-j #{File.join(FEATURES_DATA, 'json_attribs', "#{json_file_basename}.json")}"
|
125
|
+
When "I run the chef-client"
|
126
|
+
end
|
127
|
+
|
128
|
+
When /^I run the chef\-client with config file '(.+)'$/ do |config_file|
|
129
|
+
@config_file = config_file
|
130
|
+
When "I run the chef-client"
|
131
|
+
end
|
132
|
+
|
133
|
+
When /^I run the chef\-client with logging to the file '(.+)'$/ do |log_file|
|
134
|
+
|
135
|
+
config_data = <<CONFIG
|
136
|
+
supportdir = File.expand_path(File.join(File.dirname(__FILE__), ".."))
|
137
|
+
tmpdir = File.expand_path(File.join(File.dirname(__FILE__), "..", "tmp"))
|
138
|
+
|
139
|
+
log_level :debug
|
140
|
+
log_location File.join(tmpdir, "silly-monkey.log")
|
141
|
+
file_cache_path File.join(tmpdir, "cache")
|
142
|
+
ssl_verify_mode :verify_none
|
143
|
+
registration_url "http://127.0.0.1:4000"
|
144
|
+
template_url "http://127.0.0.1:4000"
|
145
|
+
remotefile_url "http://127.0.0.1:4000"
|
146
|
+
search_url "http://127.0.0.1:4000"
|
147
|
+
role_url "http://127.0.0.1:4000"
|
148
|
+
client_url "http://127.0.0.1:4000"
|
149
|
+
chef_server_url "http://127.0.0.1:4000"
|
150
|
+
validation_client_name "validator"
|
151
|
+
systmpdir = File.expand_path(File.join(Dir.tmpdir, "chef_integration"))
|
152
|
+
validation_key File.join(systmpdir, "validation.pem")
|
153
|
+
client_key File.join(systmpdir, "client.pem")
|
154
|
+
CONFIG
|
155
|
+
|
156
|
+
@config_file = File.expand_path(File.join(File.dirname(__FILE__), '..', 'data', 'config', 'client-with-logging.rb'))
|
157
|
+
File.open(@config_file, "w") do |file|
|
158
|
+
file.write(config_data)
|
159
|
+
end
|
160
|
+
|
161
|
+
self.cleanup_files << @config_file
|
162
|
+
|
163
|
+
|
164
|
+
@status = Chef::Mixin::Command.popen4("#{File.join(File.dirname(__FILE__), "..", "..", "chef", "bin", "chef-client")} -c #{@config_file} #{@chef_args}") do |p, i, o, e|
|
165
|
+
@stdout = o.gets(nil)
|
166
|
+
@stderr = e.gets(nil)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
###
|
171
|
+
# Then
|
172
|
+
###
|
173
|
+
Then /^the run should exit '(.+)'$/ do |exit_code|
|
174
|
+
if ENV['LOG_LEVEL'] == 'debug'
|
175
|
+
puts @status.inspect
|
176
|
+
puts @status.exitstatus
|
177
|
+
end
|
178
|
+
begin
|
179
|
+
@status.exitstatus.should eql(exit_code.to_i)
|
180
|
+
rescue
|
181
|
+
print_output
|
182
|
+
raise
|
183
|
+
end
|
184
|
+
print_output if ENV["LOG_LEVEL"] == "debug"
|
185
|
+
end
|
186
|
+
|
187
|
+
Then "I print the debug log" do
|
188
|
+
print_output
|
189
|
+
end
|
190
|
+
|
191
|
+
Then /^the run should exit from being signaled$/ do
|
192
|
+
begin
|
193
|
+
@status.signaled?.should == true
|
194
|
+
rescue
|
195
|
+
print_output
|
196
|
+
raise
|
197
|
+
end
|
198
|
+
print_output if ENV["LOG_LEVEL"] == "debug"
|
199
|
+
end
|
200
|
+
|
201
|
+
|
202
|
+
def print_output
|
203
|
+
puts "--- run stdout:"
|
204
|
+
puts @stdout
|
205
|
+
puts "--- run stderr:"
|
206
|
+
puts @stderr
|
207
|
+
end
|
208
|
+
|
209
|
+
# Matcher for regular expression which uses normal string interpolation for
|
210
|
+
# the actual (target) value instead of expecting it, as stdout/stderr which
|
211
|
+
# get matched against may have lots of newlines, which looks ugly when
|
212
|
+
# inspected, as the newlines show up as \n
|
213
|
+
class NoInspectMatch
|
214
|
+
def initialize(expected_regex)
|
215
|
+
@expected_regex = expected_regex
|
216
|
+
end
|
217
|
+
def matches?(target)
|
218
|
+
@target = target
|
219
|
+
@target =~ @expected_regex
|
220
|
+
end
|
221
|
+
def failure_message
|
222
|
+
"expected #{@target} should match #{@expected_regex}"
|
223
|
+
end
|
224
|
+
def negative_failure_message
|
225
|
+
"expected #{@target} not to match #{@expected_regex}"
|
226
|
+
end
|
227
|
+
end
|
228
|
+
def noinspect_match(expected_regex)
|
229
|
+
NoInspectMatch.new(expected_regex)
|
230
|
+
end
|
231
|
+
|
232
|
+
|
233
|
+
Then /^'(.+)' should have '(.+)'$/ do |which, to_match|
|
234
|
+
if which == "stdout" || which == "stderr"
|
235
|
+
self.instance_variable_get("@#{which}".to_sym).should noinspect_match(/#{to_match}/m)
|
236
|
+
else
|
237
|
+
self.instance_variable_get("@#{which}".to_sym).should match(/#{to_match}/m)
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
Then /^'(.+)' should not have '(.+)'$/ do |which, to_match|
|
242
|
+
to_match = Regexp.escape(to_match)
|
243
|
+
if which == "stdout" || which == "stderr"
|
244
|
+
self.instance_variable_get("@#{which}".to_sym).should_not noinspect_match(/#{to_match}/m)
|
245
|
+
else
|
246
|
+
self.instance_variable_get("@#{which}".to_sym).should_not match(/#{to_match}/m)
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
250
|
+
Then /^'(.+)' should appear on '(.+)' '(.+)' times$/ do |to_match, which, count|
|
251
|
+
seen_count = 0
|
252
|
+
self.instance_variable_get("@#{which}".to_sym).split("\n").each do |line|
|
253
|
+
seen_count += 1 if line =~ /#{to_match}/
|
254
|
+
end
|
255
|
+
seen_count.should == count.to_i
|
256
|
+
end
|
257
|
+
|
258
|
+
Then "I inspect the contents of the features tmpdir" do
|
259
|
+
puts `ls -halpR #{tmpdir}`
|
260
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# This is kind of a crazy-ass setup, but it works.
|
2
|
+
When /^I run chef-solo with the '(.+)' recipe$/ do |recipe_name|
|
3
|
+
# Set up the JSON file with the recipe we want to run.
|
4
|
+
dna_file = "#{tmpdir}/chef-solo-features-dna.json"
|
5
|
+
File.open(dna_file, "w") do |fp|
|
6
|
+
fp.write("{ \"run_list\": [\"#{recipe_name}\"] }")
|
7
|
+
end
|
8
|
+
|
9
|
+
cleanup_files << "#{tmpdir}/chef-solo-features-dna.json"
|
10
|
+
|
11
|
+
# Set up the cache dir.
|
12
|
+
cache_dir = "#{tmpdir}/chef-solo-cache-features"
|
13
|
+
system("mkdir -p #{cache_dir}")
|
14
|
+
cleanup_dirs << cache_dir
|
15
|
+
|
16
|
+
# Cookbook dir
|
17
|
+
cookbook_dir ||= File.expand_path(File.join(File.dirname(__FILE__), '..', 'data', 'cookbooks'))
|
18
|
+
system("cp -r #{cookbook_dir} #{cache_dir}")
|
19
|
+
|
20
|
+
# Config file
|
21
|
+
config_file = "#{tmpdir}/chef-solo-config-features.rb"
|
22
|
+
File.open(config_file, "w") do |fp|
|
23
|
+
fp.write("cookbook_path \"#{cache_dir}/cookbooks\"\n")
|
24
|
+
fp.write("file_cache_path \"#{cache_dir}/cookbooks\"\n")
|
25
|
+
end
|
26
|
+
cleanup_files << config_file
|
27
|
+
|
28
|
+
binary_path = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'chef', 'bin', 'chef-solo'))
|
29
|
+
command = "#{binary_path} -c #{config_file} -j #{dna_file}"
|
30
|
+
command += " -l debug" if ENV['LOG_LEVEL'] == 'debug'
|
31
|
+
|
32
|
+
# Run it
|
33
|
+
puts "Running solo: #{command}" if ENV['LOG_LEVEL'] == 'debug'
|
34
|
+
|
35
|
+
status = Chef::Mixin::Command.popen4(command) do |p, i, o, e|
|
36
|
+
@stdout = o.gets(nil)
|
37
|
+
@stderr = o.gets(nil)
|
38
|
+
end
|
39
|
+
@status = status
|
40
|
+
|
41
|
+
print_output if ENV['LOG_LEVEL'] == 'debug'
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
# This is kind of a crazy-ass setup, but it works.
|
46
|
+
When /^I run chef-solo without cookbooks$/ do
|
47
|
+
|
48
|
+
# Set up the cache dir.
|
49
|
+
cache_dir = "#{tmpdir}/chef-solo-cache-features"
|
50
|
+
system("mkdir -p #{cache_dir}")
|
51
|
+
cleanup_dirs << cache_dir
|
52
|
+
|
53
|
+
# Empty Cookbook dir
|
54
|
+
system("mkdir #{cache_dir}/cookbooks")
|
55
|
+
|
56
|
+
# Config file
|
57
|
+
config_file = "#{tmpdir}/chef-solo-config-features.rb"
|
58
|
+
File.open(config_file, "w") do |fp|
|
59
|
+
fp.write("cookbook_path \"#{cache_dir}/cookbooks\"\n")
|
60
|
+
fp.write("file_cache_path \"#{cache_dir}/cookbooks\"\n")
|
61
|
+
end
|
62
|
+
cleanup_files << config_file
|
63
|
+
|
64
|
+
binary_path = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'chef', 'bin', 'chef-solo'))
|
65
|
+
command = "#{binary_path} -c #{config_file}"
|
66
|
+
command += " -l debug" if ENV['LOG_LEVEL'] == 'debug'
|
67
|
+
|
68
|
+
# Run it
|
69
|
+
puts "Running solo: #{command}" if ENV['LOG_LEVEL'] == 'debug'
|
70
|
+
|
71
|
+
status = Chef::Mixin::Command.popen4(command) do |p, i, o, e|
|
72
|
+
@stdout = o.gets(nil)
|
73
|
+
@stderr = o.gets(nil)
|
74
|
+
end
|
75
|
+
@status = status
|
76
|
+
|
77
|
+
print_output if ENV['LOG_LEVEL'] == 'debug'
|
78
|
+
end
|
@@ -0,0 +1,137 @@
|
|
1
|
+
require 'chef/sandbox'
|
2
|
+
|
3
|
+
# Upload the given file to the sandbox which was created by 'when I create a
|
4
|
+
# sandbox named'
|
5
|
+
def upload_to_sandbox(sandbox_filename, sandbox_file_checksum, url)
|
6
|
+
|
7
|
+
checksum64 = Base64.encode64([sandbox_file_checksum].pack("H*")).strip
|
8
|
+
timestamp = Time.now.utc.iso8601
|
9
|
+
file_contents = File.read(sandbox_filename)
|
10
|
+
# TODO - 5/28/2010, cw: make signing and sending the request streaming
|
11
|
+
sign_obj = Mixlib::Authentication::SignedHeaderAuth.signing_object(
|
12
|
+
:http_method => :put,
|
13
|
+
:path => URI.parse(url).path,
|
14
|
+
:body => file_contents,
|
15
|
+
:timestamp => timestamp,
|
16
|
+
:user_id => rest.client_name
|
17
|
+
)
|
18
|
+
headers = {
|
19
|
+
'content-type' => 'application/x-binary',
|
20
|
+
'content-md5' => checksum64,
|
21
|
+
:accept => 'application/json'
|
22
|
+
}
|
23
|
+
headers.merge!(sign_obj.sign(OpenSSL::PKey::RSA.new(rest.signing_key)))
|
24
|
+
|
25
|
+
# Don't set inflated_response as S3 (for the Platform) doesn't return JSON.
|
26
|
+
# Only Open Source does.
|
27
|
+
self.inflated_response = nil
|
28
|
+
self.exception = nil
|
29
|
+
self.api_response = RestClient::Request.execute(
|
30
|
+
:method => :put,
|
31
|
+
:url => url,
|
32
|
+
:headers => headers,
|
33
|
+
:payload => file_contents
|
34
|
+
)
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
When /^I create a sandbox named '([^\']+)'$/ do |sandbox_name|
|
39
|
+
begin
|
40
|
+
sandbox = get_fixture('sandbox', sandbox_name)
|
41
|
+
raise "no such sandbox in fixtures: #{sandbox_name}" unless sandbox
|
42
|
+
|
43
|
+
@stash['sandbox'] = sandbox
|
44
|
+
|
45
|
+
self.api_response = nil
|
46
|
+
self.exception = nil
|
47
|
+
self.inflated_response = rest.post_rest('/sandboxes', sandbox)
|
48
|
+
self.sandbox_url = self.inflated_response['uri']
|
49
|
+
|
50
|
+
@stash['sandbox_response'] = self.inflated_response
|
51
|
+
rescue
|
52
|
+
Chef::Log.debug("Caught exception in sandbox create (POST) request: #{$!.message}: #{$!.backtrace.join("\n")}")
|
53
|
+
self.exception = $!
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
When /^I commit the sandbox$/ do
|
58
|
+
begin
|
59
|
+
sandbox = @stash['sandbox']
|
60
|
+
|
61
|
+
# sandbox_url is fully qualified (with http://, sandboxes, etc.)
|
62
|
+
self.api_response = nil
|
63
|
+
self.exception = nil
|
64
|
+
self.inflated_response = rest.put_rest("#{self.sandbox_url}", {:is_completed => true})
|
65
|
+
|
66
|
+
@stash.delete('sandbox_response')
|
67
|
+
rescue
|
68
|
+
Chef::Log.debug("Caught exception in sandbox commit (PUT) request: #{$!.message}: #{$!.backtrace.join("\n")}")
|
69
|
+
self.exception = $!
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
Then /^I upload a file named '([^\']+)' to the sandbox$/ do |stash_sandbox_filename|
|
74
|
+
begin
|
75
|
+
sandbox = @stash['sandbox']
|
76
|
+
raise "no sandbox defined, have you called 'When I create a sandbox'" unless sandbox
|
77
|
+
|
78
|
+
sandbox_filename = get_fixture('sandbox_file', stash_sandbox_filename)
|
79
|
+
raise "no such stash_sandbox_filename in fixtures: #{stash_sandbox_filename}" unless sandbox_filename
|
80
|
+
|
81
|
+
sandbox_file_checksum = Chef::CookbookVersion.checksum_cookbook_file(sandbox_filename)
|
82
|
+
if @stash['sandbox_response']['checksums'].key?(sandbox_file_checksum)
|
83
|
+
Chef::Log.debug "uploading a file '#{stash_sandbox_filename}' with correct checksum #{sandbox_file_checksum}"
|
84
|
+
url = @stash['sandbox_response']['checksums'][sandbox_file_checksum]['url']
|
85
|
+
else
|
86
|
+
Chef::Log.debug "Sandbox doesn't have a checksum #{sandbox_file_checksum}, assuming a negative test"
|
87
|
+
Chef::Log.debug "using checksum 'F157'... just kidding, using #{sandbox_file_checksum}"
|
88
|
+
url = @stash['sandbox_response']['uri'] + "/#{sandbox_file_checksum}"
|
89
|
+
end
|
90
|
+
|
91
|
+
upload_to_sandbox(sandbox_filename, sandbox_file_checksum, url)
|
92
|
+
rescue
|
93
|
+
Chef::Log.debug("Caught exception in sandbox checksum upload (PUT) request: #{$!.message}: #{$!.backtrace.join("\n")}")
|
94
|
+
self.exception = $!
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# Upload a file sandbox_filename_to_upload, but post it to the URL specified by
|
99
|
+
# sandbox_file_for_checksum, to cause the checksum check to fail.
|
100
|
+
Then /^I upload a file named '([^\']+)' using the checksum of '(.+)' to the sandbox$/ do |stash_upload_filename, stash_checksum_filename|
|
101
|
+
begin
|
102
|
+
sandbox = @stash['sandbox']
|
103
|
+
|
104
|
+
sandbox_upload_filename = get_fixture('sandbox_file', stash_upload_filename)
|
105
|
+
sandbox_checksum_filename = get_fixture('sandbox_file', stash_checksum_filename)
|
106
|
+
raise "no such stash_upload_filename in fixtures: #{stash_upload_filename}" unless sandbox_upload_filename
|
107
|
+
raise "no such stash_checksum_filename in fixtures: #{stash_checksum_filename}" unless stash_checksum_filename
|
108
|
+
|
109
|
+
use_checksum = Chef::CookbookVersion.checksum_cookbook_file(sandbox_checksum_filename)
|
110
|
+
url = @stash['sandbox_response']['checksums'][use_checksum]['url']
|
111
|
+
|
112
|
+
upload_to_sandbox(sandbox_upload_filename, use_checksum, url)
|
113
|
+
rescue
|
114
|
+
Chef::Log.debug("Caught exception in bad sandbox checksum upload (PUT) request: #{$!.message}: #{$!.backtrace.join("\n")}")
|
115
|
+
self.exception = $!
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
#Then the sandbox file 'sandbox2_file1' should need upload
|
120
|
+
Then /^the sandbox file '(.+)' should need upload$/ do |stash_filename|
|
121
|
+
sandbox = @stash['sandbox_response']
|
122
|
+
|
123
|
+
sandbox_filename = get_fixture('sandbox_file', stash_filename)
|
124
|
+
sandbox_checksum = Chef::CookbookVersion.checksum_cookbook_file(sandbox_filename)
|
125
|
+
|
126
|
+
sandbox['checksums'][sandbox_checksum]['needs_upload'] == true
|
127
|
+
end
|
128
|
+
|
129
|
+
Then /^the sandbox file '(.+)' should not need upload$/ do |stash_filename|
|
130
|
+
sandbox = @stash['sandbox_response']
|
131
|
+
|
132
|
+
sandbox_filename = get_fixture('sandbox_file', stash_filename)
|
133
|
+
sandbox_checksum = Chef::CookbookVersion.checksum_cookbook_file(sandbox_filename)
|
134
|
+
|
135
|
+
sandbox['checksums'][sandbox_checksum]['needs_upload'] == false
|
136
|
+
end
|
137
|
+
|