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,19 @@
|
|
1
|
+
Creating SSL certificates is a common task done in web application infrastructures, so a rake task is provided to generate certificates. These certificates are stored here by the ssl_cert task.
|
2
|
+
|
3
|
+
Configure the values used in the SSL certificate by modifying `config/rake.rb`.
|
4
|
+
|
5
|
+
To generate a certificate set for a new monitoring server, for example:
|
6
|
+
|
7
|
+
rake ssl_cert FQDN=monitoring.example.com
|
8
|
+
|
9
|
+
Once the certificates are generated, copy them into the cookbook(s) where you want to use them.
|
10
|
+
|
11
|
+
cp certificates/monitoring.example.com.* cookbooks/COOKBOOK/files/default
|
12
|
+
|
13
|
+
In the recipe for that cookbook, create a `cookbook_file` resource to configure a resource that puts them in place on the destination server.
|
14
|
+
|
15
|
+
cookbook_file '/etc/apache2/ssl/monitoring.example.com.pem'
|
16
|
+
owner 'root'
|
17
|
+
group 'root'
|
18
|
+
mode 0600
|
19
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# Configure the Rakefile's tasks.
|
2
|
+
|
3
|
+
###
|
4
|
+
# Company and SSL Details
|
5
|
+
# Used with the ssl_cert task.
|
6
|
+
###
|
7
|
+
|
8
|
+
# The company name - used for SSL certificates, and in srvious other places
|
9
|
+
COMPANY_NAME = "Example Com"
|
10
|
+
|
11
|
+
# The Country Name to use for SSL Certificates
|
12
|
+
SSL_COUNTRY_NAME = "US"
|
13
|
+
|
14
|
+
# The State Name to use for SSL Certificates
|
15
|
+
SSL_STATE_NAME = "Several"
|
16
|
+
|
17
|
+
# The Locality Name for SSL - typically, the city
|
18
|
+
SSL_LOCALITY_NAME = "Locality"
|
19
|
+
|
20
|
+
# What department?
|
21
|
+
SSL_ORGANIZATIONAL_UNIT_NAME = "Operations"
|
22
|
+
|
23
|
+
# The SSL contact email address
|
24
|
+
SSL_EMAIL_ADDRESS = "ops@example.com"
|
25
|
+
|
26
|
+
# License for new Cookbooks
|
27
|
+
# Can be :apachev2 or :none
|
28
|
+
NEW_COOKBOOK_LICENSE = :apachev2
|
29
|
+
|
30
|
+
###
|
31
|
+
# Useful Extras (which you probably don't need to change)
|
32
|
+
###
|
33
|
+
|
34
|
+
# The top of the repository checkout
|
35
|
+
TOPDIR = File.expand_path(File.join(File.dirname(__FILE__), ".."))
|
36
|
+
|
37
|
+
# Where to store certificates generated with ssl_cert
|
38
|
+
CADIR = File.expand_path(File.join(TOPDIR, "certificates"))
|
@@ -0,0 +1,53 @@
|
|
1
|
+
This directory contains the cookbooks used to configure systems in your infrastructure with Chef.
|
2
|
+
|
3
|
+
Knife needs to be configured to know where the cookbooks are located with the `cookbook_path` setting. If this is not set, then several cookbook operations will fail to work properly.
|
4
|
+
|
5
|
+
cookbook_path ["./cookbooks"]
|
6
|
+
|
7
|
+
This setting tells knife to look for the cookbooks directory in the present working directory. This means the knife cookbook subcommands need to be run in the `chef-repo` directory itself. To make sure that the cookbooks can be found elsewhere inside the repository, use an absolute path. This is a Ruby file, so something like the following can be used:
|
8
|
+
|
9
|
+
current_dir = File.dirname(__FILE__)
|
10
|
+
cookbook_path ["#{current_dir}/../cookbooks"]
|
11
|
+
|
12
|
+
Which will set `current_dir` to the location of the knife.rb file itself (e.g. `~/chef-repo/.chef/knife.rb`).
|
13
|
+
|
14
|
+
Configure knife to use your preferred copyright holder, email contact and license. Add the following lines to `.chef/knife.rb`.
|
15
|
+
|
16
|
+
cookbook_copyright "Example, Com."
|
17
|
+
cookbook_email "cookbooks@example.com"
|
18
|
+
cookbook_license "apachev2"
|
19
|
+
|
20
|
+
Supported values for `cookbook_license` are "apachev2" or "none". These settings are used to prefill comments in the default recipe, and the corresponding values in the metadata.rb. You are free to change these in those files.
|
21
|
+
|
22
|
+
Create new cookbooks in this directory with Knife.
|
23
|
+
|
24
|
+
knife cookbook create COOKBOOK
|
25
|
+
|
26
|
+
This will create all the cookbook directory components. You don't need to use them all, and can delete the ones you don't need. It also creates a README file, metadata.rb and default recipe.
|
27
|
+
|
28
|
+
You can also download cookbooks directly from the Opscode Cookbook Site. There are two subcommands to help with this depending on what your preference is.
|
29
|
+
|
30
|
+
The first and recommended method is to use a vendor branch if you're using Git. This is automatically handled with Knife.
|
31
|
+
|
32
|
+
knife cookbook site vendor COOKBOOK
|
33
|
+
|
34
|
+
This will:
|
35
|
+
|
36
|
+
* Download the cookbook tarball from cookbooks.opscode.com.
|
37
|
+
* Ensure its on the git master branch.
|
38
|
+
* Checks for an existing vendor branch, and creates if it doesn't.
|
39
|
+
* Checks out the vendor branch (chef-vendor-COOKBOOK).
|
40
|
+
* Removes the existing (old) version.
|
41
|
+
* Untars the cookbook tarball it downloaded in the first step.
|
42
|
+
* Adds the cookbook files to the git index and commits.
|
43
|
+
* Creates a tag for the version downloaded.
|
44
|
+
* Checks out the master branch again.
|
45
|
+
* Merges the cookbook into master.
|
46
|
+
|
47
|
+
The last step will ensure that any local changes or modifications you have made to the cookbook are preserved, so you can keep your changes through upstream updates.
|
48
|
+
|
49
|
+
If you're not using Git, use the site download subcommand to download the tarball.
|
50
|
+
|
51
|
+
knife cookbook site download COOKBOOK
|
52
|
+
|
53
|
+
This creates the COOKBOOK.tar.gz from in the current directory (e.g., `~/chef-repo`). We recommend following a workflow similar to the above for your version control tool.
|
@@ -0,0 +1,23 @@
|
|
1
|
+
This directory contains directories of the various data bags you create for your infrastructure. Each subdirectory corresponds to a data bag on the Chef Server, and contains JSON files of the items that go in the bag.
|
2
|
+
|
3
|
+
First, create a directory for the data bag.
|
4
|
+
|
5
|
+
mkdir data_bags/BAG
|
6
|
+
|
7
|
+
Then create the JSON files for items that will go into that bag.
|
8
|
+
|
9
|
+
$EDITOR data_bags/BAG/ITEM.json
|
10
|
+
|
11
|
+
The JSON for the ITEM must contain a key named "id" with a value equal to "ITEM". For example,
|
12
|
+
|
13
|
+
{
|
14
|
+
"id": "foo"
|
15
|
+
}
|
16
|
+
|
17
|
+
Next, create the data bag on the Chef Server.
|
18
|
+
|
19
|
+
knife data bag create BAG
|
20
|
+
|
21
|
+
Then upload the items in the data bag's directory to the Chef Server.
|
22
|
+
|
23
|
+
knife data bag from file BAG ITEM.json
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Create roles here, in either the Role Ruby DSL (.rb) or JSON (.json) files. To install roles on the server, use knife.
|
2
|
+
|
3
|
+
For example, create `roles/base_example.rb`:
|
4
|
+
|
5
|
+
name "base_example"
|
6
|
+
description "Example base role applied to all nodes."
|
7
|
+
# List of recipes and roles to apply. Requires Chef 0.8, earlier versions use 'recipes()'.
|
8
|
+
#run_list()
|
9
|
+
# Attributes applied if the node doesn't have it set already.
|
10
|
+
#default_attributes()
|
11
|
+
# Attributes applied no matter what the node has set already.
|
12
|
+
#override_attributes()
|
13
|
+
|
14
|
+
Then upload it to the Chef Server:
|
15
|
+
|
16
|
+
knife role from file roles/base_example.rb
|
@@ -0,0 +1 @@
|
|
1
|
+
hosts Mash.new unless attribute?(:hosts)
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../',__FILE__)
|
3
|
+
lib_up = File.expand_path('../../', __FILE__)
|
4
|
+
$:.unshift lib unless $:.include?(lib)
|
5
|
+
$:.unshift lib_up unless $:.include?(lib_up)
|
6
|
+
require 'json'
|
7
|
+
|
8
|
+
ENV['GEM_PATH']=ENV['BUNDLE_INSTALL_PATH'] if ENV['BUNDLE_INSTALL_PATH']
|
9
|
+
ENV['GEM_HOME']=ENV['BUNDLE_INSTALL_PATH'] if ENV['BUNDLE_INSTALL_PATH']
|
10
|
+
|
11
|
+
name = File.split(lib)[-1]||""
|
12
|
+
raise ArgumentError, '', caller if name.empty?
|
13
|
+
@name=name
|
14
|
+
|
15
|
+
Gem.use_paths(ENV['BUNDLE_INSTALL_PATH'],[]) if ENV['BUNDLE_INSTALL_PATH']
|
16
|
+
|
17
|
+
Gem::Specification.new do |s|
|
18
|
+
|
19
|
+
md = JSON.parse(File.read(File.expand_path('../metadata.json', __FILE__)))
|
20
|
+
|
21
|
+
# Required attributes (gem build fails without these)
|
22
|
+
s.name = @name
|
23
|
+
s.version = md['version'] && !md['version'].empty? ? md['version'] : '0'
|
24
|
+
s.files = Dir.glob('**/*') #.map{|f| File.expand_path(f)}
|
25
|
+
s.summary = md['description'] ? md['description'] : "The Chef cookbook for #{s.name}"
|
26
|
+
|
27
|
+
# Optional attributes (gem build warning raised without these)
|
28
|
+
s.author = md['maintainer'] ? md['maintainer'] : 'No acknowledged maintainer'
|
29
|
+
s.description = md['long_description'] ? md['long_description'] : s.summary
|
30
|
+
s.email = md['maintainer_email'] ? md['maintainer_email'] : 'No acknowledged maintainer email'
|
31
|
+
s.homepage = 'http://www.opscode.com'
|
32
|
+
md['dependencies'].each { |k,v| s.add_dependency(k,v) };
|
33
|
+
|
34
|
+
s.post_install_message = "Installed Chef Cookbook #{s.name}\n#{s.description}"
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
{
|
2
|
+
"groupings": {
|
3
|
+
|
4
|
+
},
|
5
|
+
"recommendations": {
|
6
|
+
|
7
|
+
},
|
8
|
+
"platforms": {
|
9
|
+
|
10
|
+
},
|
11
|
+
"license": "Apache v2.0",
|
12
|
+
"maintainer": "37signals",
|
13
|
+
"suggestions": {
|
14
|
+
|
15
|
+
},
|
16
|
+
"maintainer_email": "sysadmins@37signals.com",
|
17
|
+
"version": "0.1.0",
|
18
|
+
"conflicting": {
|
19
|
+
|
20
|
+
},
|
21
|
+
"description": "Configures hosts",
|
22
|
+
"providing": {
|
23
|
+
"hosts": [
|
24
|
+
|
25
|
+
]
|
26
|
+
},
|
27
|
+
"name": "hosts",
|
28
|
+
"attributes": {
|
29
|
+
|
30
|
+
},
|
31
|
+
"long_description": "",
|
32
|
+
"recipes": {
|
33
|
+
"hosts": ""
|
34
|
+
},
|
35
|
+
"replacing": {
|
36
|
+
|
37
|
+
},
|
38
|
+
"dependencies": {
|
39
|
+
|
40
|
+
}
|
41
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
127.0.0.1 localhost <%= @node[:hosts][:localhost_aliases].join(" ") if @node[:hosts][:localhost_aliases] %>
|
2
|
+
127.0.1.1 <%= @node['fqdn'] %> <%= @node['hostname'] %> <%= "chef.#{@node['domain']}" if @node.run_list.include?("recipe[chef::server]") %>
|
3
|
+
|
4
|
+
<% if @node[:hosts][:entries] %>
|
5
|
+
<% @node[:hosts][:entries].each do |ip, name| %>
|
6
|
+
<%= ip %> <%= name %>
|
7
|
+
<% end %>
|
8
|
+
<% end %>
|
9
|
+
|
10
|
+
<% if @node[:domain] == "rack-dfw-int.37signals.com" %>
|
11
|
+
192.168.0.32 queenbee.37signals.com queenbee
|
12
|
+
192.168.0.5 ob.37signals.com ob
|
13
|
+
192.168.1.151 basecamp.db.37signals.com
|
14
|
+
192.168.2.82 basecamp.search.37signals.com
|
15
|
+
192.168.1.122 backpack.search.37signals.com
|
16
|
+
192.168.1.120 backpack.db.37signals.com
|
17
|
+
192.168.1.127 campfire.db.37signals.com
|
18
|
+
192.168.1.114 dev.37signals.com
|
19
|
+
<% end %>
|
20
|
+
|
21
|
+
# The following lines are desirable for IPv6 capable hosts
|
22
|
+
::1 ip6-localhost ip6-loopback
|
23
|
+
fe00::0 ip6-localnet
|
24
|
+
ff00::0 ip6-mcastprefix
|
25
|
+
ff02::1 ip6-allnodes
|
26
|
+
ff02::2 ip6-allrouters
|
27
|
+
ff02::3 ip6-allhosts
|
@@ -0,0 +1,175 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# node name
|
4
|
+
# chef config secret
|
5
|
+
# mixin recipe definition DSL core or chef mixin language
|
6
|
+
# OR
|
7
|
+
# Chef::Rest ob
|
8
|
+
|
9
|
+
require 'uri'
|
10
|
+
|
11
|
+
ALL_TESTS = []
|
12
|
+
|
13
|
+
class QueryTest
|
14
|
+
include Chef::Mixin::Language
|
15
|
+
|
16
|
+
attr_reader :type, :query, :expected
|
17
|
+
|
18
|
+
def initialize(type, query, expected)
|
19
|
+
@type = type
|
20
|
+
@query = query
|
21
|
+
@expected = Set.new(expected)
|
22
|
+
end
|
23
|
+
|
24
|
+
def same_type?(q)
|
25
|
+
(@type.class == String && q.type.class == String) ||
|
26
|
+
(@type == q.type)
|
27
|
+
end
|
28
|
+
|
29
|
+
def and(q)
|
30
|
+
raise "types must match" unless same_type? q
|
31
|
+
QueryTest.new(@type, "(#{@query} AND #{q.query})",
|
32
|
+
@expected.intersection(q.expected))
|
33
|
+
end
|
34
|
+
|
35
|
+
def or(q)
|
36
|
+
raise "types must match" unless same_type? q
|
37
|
+
QueryTest.new(@type, "(#{@query} OR #{q.query})",
|
38
|
+
@expected.union(q.expected))
|
39
|
+
end
|
40
|
+
|
41
|
+
def show(s)
|
42
|
+
s.to_a.join(", ")
|
43
|
+
end
|
44
|
+
|
45
|
+
def compare_results(results)
|
46
|
+
got = Set.new(results)
|
47
|
+
if @expected != got
|
48
|
+
puts "FAIL: #{@type} #{@query}"
|
49
|
+
puts "expected: #{show(@expected)}"
|
50
|
+
puts " got: #{show(got)}"
|
51
|
+
raise "search test failed"
|
52
|
+
else
|
53
|
+
puts "OK: (#{@expected.size}) #{@type} #{@query}"
|
54
|
+
end
|
55
|
+
true
|
56
|
+
end
|
57
|
+
|
58
|
+
def execute
|
59
|
+
compare_results search(@type, @query).map { |o| o.name }
|
60
|
+
rescue Exception => e
|
61
|
+
puts "ERROR: query failed for #{@query}"
|
62
|
+
raise e
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def query(obj_type, query_string, expected_result)
|
67
|
+
q = QueryTest.new(obj_type, query_string, expected_result)
|
68
|
+
#q.execute
|
69
|
+
ALL_TESTS << q
|
70
|
+
q
|
71
|
+
end
|
72
|
+
|
73
|
+
def random_bool_query(queries, n)
|
74
|
+
q_count = queries.size
|
75
|
+
ops = [:and, :or]
|
76
|
+
ans = queries[rand(q_count)]
|
77
|
+
n.times do |i|
|
78
|
+
ans = ans.send(ops[rand(2)], queries[rand(q_count)])
|
79
|
+
end
|
80
|
+
ans.execute
|
81
|
+
end
|
82
|
+
|
83
|
+
# Exact searches:
|
84
|
+
query :node, "tag:apples", ["a"]
|
85
|
+
query :node, "tag:apes", ["b", "c"]
|
86
|
+
query :node, "tag:not_a_tag_value", []
|
87
|
+
query :node, 'run_list:recipe\[bravo\]', ["ab", "b"]
|
88
|
+
query :node, 'run_list:recipe\[zulu\]', []
|
89
|
+
query :node, 'run_list:recipe\[alpha\]', ["a", "ab"]
|
90
|
+
|
91
|
+
# data bag item searching
|
92
|
+
query "toys", 'colors:green', ["data_bag_item_toys_marbles"]
|
93
|
+
query "toys", 'colors:white', ["data_bag_item_toys_marbles"]
|
94
|
+
query "fruit", 'names:lemon', ["data_bag_item_fruit_citrus"]
|
95
|
+
query "toys", 'baseballs:4 OR colors:black', ["data_bag_item_toys_marbles",
|
96
|
+
"data_bag_item_toys_balls"]
|
97
|
+
|
98
|
+
# basic client list search
|
99
|
+
# query :client, '*:*', ['ac', 'bc', 'cc']
|
100
|
+
|
101
|
+
# role search
|
102
|
+
query :role, 'name:pro*', ['prod']
|
103
|
+
query :role, 'run_list:recipe\[base\]', ['prod', 'web']
|
104
|
+
query :role, 'run_list:role\[monitoring\]', ['prod']
|
105
|
+
query :role, 'key:456', ['web']
|
106
|
+
query :role, 'key:[1 TO 5000]', ['web', 'prod']
|
107
|
+
|
108
|
+
# Negation:
|
109
|
+
query :node, '(run_list:recipe\[bravo\] NOT run_list:recipe\[alpha\])', ["b"]
|
110
|
+
query :node, "(tag:ap* NOT tag:apples)", ["b", "c"]
|
111
|
+
|
112
|
+
# Prefix searches:
|
113
|
+
|
114
|
+
query :node, "tag:a*", ["a", "ab", "b", "c"]
|
115
|
+
query :node, "tag:app*", ["a"]
|
116
|
+
query :node, "tag:ap*", ["a", "b", "c"]
|
117
|
+
query :node, "tag:zulu*", []
|
118
|
+
|
119
|
+
|
120
|
+
# Range searches:
|
121
|
+
|
122
|
+
query :node, 'value:[* TO *]', ["a", "b", "c"]
|
123
|
+
query :node, 'value:[1 TO 2]', ['a', 'b']
|
124
|
+
query :node, 'value:[1 TO 3]', ['a', 'b', 'c']
|
125
|
+
query :node, 'value:[2 TO *]', ['b', 'c']
|
126
|
+
query :node, 'value:[* TO 2]', ['a', 'b']
|
127
|
+
query :node, 'value:[* TO 5]', ['a', 'b', 'c']
|
128
|
+
query :node, 'value:[5 TO *]', []
|
129
|
+
# exclusive range
|
130
|
+
query :node, 'value:{1 TO 3}', ['b']
|
131
|
+
# more negation tests
|
132
|
+
query :node, '(value:[1 TO 3] NOT value:[1 TO 2])', ['c']
|
133
|
+
|
134
|
+
# Quotes
|
135
|
+
query :node, 'multi_word:"foo bar baz"', ['a']
|
136
|
+
query :node, 'multi_word:foo*', ['a', 'c']
|
137
|
+
|
138
|
+
# internal escaped quotes don't work, but prefix query for an escaped
|
139
|
+
# quote does
|
140
|
+
# query :node, 'quotes:"\"one\" \"two\" \"three\""', ['ab']
|
141
|
+
# query :node, 'quotes:\"one\"*', ['ab']
|
142
|
+
query :node, 'quotes:\"*', ['ab']
|
143
|
+
|
144
|
+
# nested keys
|
145
|
+
query :node, 'nested_b1_a2_a3:B1_A2_A3-a', ['a']
|
146
|
+
query :node, 'nested_b1_a2_a3:B1_A2_A3-b', ['b']
|
147
|
+
query :node, 'nested_b1_a2_a3:B1_A2_A3-c', ['c']
|
148
|
+
query :node, 'nested_a1_b2_a3:A1_B2_A3-*', ['a', 'b', 'c']
|
149
|
+
|
150
|
+
# # nested expando (only w/ new stuff)
|
151
|
+
if Chef::Config["wildcard_in_key_tests"]
|
152
|
+
query :node, 'nested_b1_*_a3:B1_A2_A3-a', ['a']
|
153
|
+
query :node, 'nested_b1_a2_*:B1_A2_A3-b', ['b']
|
154
|
+
query :node, 'nested_b1_a2_a3:B1_A2_A3-c', ['c']
|
155
|
+
query :node, 'nested_*_b2_a3:A1_B2_A3-*', ['a', 'b', 'c']
|
156
|
+
end
|
157
|
+
|
158
|
+
|
159
|
+
ALL_TESTS.each do |q|
|
160
|
+
q.execute
|
161
|
+
end
|
162
|
+
|
163
|
+
node_tests = ALL_TESTS.select { |x| x.type == :node }
|
164
|
+
role_tests = ALL_TESTS.select { |x| x.type == :role }
|
165
|
+
data_bag_tests = ALL_TESTS.select { |x| x.type.class == String }
|
166
|
+
|
167
|
+
# AND/OR precedence
|
168
|
+
[node_tests, role_tests].each do |test_list|
|
169
|
+
10.times do |i|
|
170
|
+
random_bool_query(test_list, 2)
|
171
|
+
random_bool_query(test_list, 3)
|
172
|
+
random_bool_query(test_list, 4)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|