microwave 11.400.3 → 11.400.4
Sign up to get free protection for your applications and to get access to all the features.
- data/distro/README +2 -0
- data/distro/arch/etc/conf.d/chef-client.conf +5 -0
- data/distro/arch/etc/conf.d/chef-expander.conf +8 -0
- data/distro/arch/etc/conf.d/chef-server-webui.conf +10 -0
- data/distro/arch/etc/conf.d/chef-server.conf +10 -0
- data/distro/arch/etc/conf.d/chef-solr.conf +8 -0
- data/distro/arch/etc/rc.d/chef-client +90 -0
- data/distro/arch/etc/rc.d/chef-expander +78 -0
- data/distro/arch/etc/rc.d/chef-server +78 -0
- data/distro/arch/etc/rc.d/chef-server-webui +78 -0
- data/distro/arch/etc/rc.d/chef-solr +78 -0
- data/distro/common/html/chef-client.8.html +145 -0
- data/distro/common/html/chef-expander.8.html +164 -0
- data/distro/common/html/chef-expanderctl.8.html +146 -0
- data/distro/common/html/chef-server-webui.8.html +185 -0
- data/distro/common/html/chef-server.8.html +182 -0
- data/distro/common/html/chef-shell.1.html +286 -0
- data/distro/common/html/chef-solo.8.html +191 -0
- data/distro/common/html/chef-solr.8.html +165 -0
- data/distro/common/html/knife-bootstrap.1.html +241 -0
- data/distro/common/html/knife-client.1.html +219 -0
- data/distro/common/html/knife-configure.1.html +170 -0
- data/distro/common/html/knife-cookbook-site.1.html +241 -0
- data/distro/common/html/knife-cookbook.1.html +384 -0
- data/distro/common/html/knife-data-bag.1.html +238 -0
- data/distro/common/html/knife-environment.1.html +267 -0
- data/distro/common/html/knife-exec.1.html +134 -0
- data/distro/common/html/knife-index.1.html +125 -0
- data/distro/common/html/knife-node.1.html +250 -0
- data/distro/common/html/knife-role.1.html +200 -0
- data/distro/common/html/knife-search.1.html +288 -0
- data/distro/common/html/knife-ssh.1.html +156 -0
- data/distro/common/html/knife-status.1.html +128 -0
- data/distro/common/html/knife-tag.1.html +137 -0
- data/distro/common/html/knife.1.html +315 -0
- data/distro/common/man/man1/chef-shell.1 +220 -0
- data/distro/common/man/man1/knife-bootstrap.1 +201 -0
- data/distro/common/man/man1/knife-client.1 +99 -0
- data/distro/common/man/man1/knife-configure.1 +88 -0
- data/distro/common/man/man1/knife-cookbook-site.1 +145 -0
- data/distro/common/man/man1/knife-cookbook.1 +345 -0
- data/distro/common/man/man1/knife-data-bag.1 +136 -0
- data/distro/common/man/man1/knife-environment.1 +178 -0
- data/distro/common/man/man1/knife-exec.1 +43 -0
- data/distro/common/man/man1/knife-index.1 +29 -0
- data/distro/common/man/man1/knife-node.1 +134 -0
- data/distro/common/man/man1/knife-role.1 +88 -0
- data/distro/common/man/man1/knife-search.1 +280 -0
- data/distro/common/man/man1/knife-ssh.1 +79 -0
- data/distro/common/man/man1/knife-status.1 +29 -0
- data/distro/common/man/man1/knife-tag.1 +43 -0
- data/distro/common/man/man1/knife.1 +285 -0
- data/distro/common/man/man8/chef-client.8 +104 -0
- data/distro/common/man/man8/chef-expander.8 +97 -0
- data/distro/common/man/man8/chef-expanderctl.8 +62 -0
- data/distro/common/man/man8/chef-server-webui.8 +155 -0
- data/distro/common/man/man8/chef-server.8 +147 -0
- data/distro/common/man/man8/chef-solo.8 +158 -0
- data/distro/common/man/man8/chef-solr.8 +122 -0
- data/distro/common/markdown/README +3 -0
- data/distro/common/markdown/man1/chef-shell.mkd +195 -0
- data/distro/common/markdown/man1/knife-bootstrap.mkd +141 -0
- data/distro/common/markdown/man1/knife-client.mkd +103 -0
- data/distro/common/markdown/man1/knife-configure.mkd +70 -0
- data/distro/common/markdown/man1/knife-cookbook-site.mkd +123 -0
- data/distro/common/markdown/man1/knife-cookbook.mkd +263 -0
- data/distro/common/markdown/man1/knife-data-bag.mkd +121 -0
- data/distro/common/markdown/man1/knife-environment.mkd +151 -0
- data/distro/common/markdown/man1/knife-exec.mkd +42 -0
- data/distro/common/markdown/man1/knife-index.mkd +30 -0
- data/distro/common/markdown/man1/knife-node.mkd +130 -0
- data/distro/common/markdown/man1/knife-role.mkd +85 -0
- data/distro/common/markdown/man1/knife-search.mkd +180 -0
- data/distro/common/markdown/man1/knife-ssh.mkd +69 -0
- data/distro/common/markdown/man1/knife-status.mkd +36 -0
- data/distro/common/markdown/man1/knife-tag.mkd +39 -0
- data/distro/common/markdown/man1/knife.mkd +213 -0
- data/distro/common/markdown/man8/chef-client.mkd +74 -0
- data/distro/common/markdown/man8/chef-expander.mkd +82 -0
- data/distro/common/markdown/man8/chef-expanderctl.mkd +58 -0
- data/distro/common/markdown/man8/chef-server-webui.mkd +121 -0
- data/distro/common/markdown/man8/chef-server.mkd +121 -0
- data/distro/common/markdown/man8/chef-solo.mkd +107 -0
- data/distro/common/markdown/man8/chef-solr.mkd +89 -0
- data/distro/debian/etc/default/chef-client +4 -0
- data/distro/debian/etc/default/chef-expander +8 -0
- data/distro/debian/etc/default/chef-server +9 -0
- data/distro/debian/etc/default/chef-server-webui +9 -0
- data/distro/debian/etc/default/chef-solr +8 -0
- data/distro/debian/etc/init.d/chef-client +210 -0
- data/distro/debian/etc/init.d/chef-expander +176 -0
- data/distro/debian/etc/init.d/chef-server +122 -0
- data/distro/debian/etc/init.d/chef-server-webui +123 -0
- data/distro/debian/etc/init.d/chef-solr +176 -0
- data/distro/debian/etc/init/chef-client.conf +17 -0
- data/distro/debian/etc/init/chef-expander.conf +17 -0
- data/distro/debian/etc/init/chef-server-webui.conf +17 -0
- data/distro/debian/etc/init/chef-server.conf +17 -0
- data/distro/debian/etc/init/chef-solr.conf +17 -0
- data/distro/redhat/etc/init.d/chef-client +121 -0
- data/distro/redhat/etc/init.d/chef-expander +104 -0
- data/distro/redhat/etc/init.d/chef-server +112 -0
- data/distro/redhat/etc/init.d/chef-server-webui +112 -0
- data/distro/redhat/etc/init.d/chef-solr +104 -0
- data/distro/redhat/etc/logrotate.d/chef-client +8 -0
- data/distro/redhat/etc/logrotate.d/chef-expander +8 -0
- data/distro/redhat/etc/logrotate.d/chef-server +8 -0
- data/distro/redhat/etc/logrotate.d/chef-server-webui +8 -0
- data/distro/redhat/etc/logrotate.d/chef-solr +8 -0
- data/distro/redhat/etc/sysconfig/chef-client +15 -0
- data/distro/redhat/etc/sysconfig/chef-expander +7 -0
- data/distro/redhat/etc/sysconfig/chef-server +14 -0
- data/distro/redhat/etc/sysconfig/chef-server-webui +14 -0
- data/distro/redhat/etc/sysconfig/chef-solr +8 -0
- data/distro/windows/service_manager.rb +164 -0
- data/lib/chef/api_client.rb +205 -0
- data/lib/chef/api_client/registration.rb +126 -0
- data/lib/chef/application.rb +225 -0
- data/lib/chef/application/agent.rb +18 -0
- data/lib/chef/application/apply.rb +160 -0
- data/lib/chef/application/client.rb +340 -0
- data/lib/chef/application/knife.rb +183 -0
- data/lib/chef/application/solo.rb +263 -0
- data/lib/chef/application/windows_service.rb +230 -0
- data/lib/chef/applications.rb +5 -0
- data/lib/chef/checksum/storage.rb +18 -0
- data/lib/chef/checksum/storage/filesystem.rb +56 -0
- data/lib/chef/chef_fs.rb +11 -0
- data/lib/chef/chef_fs/command_line.rb +232 -0
- data/lib/chef/chef_fs/file_pattern.rb +312 -0
- data/lib/chef/chef_fs/file_system.rb +358 -0
- data/lib/chef/chef_fs/file_system/base_fs_dir.rb +47 -0
- data/lib/chef/chef_fs/file_system/base_fs_object.rb +121 -0
- data/lib/chef/chef_fs/file_system/chef_repository_file_system_entry.rb +109 -0
- data/lib/chef/chef_fs/file_system/chef_repository_file_system_root_dir.rb +31 -0
- data/lib/chef/chef_fs/file_system/chef_server_root_dir.rb +84 -0
- data/lib/chef/chef_fs/file_system/cookbook_dir.rb +188 -0
- data/lib/chef/chef_fs/file_system/cookbook_file.rb +78 -0
- data/lib/chef/chef_fs/file_system/cookbook_subdir.rb +54 -0
- data/lib/chef/chef_fs/file_system/cookbooks_dir.rb +68 -0
- data/lib/chef/chef_fs/file_system/data_bag_dir.rb +78 -0
- data/lib/chef/chef_fs/file_system/data_bag_item.rb +59 -0
- data/lib/chef/chef_fs/file_system/data_bags_dir.rb +66 -0
- data/lib/chef/chef_fs/file_system/file_system_entry.rb +90 -0
- data/lib/chef/chef_fs/file_system/file_system_error.rb +31 -0
- data/lib/chef/chef_fs/file_system/file_system_root_dir.rb +31 -0
- data/lib/chef/chef_fs/file_system/must_delete_recursively_error.rb +31 -0
- data/lib/chef/chef_fs/file_system/nodes_dir.rb +47 -0
- data/lib/chef/chef_fs/file_system/nonexistent_fs_object.rb +40 -0
- data/lib/chef/chef_fs/file_system/not_found_error.rb +31 -0
- data/lib/chef/chef_fs/file_system/rest_list_dir.rb +84 -0
- data/lib/chef/chef_fs/file_system/rest_list_entry.rb +123 -0
- data/lib/chef/chef_fs/knife.rb +77 -0
- data/lib/chef/chef_fs/path_utils.rb +64 -0
- data/lib/chef/client.rb +556 -0
- data/lib/chef/config.rb +354 -0
- data/lib/chef/cookbook/chefignore.rb +66 -0
- data/lib/chef/cookbook/cookbook_collection.rb +45 -0
- data/lib/chef/cookbook/cookbook_version_loader.rb +171 -0
- data/lib/chef/cookbook/file_system_file_vendor.rb +56 -0
- data/lib/chef/cookbook/file_vendor.rb +48 -0
- data/lib/chef/cookbook/metadata.rb +627 -0
- data/lib/chef/cookbook/remote_file_vendor.rb +84 -0
- data/lib/chef/cookbook/synchronizer.rb +216 -0
- data/lib/chef/cookbook/syntax_check.rb +183 -0
- data/lib/chef/cookbook_loader.rb +134 -0
- data/lib/chef/cookbook_site_streaming_uploader.rb +244 -0
- data/lib/chef/cookbook_uploader.rb +164 -0
- data/lib/chef/cookbook_version.rb +782 -0
- data/lib/chef/daemon.rb +172 -0
- data/lib/chef/data_bag.rb +145 -0
- data/lib/chef/data_bag_item.rb +214 -0
- data/lib/chef/digester.rb +73 -0
- data/lib/chef/dsl.rb +6 -0
- data/lib/chef/dsl/data_query.rb +71 -0
- data/lib/chef/dsl/include_attribute.rb +63 -0
- data/lib/chef/dsl/include_recipe.rb +45 -0
- data/lib/chef/dsl/platform_introspection.rb +218 -0
- data/lib/chef/dsl/recipe.rb +87 -0
- data/lib/chef/dsl/registry_helper.rb +59 -0
- data/lib/chef/encrypted_data_bag_item.rb +323 -0
- data/lib/chef/environment.rb +287 -0
- data/lib/chef/event_dispatch/base.rb +311 -0
- data/lib/chef/event_dispatch/dispatcher.rb +42 -0
- data/lib/chef/exceptions.rb +275 -0
- data/lib/chef/file_access_control.rb +75 -0
- data/lib/chef/file_access_control/unix.rb +216 -0
- data/lib/chef/file_access_control/windows.rb +310 -0
- data/lib/chef/file_cache.rb +220 -0
- data/lib/chef/formatters/base.rb +250 -0
- data/lib/chef/formatters/doc.rb +236 -0
- data/lib/chef/formatters/error_descriptor.rb +66 -0
- data/lib/chef/formatters/error_inspectors.rb +19 -0
- data/lib/chef/formatters/error_inspectors/api_error_formatting.rb +111 -0
- data/lib/chef/formatters/error_inspectors/compile_error_inspector.rb +106 -0
- data/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb +146 -0
- data/lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb +80 -0
- data/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb +125 -0
- data/lib/chef/formatters/error_inspectors/registration_error_inspector.rb +137 -0
- data/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb +117 -0
- data/lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb +118 -0
- data/lib/chef/formatters/error_mapper.rb +85 -0
- data/lib/chef/formatters/minimal.rb +235 -0
- data/lib/chef/handler.rb +235 -0
- data/lib/chef/handler/error_report.rb +33 -0
- data/lib/chef/handler/json_file.rb +65 -0
- data/lib/chef/json_compat.rb +147 -0
- data/lib/chef/knife.rb +589 -0
- data/lib/chef/knife/bootstrap.rb +233 -0
- data/lib/chef/knife/bootstrap/archlinux-gems.erb +62 -0
- data/lib/chef/knife/bootstrap/centos5-gems.erb +62 -0
- data/lib/chef/knife/bootstrap/chef-full.erb +60 -0
- data/lib/chef/knife/bootstrap/fedora13-gems.erb +44 -0
- data/lib/chef/knife/bootstrap/ubuntu10.04-apt.erb +53 -0
- data/lib/chef/knife/bootstrap/ubuntu10.04-gems.erb +48 -0
- data/lib/chef/knife/bootstrap/ubuntu12.04-gems.erb +46 -0
- data/lib/chef/knife/client_bulk_delete.rb +65 -0
- data/lib/chef/knife/client_create.rb +80 -0
- data/lib/chef/knife/client_delete.rb +46 -0
- data/lib/chef/knife/client_edit.rb +45 -0
- data/lib/chef/knife/client_list.rb +42 -0
- data/lib/chef/knife/client_reregister.rb +59 -0
- data/lib/chef/knife/client_show.rb +52 -0
- data/lib/chef/knife/configure.rb +170 -0
- data/lib/chef/knife/configure_client.rb +50 -0
- data/lib/chef/knife/cookbook_bulk_delete.rb +72 -0
- data/lib/chef/knife/cookbook_create.rb +447 -0
- data/lib/chef/knife/cookbook_delete.rb +151 -0
- data/lib/chef/knife/cookbook_download.rb +137 -0
- data/lib/chef/knife/cookbook_list.rb +47 -0
- data/lib/chef/knife/cookbook_metadata.rb +108 -0
- data/lib/chef/knife/cookbook_metadata_from_file.rb +44 -0
- data/lib/chef/knife/cookbook_show.rb +102 -0
- data/lib/chef/knife/cookbook_site_download.rb +109 -0
- data/lib/chef/knife/cookbook_site_install.rb +164 -0
- data/lib/chef/knife/cookbook_site_list.rb +62 -0
- data/lib/chef/knife/cookbook_site_search.rb +51 -0
- data/lib/chef/knife/cookbook_site_share.rb +114 -0
- data/lib/chef/knife/cookbook_site_show.rb +60 -0
- data/lib/chef/knife/cookbook_site_unshare.rb +56 -0
- data/lib/chef/knife/cookbook_site_vendor.rb +46 -0
- data/lib/chef/knife/cookbook_test.rb +94 -0
- data/lib/chef/knife/cookbook_upload.rb +295 -0
- data/lib/chef/knife/core/bootstrap_context.rb +106 -0
- data/lib/chef/knife/core/cookbook_scm_repo.rb +160 -0
- data/lib/chef/knife/core/generic_presenter.rb +204 -0
- data/lib/chef/knife/core/node_editor.rb +130 -0
- data/lib/chef/knife/core/node_presenter.rb +137 -0
- data/lib/chef/knife/core/object_loader.rb +112 -0
- data/lib/chef/knife/core/subcommand_loader.rb +112 -0
- data/lib/chef/knife/core/text_formatter.rb +86 -0
- data/lib/chef/knife/core/ui.rb +219 -0
- data/lib/chef/knife/data_bag_create.rb +93 -0
- data/lib/chef/knife/data_bag_delete.rb +51 -0
- data/lib/chef/knife/data_bag_edit.rb +94 -0
- data/lib/chef/knife/data_bag_from_file.rb +136 -0
- data/lib/chef/knife/data_bag_list.rb +46 -0
- data/lib/chef/knife/data_bag_show.rb +81 -0
- data/lib/chef/knife/delete.rb +39 -0
- data/lib/chef/knife/diff.rb +46 -0
- data/lib/chef/knife/download.rb +50 -0
- data/lib/chef/knife/environment_create.rb +53 -0
- data/lib/chef/knife/environment_delete.rb +45 -0
- data/lib/chef/knife/environment_edit.rb +45 -0
- data/lib/chef/knife/environment_from_file.rb +83 -0
- data/lib/chef/knife/environment_list.rb +42 -0
- data/lib/chef/knife/environment_show.rb +53 -0
- data/lib/chef/knife/exec.rb +86 -0
- data/lib/chef/knife/help.rb +103 -0
- data/lib/chef/knife/help_topics.rb +4 -0
- data/lib/chef/knife/index_rebuild.rb +134 -0
- data/lib/chef/knife/list.rb +109 -0
- data/lib/chef/knife/node_bulk_delete.rb +80 -0
- data/lib/chef/knife/node_create.rb +50 -0
- data/lib/chef/knife/node_delete.rb +47 -0
- data/lib/chef/knife/node_edit.rb +72 -0
- data/lib/chef/knife/node_from_file.rb +50 -0
- data/lib/chef/knife/node_list.rb +46 -0
- data/lib/chef/knife/node_run_list_add.rb +75 -0
- data/lib/chef/knife/node_run_list_remove.rb +48 -0
- data/lib/chef/knife/node_show.rb +73 -0
- data/lib/chef/knife/raw.rb +108 -0
- data/lib/chef/knife/recipe_list.rb +32 -0
- data/lib/chef/knife/role_bulk_delete.rb +70 -0
- data/lib/chef/knife/role_create.rb +55 -0
- data/lib/chef/knife/role_delete.rb +47 -0
- data/lib/chef/knife/role_edit.rb +48 -0
- data/lib/chef/knife/role_from_file.rb +56 -0
- data/lib/chef/knife/role_list.rb +43 -0
- data/lib/chef/knife/role_show.rb +54 -0
- data/lib/chef/knife/search.rb +159 -0
- data/lib/chef/knife/show.rb +32 -0
- data/lib/chef/knife/ssh.rb +463 -0
- data/lib/chef/knife/status.rb +119 -0
- data/lib/chef/knife/tag_create.rb +52 -0
- data/lib/chef/knife/tag_delete.rb +60 -0
- data/lib/chef/knife/tag_list.rb +47 -0
- data/lib/chef/knife/upload.rb +50 -0
- data/lib/chef/knife/user_create.rb +93 -0
- data/lib/chef/knife/user_delete.rb +46 -0
- data/lib/chef/knife/user_edit.rb +53 -0
- data/lib/chef/knife/user_list.rb +42 -0
- data/lib/chef/knife/user_reregister.rb +59 -0
- data/lib/chef/knife/user_show.rb +52 -0
- data/lib/chef/log.rb +39 -0
- data/lib/chef/mash.rb +225 -0
- data/lib/chef/mixin/checksum.rb +32 -0
- data/lib/chef/mixin/command.rb +164 -0
- data/lib/chef/mixin/command/unix.rb +220 -0
- data/lib/chef/mixin/command/windows.rb +76 -0
- data/lib/chef/mixin/convert_to_class_name.rb +65 -0
- data/lib/chef/mixin/create_path.rb +57 -0
- data/lib/chef/mixin/deep_merge.rb +168 -0
- data/lib/chef/mixin/deprecation.rb +100 -0
- data/lib/chef/mixin/enforce_ownership_and_permissions.rb +39 -0
- data/lib/chef/mixin/file_class.rb +46 -0
- data/lib/chef/mixin/from_file.rb +50 -0
- data/lib/chef/mixin/get_source_from_package.rb +42 -0
- data/lib/chef/mixin/language.rb +48 -0
- data/lib/chef/mixin/language_include_attribute.rb +35 -0
- data/lib/chef/mixin/language_include_recipe.rb +32 -0
- data/lib/chef/mixin/params_validate.rb +225 -0
- data/lib/chef/mixin/path_sanity.rb +67 -0
- data/lib/chef/mixin/recipe_definition_dsl_core.rb +35 -0
- data/lib/chef/mixin/securable.rb +205 -0
- data/lib/chef/mixin/shell_out.rb +69 -0
- data/lib/chef/mixin/template.rb +140 -0
- data/lib/chef/mixin/why_run.rb +332 -0
- data/lib/chef/mixin/xml_escape.rb +140 -0
- data/lib/chef/mixins.rb +14 -0
- data/lib/chef/monkey_patches/dir.rb +36 -0
- data/lib/chef/monkey_patches/fileutils.rb +65 -0
- data/lib/chef/monkey_patches/net_http.rb +22 -0
- data/lib/chef/monkey_patches/numeric.rb +15 -0
- data/lib/chef/monkey_patches/object.rb +9 -0
- data/lib/chef/monkey_patches/regexp.rb +34 -0
- data/lib/chef/monkey_patches/string.rb +49 -0
- data/lib/chef/monkey_patches/tempfile.rb +64 -0
- data/lib/chef/nil_argument.rb +3 -0
- data/lib/chef/node.rb +509 -0
- data/lib/chef/node/attribute.rb +398 -0
- data/lib/chef/node/attribute_collections.rb +206 -0
- data/lib/chef/node/immutable_collections.rb +186 -0
- data/lib/chef/platform.rb +519 -0
- data/lib/chef/provider.rb +176 -0
- data/lib/chef/provider/breakpoint.rb +36 -0
- data/lib/chef/provider/cookbook_file.rb +113 -0
- data/lib/chef/provider/cron.rb +214 -0
- data/lib/chef/provider/cron/solaris.rb +56 -0
- data/lib/chef/provider/deploy.rb +475 -0
- data/lib/chef/provider/deploy/revision.rb +80 -0
- data/lib/chef/provider/deploy/timestamped.rb +32 -0
- data/lib/chef/provider/directory.rb +131 -0
- data/lib/chef/provider/env.rb +152 -0
- data/lib/chef/provider/env/windows.rb +75 -0
- data/lib/chef/provider/erl_call.rb +106 -0
- data/lib/chef/provider/execute.rb +68 -0
- data/lib/chef/provider/file.rb +328 -0
- data/lib/chef/provider/git.rb +260 -0
- data/lib/chef/provider/group.rb +158 -0
- data/lib/chef/provider/group/aix.rb +70 -0
- data/lib/chef/provider/group/dscl.rb +129 -0
- data/lib/chef/provider/group/gpasswd.rb +65 -0
- data/lib/chef/provider/group/groupadd.rb +96 -0
- data/lib/chef/provider/group/groupmod.rb +120 -0
- data/lib/chef/provider/group/pw.rb +93 -0
- data/lib/chef/provider/group/suse.rb +60 -0
- data/lib/chef/provider/group/usermod.rb +68 -0
- data/lib/chef/provider/group/windows.rb +79 -0
- data/lib/chef/provider/http_request.rb +119 -0
- data/lib/chef/provider/ifconfig.rb +214 -0
- data/lib/chef/provider/link.rb +132 -0
- data/lib/chef/provider/log.rb +54 -0
- data/lib/chef/provider/lwrp_base.rb +150 -0
- data/lib/chef/provider/mdadm.rb +92 -0
- data/lib/chef/provider/mount.rb +128 -0
- data/lib/chef/provider/mount/mount.rb +252 -0
- data/lib/chef/provider/mount/windows.rb +81 -0
- data/lib/chef/provider/ohai.rb +47 -0
- data/lib/chef/provider/package.rb +229 -0
- data/lib/chef/provider/package/apt.rb +147 -0
- data/lib/chef/provider/package/dpkg.rb +128 -0
- data/lib/chef/provider/package/easy_install.rb +136 -0
- data/lib/chef/provider/package/freebsd.rb +149 -0
- data/lib/chef/provider/package/ips.rb +101 -0
- data/lib/chef/provider/package/macports.rb +105 -0
- data/lib/chef/provider/package/pacman.rb +111 -0
- data/lib/chef/provider/package/portage.rb +138 -0
- data/lib/chef/provider/package/rpm.rb +121 -0
- data/lib/chef/provider/package/rubygems.rb +548 -0
- data/lib/chef/provider/package/smartos.rb +84 -0
- data/lib/chef/provider/package/solaris.rb +139 -0
- data/lib/chef/provider/package/yum-dump.py +307 -0
- data/lib/chef/provider/package/yum.rb +1255 -0
- data/lib/chef/provider/package/zypper.rb +144 -0
- data/lib/chef/provider/registry_key.rb +156 -0
- data/lib/chef/provider/remote_directory.rb +180 -0
- data/lib/chef/provider/remote_file.rb +141 -0
- data/lib/chef/provider/resource_update.rb +55 -0
- data/lib/chef/provider/route.rb +223 -0
- data/lib/chef/provider/ruby_block.rb +42 -0
- data/lib/chef/provider/script.rb +57 -0
- data/lib/chef/provider/service.rb +173 -0
- data/lib/chef/provider/service/arch.rb +113 -0
- data/lib/chef/provider/service/debian.rb +152 -0
- data/lib/chef/provider/service/freebsd.rb +175 -0
- data/lib/chef/provider/service/gentoo.rb +67 -0
- data/lib/chef/provider/service/init.rb +89 -0
- data/lib/chef/provider/service/insserv.rb +52 -0
- data/lib/chef/provider/service/invokercd.rb +35 -0
- data/lib/chef/provider/service/macosx.rb +144 -0
- data/lib/chef/provider/service/redhat.rb +77 -0
- data/lib/chef/provider/service/simple.rb +172 -0
- data/lib/chef/provider/service/solaris.rb +86 -0
- data/lib/chef/provider/service/systemd.rb +115 -0
- data/lib/chef/provider/service/upstart.rb +232 -0
- data/lib/chef/provider/service/windows.rb +163 -0
- data/lib/chef/provider/subversion.rb +214 -0
- data/lib/chef/provider/template.rb +120 -0
- data/lib/chef/provider/template_finder.rb +61 -0
- data/lib/chef/provider/user.rb +206 -0
- data/lib/chef/provider/user/dscl.rb +288 -0
- data/lib/chef/provider/user/pw.rb +113 -0
- data/lib/chef/provider/user/useradd.rb +144 -0
- data/lib/chef/provider/user/windows.rb +124 -0
- data/lib/chef/providers.rb +103 -0
- data/lib/chef/recipe.rb +135 -0
- data/lib/chef/reserved_names.rb +9 -0
- data/lib/chef/resource.rb +794 -0
- data/lib/chef/resource/apt_package.rb +43 -0
- data/lib/chef/resource/bash.rb +33 -0
- data/lib/chef/resource/breakpoint.rb +35 -0
- data/lib/chef/resource/chef_gem.rb +53 -0
- data/lib/chef/resource/conditional.rb +101 -0
- data/lib/chef/resource/cookbook_file.rb +52 -0
- data/lib/chef/resource/cron.rb +202 -0
- data/lib/chef/resource/csh.rb +33 -0
- data/lib/chef/resource/deploy.rb +403 -0
- data/lib/chef/resource/deploy_revision.rb +40 -0
- data/lib/chef/resource/directory.rb +65 -0
- data/lib/chef/resource/dpkg_package.rb +34 -0
- data/lib/chef/resource/easy_install_package.rb +57 -0
- data/lib/chef/resource/env.rb +63 -0
- data/lib/chef/resource/erl_call.rb +86 -0
- data/lib/chef/resource/execute.rb +132 -0
- data/lib/chef/resource/file.rb +96 -0
- data/lib/chef/resource/freebsd_package.rb +35 -0
- data/lib/chef/resource/gem_package.rb +53 -0
- data/lib/chef/resource/git.rb +46 -0
- data/lib/chef/resource/group.rb +83 -0
- data/lib/chef/resource/http_request.rb +65 -0
- data/lib/chef/resource/ifconfig.rb +149 -0
- data/lib/chef/resource/ips_package.rb +42 -0
- data/lib/chef/resource/link.rb +92 -0
- data/lib/chef/resource/log.rb +74 -0
- data/lib/chef/resource/lwrp_base.rb +127 -0
- data/lib/chef/resource/macports_package.rb +29 -0
- data/lib/chef/resource/mdadm.rb +105 -0
- data/lib/chef/resource/mount.rb +139 -0
- data/lib/chef/resource/ohai.rb +54 -0
- data/lib/chef/resource/package.rb +84 -0
- data/lib/chef/resource/pacman_package.rb +33 -0
- data/lib/chef/resource/perl.rb +33 -0
- data/lib/chef/resource/portage_package.rb +33 -0
- data/lib/chef/resource/python.rb +33 -0
- data/lib/chef/resource/registry_key.rb +86 -0
- data/lib/chef/resource/remote_directory.rb +126 -0
- data/lib/chef/resource/remote_file.rb +81 -0
- data/lib/chef/resource/route.rb +140 -0
- data/lib/chef/resource/rpm_package.rb +34 -0
- data/lib/chef/resource/ruby.rb +33 -0
- data/lib/chef/resource/ruby_block.rb +51 -0
- data/lib/chef/resource/scm.rb +151 -0
- data/lib/chef/resource/script.rb +63 -0
- data/lib/chef/resource/service.rb +178 -0
- data/lib/chef/resource/smartos_package.rb +36 -0
- data/lib/chef/resource/solaris_package.rb +36 -0
- data/lib/chef/resource/subversion.rb +37 -0
- data/lib/chef/resource/template.rb +76 -0
- data/lib/chef/resource/timestamped_deploy.rb +31 -0
- data/lib/chef/resource/user.rb +134 -0
- data/lib/chef/resource/yum_package.rb +63 -0
- data/lib/chef/resource_collection.rb +221 -0
- data/lib/chef/resource_collection/stepable_iterator.rb +124 -0
- data/lib/chef/resource_definition.rb +67 -0
- data/lib/chef/resource_definition_list.rb +38 -0
- data/lib/chef/resource_platform_map.rb +151 -0
- data/lib/chef/resource_reporter.rb +281 -0
- data/lib/chef/resources.rb +69 -0
- data/lib/chef/rest.rb +438 -0
- data/lib/chef/rest/auth_credentials.rb +57 -0
- data/lib/chef/rest/cookie_jar.rb +31 -0
- data/lib/chef/rest/rest_request.rb +229 -0
- data/lib/chef/role.rb +253 -0
- data/lib/chef/run_context.rb +214 -0
- data/lib/chef/run_context/cookbook_compiler.rb +280 -0
- data/lib/chef/run_list.rb +163 -0
- data/lib/chef/run_list/run_list_expansion.rb +191 -0
- data/lib/chef/run_list/run_list_item.rb +99 -0
- data/lib/chef/run_list/versioned_recipe_list.rb +68 -0
- data/lib/chef/run_lock.rb +90 -0
- data/lib/chef/run_status.rb +124 -0
- data/lib/chef/runner.rb +118 -0
- data/lib/chef/sandbox.rb +20 -0
- data/lib/chef/scan_access_control.rb +133 -0
- data/lib/chef/search/query.rb +65 -0
- data/lib/chef/shef/ext.rb +19 -0
- data/lib/chef/shell.rb +329 -0
- data/lib/chef/shell/ext.rb +593 -0
- data/lib/chef/shell/model_wrapper.rb +120 -0
- data/lib/chef/shell/shell_rest.rb +28 -0
- data/lib/chef/shell/shell_session.rb +298 -0
- data/lib/chef/shell_out.rb +13 -0
- data/lib/chef/streaming_cookbook_uploader.rb +201 -0
- data/lib/chef/tasks/chef_repo.rake +334 -0
- data/lib/chef/user.rb +182 -0
- data/lib/chef/util/file_edit.rb +132 -0
- data/lib/chef/util/windows.rb +56 -0
- data/lib/chef/util/windows/net_group.rb +101 -0
- data/lib/chef/util/windows/net_use.rb +121 -0
- data/lib/chef/util/windows/net_user.rb +198 -0
- data/lib/chef/util/windows/volume.rb +59 -0
- data/lib/chef/version.rb +23 -0
- data/lib/chef/version_class.rb +70 -0
- data/lib/chef/version_constraint.rb +116 -0
- data/lib/chef/win32/api.rb +364 -0
- data/lib/chef/win32/api/error.rb +921 -0
- data/lib/chef/win32/api/file.rb +535 -0
- data/lib/chef/win32/api/memory.rb +105 -0
- data/lib/chef/win32/api/process.rb +41 -0
- data/lib/chef/win32/api/psapi.rb +51 -0
- data/lib/chef/win32/api/security.rb +385 -0
- data/lib/chef/win32/api/system.rb +192 -0
- data/lib/chef/win32/api/unicode.rb +178 -0
- data/lib/chef/win32/error.rb +73 -0
- data/lib/chef/win32/file.rb +167 -0
- data/lib/chef/win32/file/info.rb +100 -0
- data/lib/chef/win32/handle.rb +55 -0
- data/lib/chef/win32/memory.rb +101 -0
- data/lib/chef/win32/process.rb +84 -0
- data/lib/chef/win32/registry.rb +382 -0
- data/lib/chef/win32/security.rb +508 -0
- data/lib/chef/win32/security/ace.rb +125 -0
- data/lib/chef/win32/security/acl.rb +101 -0
- data/lib/chef/win32/security/securable_object.rb +109 -0
- data/lib/chef/win32/security/security_descriptor.rb +93 -0
- data/lib/chef/win32/security/sid.rb +199 -0
- data/lib/chef/win32/security/token.rb +64 -0
- data/lib/chef/win32/unicode.rb +43 -0
- data/lib/chef/win32/version.rb +119 -0
- metadata +553 -3
@@ -0,0 +1,171 @@
|
|
1
|
+
|
2
|
+
require 'chef/config'
|
3
|
+
require 'chef/cookbook_version'
|
4
|
+
require 'chef/cookbook/chefignore'
|
5
|
+
require 'chef/cookbook/metadata'
|
6
|
+
|
7
|
+
class Chef
|
8
|
+
class Cookbook
|
9
|
+
class CookbookVersionLoader
|
10
|
+
|
11
|
+
FILETYPES_SUBJECT_TO_IGNORE = [ :attribute_filenames,
|
12
|
+
:definition_filenames,
|
13
|
+
:recipe_filenames,
|
14
|
+
:template_filenames,
|
15
|
+
:file_filenames,
|
16
|
+
:library_filenames,
|
17
|
+
:resource_filenames,
|
18
|
+
:provider_filenames]
|
19
|
+
|
20
|
+
|
21
|
+
attr_reader :cookbook_name
|
22
|
+
attr_reader :cookbook_settings
|
23
|
+
attr_reader :metadata_filenames
|
24
|
+
|
25
|
+
def initialize(path, chefignore=nil)
|
26
|
+
@cookbook_path = File.expand_path( path )
|
27
|
+
@cookbook_name = File.basename( path )
|
28
|
+
@chefignore = chefignore
|
29
|
+
@metadata = Hash.new
|
30
|
+
@relative_path = /#{Regexp.escape(@cookbook_path)}\/(.+)$/
|
31
|
+
@cookbook_settings = {
|
32
|
+
:attribute_filenames => {},
|
33
|
+
:definition_filenames => {},
|
34
|
+
:recipe_filenames => {},
|
35
|
+
:template_filenames => {},
|
36
|
+
:file_filenames => {},
|
37
|
+
:library_filenames => {},
|
38
|
+
:resource_filenames => {},
|
39
|
+
:provider_filenames => {},
|
40
|
+
:root_filenames => {}
|
41
|
+
}
|
42
|
+
|
43
|
+
@metadata_filenames = []
|
44
|
+
end
|
45
|
+
|
46
|
+
def load_cookbooks
|
47
|
+
load_as(:attribute_filenames, 'attributes', '*.rb')
|
48
|
+
load_as(:definition_filenames, 'definitions', '*.rb')
|
49
|
+
load_as(:recipe_filenames, 'recipes', '*.rb')
|
50
|
+
load_as(:library_filenames, 'libraries', '*.rb')
|
51
|
+
load_recursively_as(:template_filenames, "templates", "*")
|
52
|
+
load_recursively_as(:file_filenames, "files", "*")
|
53
|
+
load_recursively_as(:resource_filenames, "resources", "*.rb")
|
54
|
+
load_recursively_as(:provider_filenames, "providers", "*.rb")
|
55
|
+
load_root_files
|
56
|
+
|
57
|
+
remove_ignored_files
|
58
|
+
|
59
|
+
if File.exists?(File.join(@cookbook_path, "metadata.rb"))
|
60
|
+
@metadata_filenames << File.join(@cookbook_path, "metadata.rb")
|
61
|
+
elsif File.exists?(File.join(@cookbook_path, "metadata.json"))
|
62
|
+
@metadata_filenames << File.join(@cookbook_path, "metadata.json")
|
63
|
+
end
|
64
|
+
|
65
|
+
if empty?
|
66
|
+
Chef::Log.warn "found a directory #{cookbook_name} in the cookbook path, but it contains no cookbook files. skipping."
|
67
|
+
end
|
68
|
+
@cookbook_settings
|
69
|
+
end
|
70
|
+
|
71
|
+
def cookbook_version
|
72
|
+
return nil if empty?
|
73
|
+
|
74
|
+
Chef::CookbookVersion.new(@cookbook_name.to_sym).tap do |c|
|
75
|
+
c.root_dir = @cookbook_path
|
76
|
+
c.attribute_filenames = cookbook_settings[:attribute_filenames].values
|
77
|
+
c.definition_filenames = cookbook_settings[:definition_filenames].values
|
78
|
+
c.recipe_filenames = cookbook_settings[:recipe_filenames].values
|
79
|
+
c.template_filenames = cookbook_settings[:template_filenames].values
|
80
|
+
c.file_filenames = cookbook_settings[:file_filenames].values
|
81
|
+
c.library_filenames = cookbook_settings[:library_filenames].values
|
82
|
+
c.resource_filenames = cookbook_settings[:resource_filenames].values
|
83
|
+
c.provider_filenames = cookbook_settings[:provider_filenames].values
|
84
|
+
c.root_filenames = cookbook_settings[:root_filenames].values
|
85
|
+
c.metadata_filenames = @metadata_filenames
|
86
|
+
c.metadata = metadata(c)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
# Generates the Cookbook::Metadata object
|
91
|
+
def metadata(cookbook_version)
|
92
|
+
@metadata = Chef::Cookbook::Metadata.new(cookbook_version)
|
93
|
+
@metadata_filenames.each do |metadata_file|
|
94
|
+
case metadata_file
|
95
|
+
when /\.rb$/
|
96
|
+
apply_ruby_metadata(metadata_file)
|
97
|
+
when /\.json$/
|
98
|
+
apply_json_metadata(metadata_file)
|
99
|
+
else
|
100
|
+
raise RuntimeError, "Invalid metadata file: #{metadata_file} for cookbook: #{cookbook_version}"
|
101
|
+
end
|
102
|
+
end
|
103
|
+
@metadata
|
104
|
+
end
|
105
|
+
|
106
|
+
def empty?
|
107
|
+
@cookbook_settings.values.all? { |files_hash| files_hash.empty? }
|
108
|
+
end
|
109
|
+
|
110
|
+
def merge!(other_cookbook_loader)
|
111
|
+
other_cookbook_settings = other_cookbook_loader.cookbook_settings
|
112
|
+
@cookbook_settings.each do |file_type, file_list|
|
113
|
+
file_list.merge!(other_cookbook_settings[file_type])
|
114
|
+
end
|
115
|
+
@metadata_filenames.concat(other_cookbook_loader.metadata_filenames)
|
116
|
+
end
|
117
|
+
|
118
|
+
def chefignore
|
119
|
+
@chefignore ||= Chefignore.new(File.basename(@cookbook_path))
|
120
|
+
end
|
121
|
+
|
122
|
+
def load_root_files
|
123
|
+
Dir.glob(File.join(@cookbook_path, '*'), File::FNM_DOTMATCH).each do |file|
|
124
|
+
next if File.directory?(file)
|
125
|
+
@cookbook_settings[:root_filenames][file[@relative_path, 1]] = file
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
def load_recursively_as(category, category_dir, glob)
|
130
|
+
file_spec = File.join(@cookbook_path, category_dir, '**', glob)
|
131
|
+
Dir.glob(file_spec, File::FNM_DOTMATCH).each do |file|
|
132
|
+
next if File.directory?(file)
|
133
|
+
@cookbook_settings[category][file[@relative_path, 1]] = file
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
def load_as(category, *path_glob)
|
138
|
+
Dir[File.join(@cookbook_path, *path_glob)].each do |file|
|
139
|
+
@cookbook_settings[category][file[@relative_path, 1]] = file
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
def remove_ignored_files
|
144
|
+
@cookbook_settings.each_value do |file_list|
|
145
|
+
file_list.reject! do |relative_path, full_path|
|
146
|
+
chefignore.ignored?(relative_path)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
def apply_ruby_metadata(file)
|
152
|
+
begin
|
153
|
+
@metadata.from_file(file)
|
154
|
+
rescue JSON::ParserError
|
155
|
+
Chef::Log.error("Error evaluating metadata.rb for #@cookbook_name in " + file)
|
156
|
+
raise
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
def apply_json_metadata(file)
|
161
|
+
begin
|
162
|
+
@metadata.from_json(IO.read(file))
|
163
|
+
rescue JSON::ParserError
|
164
|
+
Chef::Log.error("Couldn't parse cookbook metadata JSON for #@cookbook_name in " + file)
|
165
|
+
raise
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
#--
|
2
|
+
# Author:: Christopher Walters (<cw@opscode.com>)
|
3
|
+
# Author:: Tim Hinderliter (<tim@opscode.com>)
|
4
|
+
# Copyright:: Copyright (c) 2010 Opscode, Inc.
|
5
|
+
# License:: Apache License, Version 2.0
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
require 'chef/cookbook/file_vendor'
|
21
|
+
|
22
|
+
class Chef
|
23
|
+
class Cookbook
|
24
|
+
# == Chef::Cookbook::FileSystemFileVendor
|
25
|
+
# This FileVendor loads files from Chef::Config.cookbook_path. The
|
26
|
+
# thing that's sort of janky about this FileVendor implementation is
|
27
|
+
# that it basically takes only the cookbook's name from the manifest
|
28
|
+
# and throws the rest away then re-builds the list of files on the
|
29
|
+
# disk. This is due to the manifest not having the on-disk file
|
30
|
+
# locations, since in the chef-client case, that information is
|
31
|
+
# non-sensical.
|
32
|
+
class FileSystemFileVendor < FileVendor
|
33
|
+
|
34
|
+
def initialize(manifest, *repo_paths)
|
35
|
+
@cookbook_name = manifest[:cookbook_name]
|
36
|
+
@repo_paths = repo_paths.flatten
|
37
|
+
raise ArgumentError, "You must specify at least one repo path" if @repo_paths.empty?
|
38
|
+
end
|
39
|
+
|
40
|
+
# Implements abstract base's requirement. It looks in the
|
41
|
+
# Chef::Config.cookbook_path file hierarchy for the requested
|
42
|
+
# file.
|
43
|
+
def get_filename(filename)
|
44
|
+
location = @repo_paths.inject(nil) do |memo, basepath|
|
45
|
+
candidate_location = File.join(basepath, @cookbook_name, filename)
|
46
|
+
memo = candidate_location if File.exist?(candidate_location)
|
47
|
+
memo
|
48
|
+
end
|
49
|
+
raise "File #{filename} does not exist for cookbook #{@cookbook_name}" unless location
|
50
|
+
|
51
|
+
location
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Christopher Walters (<cw@opscode.com>)
|
3
|
+
# Author:: Tim Hinderliter (<tim@opscode.com>)
|
4
|
+
# Copyright:: Copyright (c) 2010 Opscode, Inc.
|
5
|
+
# License:: Apache License, Version 2.0
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
|
21
|
+
class Chef
|
22
|
+
class Cookbook
|
23
|
+
# == Chef::Cookbook::FileVendor
|
24
|
+
# This class handles fetching of cookbook files based on specificity.
|
25
|
+
class FileVendor
|
26
|
+
|
27
|
+
def self.on_create(&block)
|
28
|
+
@instance_creator = block
|
29
|
+
end
|
30
|
+
|
31
|
+
# Factory method that creates the appropriate kind of
|
32
|
+
# Cookbook::FileVendor to serve the contents of the manifest
|
33
|
+
def self.create_from_manifest(manifest)
|
34
|
+
raise "Must call Chef::Cookbook::FileVendor.on_create before calling create_from_manifest factory" unless defined?(@instance_creator)
|
35
|
+
@instance_creator.call(manifest)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Gets the on-disk location for the given cookbook file.
|
39
|
+
#
|
40
|
+
# Subclasses are responsible for determining exactly how the
|
41
|
+
# files are obtained and where they are stored.
|
42
|
+
def get_filename(filename)
|
43
|
+
raise NotImplemented, "Subclasses must implement this method"
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,627 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Adam Jacob (<adam@opscode.com>)
|
3
|
+
# Author:: AJ Christensen (<aj@opscode.com>)
|
4
|
+
# Author:: Seth Falcon (<seth@opscode.com>)
|
5
|
+
# Copyright:: Copyright 2008-2010 Opscode, Inc.
|
6
|
+
# License:: Apache License, Version 2.0
|
7
|
+
#
|
8
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
# you may not use this file except in compliance with the License.
|
10
|
+
# You may obtain a copy of the License at
|
11
|
+
#
|
12
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
#
|
14
|
+
# Unless required by applicable law or agreed to in writing, software
|
15
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
# See the License for the specific language governing permissions and
|
18
|
+
# limitations under the License.
|
19
|
+
#
|
20
|
+
|
21
|
+
require 'chef/mash'
|
22
|
+
require 'chef/mixin/from_file'
|
23
|
+
require 'chef/mixin/params_validate'
|
24
|
+
require 'chef/log'
|
25
|
+
require 'chef/version_class'
|
26
|
+
require 'chef/version_constraint'
|
27
|
+
|
28
|
+
class Chef
|
29
|
+
class Cookbook
|
30
|
+
|
31
|
+
# == Chef::Cookbook::Metadata
|
32
|
+
# Chef::Cookbook::Metadata provides a convenient DSL for declaring metadata
|
33
|
+
# about Chef Cookbooks.
|
34
|
+
class Metadata
|
35
|
+
|
36
|
+
NAME = 'name'.freeze
|
37
|
+
DESCRIPTION = 'description'.freeze
|
38
|
+
LONG_DESCRIPTION = 'long_description'.freeze
|
39
|
+
MAINTAINER = 'maintainer'.freeze
|
40
|
+
MAINTAINER_EMAIL = 'maintainer_email'.freeze
|
41
|
+
LICENSE = 'license'.freeze
|
42
|
+
PLATFORMS = 'platforms'.freeze
|
43
|
+
DEPENDENCIES = 'dependencies'.freeze
|
44
|
+
RECOMMENDATIONS = 'recommendations'.freeze
|
45
|
+
SUGGESTIONS = 'suggestions'.freeze
|
46
|
+
CONFLICTING = 'conflicting'.freeze
|
47
|
+
PROVIDING = 'providing'.freeze
|
48
|
+
REPLACING = 'replacing'.freeze
|
49
|
+
ATTRIBUTES = 'attributes'.freeze
|
50
|
+
GROUPINGS = 'groupings'.freeze
|
51
|
+
RECIPES = 'recipes'.freeze
|
52
|
+
VERSION = 'version'.freeze
|
53
|
+
|
54
|
+
COMPARISON_FIELDS = [ :name, :description, :long_description, :maintainer,
|
55
|
+
:maintainer_email, :license, :platforms, :dependencies,
|
56
|
+
:recommendations, :suggestions, :conflicting, :providing,
|
57
|
+
:replacing, :attributes, :groupings, :recipes, :version]
|
58
|
+
|
59
|
+
VERSION_CONSTRAINTS = {:depends => DEPENDENCIES,
|
60
|
+
:recommends => RECOMMENDATIONS,
|
61
|
+
:suggests => SUGGESTIONS,
|
62
|
+
:conflicts => CONFLICTING,
|
63
|
+
:provides => PROVIDING,
|
64
|
+
:replaces => REPLACING }
|
65
|
+
|
66
|
+
include Chef::Mixin::ParamsValidate
|
67
|
+
include Chef::Mixin::FromFile
|
68
|
+
|
69
|
+
attr_reader :cookbook,
|
70
|
+
:platforms,
|
71
|
+
:dependencies,
|
72
|
+
:recommendations,
|
73
|
+
:suggestions,
|
74
|
+
:conflicting,
|
75
|
+
:providing,
|
76
|
+
:replacing,
|
77
|
+
:attributes,
|
78
|
+
:groupings,
|
79
|
+
:recipes,
|
80
|
+
:version
|
81
|
+
|
82
|
+
# Builds a new Chef::Cookbook::Metadata object.
|
83
|
+
#
|
84
|
+
# === Parameters
|
85
|
+
# cookbook<String>:: An optional cookbook object
|
86
|
+
# maintainer<String>:: An optional maintainer
|
87
|
+
# maintainer_email<String>:: An optional maintainer email
|
88
|
+
# license<String>::An optional license. Default is Apache v2.0
|
89
|
+
#
|
90
|
+
# === Returns
|
91
|
+
# metadata<Chef::Cookbook::Metadata>
|
92
|
+
def initialize(cookbook=nil, maintainer='YOUR_COMPANY_NAME', maintainer_email='YOUR_EMAIL', license='none')
|
93
|
+
@cookbook = cookbook
|
94
|
+
@name = cookbook ? cookbook.name : ""
|
95
|
+
@long_description = ""
|
96
|
+
self.maintainer(maintainer)
|
97
|
+
self.maintainer_email(maintainer_email)
|
98
|
+
self.license(license)
|
99
|
+
self.description('A fabulous new cookbook')
|
100
|
+
@platforms = Mash.new
|
101
|
+
@dependencies = Mash.new
|
102
|
+
@recommendations = Mash.new
|
103
|
+
@suggestions = Mash.new
|
104
|
+
@conflicting = Mash.new
|
105
|
+
@providing = Mash.new
|
106
|
+
@replacing = Mash.new
|
107
|
+
@attributes = Mash.new
|
108
|
+
@groupings = Mash.new
|
109
|
+
@recipes = Mash.new
|
110
|
+
@version = Version.new "0.0.0"
|
111
|
+
if cookbook
|
112
|
+
@recipes = cookbook.fully_qualified_recipe_names.inject({}) do |r, e|
|
113
|
+
e = self.name if e =~ /::default$/
|
114
|
+
r[e] = ""
|
115
|
+
self.provides e
|
116
|
+
r
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
def ==(other)
|
122
|
+
COMPARISON_FIELDS.inject(true) do |equal_so_far, field|
|
123
|
+
equal_so_far && other.respond_to?(field) && (other.send(field) == send(field))
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
# Sets the cookbooks maintainer, or returns it.
|
128
|
+
#
|
129
|
+
# === Parameters
|
130
|
+
# maintainer<String>:: The maintainers name
|
131
|
+
#
|
132
|
+
# === Returns
|
133
|
+
# maintainer<String>:: Returns the current maintainer.
|
134
|
+
def maintainer(arg=nil)
|
135
|
+
set_or_return(
|
136
|
+
:maintainer,
|
137
|
+
arg,
|
138
|
+
:kind_of => [ String ]
|
139
|
+
)
|
140
|
+
end
|
141
|
+
|
142
|
+
# Sets the maintainers email address, or returns it.
|
143
|
+
#
|
144
|
+
# === Parameters
|
145
|
+
# maintainer_email<String>:: The maintainers email address
|
146
|
+
#
|
147
|
+
# === Returns
|
148
|
+
# maintainer_email<String>:: Returns the current maintainer email.
|
149
|
+
def maintainer_email(arg=nil)
|
150
|
+
set_or_return(
|
151
|
+
:maintainer_email,
|
152
|
+
arg,
|
153
|
+
:kind_of => [ String ]
|
154
|
+
)
|
155
|
+
end
|
156
|
+
|
157
|
+
# Sets the current license, or returns it.
|
158
|
+
#
|
159
|
+
# === Parameters
|
160
|
+
# license<String>:: The current license.
|
161
|
+
#
|
162
|
+
# === Returns
|
163
|
+
# license<String>:: Returns the current license
|
164
|
+
def license(arg=nil)
|
165
|
+
set_or_return(
|
166
|
+
:license,
|
167
|
+
arg,
|
168
|
+
:kind_of => [ String ]
|
169
|
+
)
|
170
|
+
end
|
171
|
+
|
172
|
+
# Sets the current description, or returns it. Should be short - one line only!
|
173
|
+
#
|
174
|
+
# === Parameters
|
175
|
+
# description<String>:: The new description
|
176
|
+
#
|
177
|
+
# === Returns
|
178
|
+
# description<String>:: Returns the description
|
179
|
+
def description(arg=nil)
|
180
|
+
set_or_return(
|
181
|
+
:description,
|
182
|
+
arg,
|
183
|
+
:kind_of => [ String ]
|
184
|
+
)
|
185
|
+
end
|
186
|
+
|
187
|
+
# Sets the current long description, or returns it. Might come from a README, say.
|
188
|
+
#
|
189
|
+
# === Parameters
|
190
|
+
# long_description<String>:: The new long description
|
191
|
+
#
|
192
|
+
# === Returns
|
193
|
+
# long_description<String>:: Returns the long description
|
194
|
+
def long_description(arg=nil)
|
195
|
+
set_or_return(
|
196
|
+
:long_description,
|
197
|
+
arg,
|
198
|
+
:kind_of => [ String ]
|
199
|
+
)
|
200
|
+
end
|
201
|
+
|
202
|
+
# Sets the current cookbook version, or returns it. Can be two or three digits, seperated
|
203
|
+
# by dots. ie: '2.1', '1.5.4' or '0.9'.
|
204
|
+
#
|
205
|
+
# === Parameters
|
206
|
+
# version<String>:: The curent version, as a string
|
207
|
+
#
|
208
|
+
# === Returns
|
209
|
+
# version<String>:: Returns the current version
|
210
|
+
def version(arg=nil)
|
211
|
+
if arg
|
212
|
+
@version = Chef::Version.new(arg)
|
213
|
+
end
|
214
|
+
|
215
|
+
@version.to_s
|
216
|
+
end
|
217
|
+
|
218
|
+
# Sets the name of the cookbook, or returns it.
|
219
|
+
#
|
220
|
+
# === Parameters
|
221
|
+
# name<String>:: The curent cookbook name.
|
222
|
+
#
|
223
|
+
# === Returns
|
224
|
+
# name<String>:: Returns the current cookbook name.
|
225
|
+
def name(arg=nil)
|
226
|
+
set_or_return(
|
227
|
+
:name,
|
228
|
+
arg,
|
229
|
+
:kind_of => [ String ]
|
230
|
+
)
|
231
|
+
end
|
232
|
+
|
233
|
+
# Adds a supported platform, with version checking strings.
|
234
|
+
#
|
235
|
+
# === Parameters
|
236
|
+
# platform<String>,<Symbol>:: The platform (like :ubuntu or :mac_os_x)
|
237
|
+
# version<String>:: A version constraint of the form "OP VERSION",
|
238
|
+
# where OP is one of < <= = > >= ~> and VERSION has
|
239
|
+
# the form x.y.z or x.y.
|
240
|
+
#
|
241
|
+
# === Returns
|
242
|
+
# versions<Array>:: Returns the list of versions for the platform
|
243
|
+
def supports(platform, *version_args)
|
244
|
+
version = new_args_format(:supports, platform, version_args)
|
245
|
+
validate_version_constraint(:supports, platform, version)
|
246
|
+
@platforms[platform] = version
|
247
|
+
@platforms[platform]
|
248
|
+
end
|
249
|
+
|
250
|
+
# Adds a dependency on another cookbook, with version checking strings.
|
251
|
+
#
|
252
|
+
# === Parameters
|
253
|
+
# cookbook<String>:: The cookbook
|
254
|
+
# version<String>:: A version constraint of the form "OP VERSION",
|
255
|
+
# where OP is one of < <= = > >= ~> and VERSION has
|
256
|
+
# the form x.y.z or x.y.
|
257
|
+
#
|
258
|
+
# === Returns
|
259
|
+
# versions<Array>:: Returns the list of versions for the platform
|
260
|
+
def depends(cookbook, *version_args)
|
261
|
+
version = new_args_format(:depends, cookbook, version_args)
|
262
|
+
validate_version_constraint(:depends, cookbook, version)
|
263
|
+
@dependencies[cookbook] = version
|
264
|
+
@dependencies[cookbook]
|
265
|
+
end
|
266
|
+
|
267
|
+
# Adds a recommendation for another cookbook, with version checking strings.
|
268
|
+
#
|
269
|
+
# === Parameters
|
270
|
+
# cookbook<String>:: The cookbook
|
271
|
+
# version<String>:: A version constraint of the form "OP VERSION",
|
272
|
+
# where OP is one of < <= = > >= ~> and VERSION has
|
273
|
+
# the form x.y.z or x.y.
|
274
|
+
#
|
275
|
+
# === Returns
|
276
|
+
# versions<Array>:: Returns the list of versions for the platform
|
277
|
+
def recommends(cookbook, *version_args)
|
278
|
+
version = new_args_format(:recommends, cookbook, version_args)
|
279
|
+
validate_version_constraint(:recommends, cookbook, version)
|
280
|
+
@recommendations[cookbook] = version
|
281
|
+
@recommendations[cookbook]
|
282
|
+
end
|
283
|
+
|
284
|
+
# Adds a suggestion for another cookbook, with version checking strings.
|
285
|
+
#
|
286
|
+
# === Parameters
|
287
|
+
# cookbook<String>:: The cookbook
|
288
|
+
# version<String>:: A version constraint of the form "OP VERSION",
|
289
|
+
# where OP is one of < <= = > >= ~> and VERSION has the
|
290
|
+
# formx.y.z or x.y.
|
291
|
+
#
|
292
|
+
# === Returns
|
293
|
+
# versions<Array>:: Returns the list of versions for the platform
|
294
|
+
def suggests(cookbook, *version_args)
|
295
|
+
version = new_args_format(:suggests, cookbook, version_args)
|
296
|
+
validate_version_constraint(:suggests, cookbook, version)
|
297
|
+
@suggestions[cookbook] = version
|
298
|
+
@suggestions[cookbook]
|
299
|
+
end
|
300
|
+
|
301
|
+
# Adds a conflict for another cookbook, with version checking strings.
|
302
|
+
#
|
303
|
+
# === Parameters
|
304
|
+
# cookbook<String>:: The cookbook
|
305
|
+
# version<String>:: A version constraint of the form "OP VERSION",
|
306
|
+
# where OP is one of < <= = > >= ~> and VERSION has
|
307
|
+
# the form x.y.z or x.y.
|
308
|
+
#
|
309
|
+
# === Returns
|
310
|
+
# versions<Array>:: Returns the list of versions for the platform
|
311
|
+
def conflicts(cookbook, *version_args)
|
312
|
+
version = new_args_format(:conflicts, cookbook, version_args)
|
313
|
+
validate_version_constraint(:conflicts, cookbook, version)
|
314
|
+
@conflicting[cookbook] = version
|
315
|
+
@conflicting[cookbook]
|
316
|
+
end
|
317
|
+
|
318
|
+
# Adds a recipe, definition, or resource provided by this cookbook.
|
319
|
+
#
|
320
|
+
# Recipes are specified as normal
|
321
|
+
# Definitions are followed by (), and can include :params for prototyping
|
322
|
+
# Resources are the stringified version (service[apache2])
|
323
|
+
#
|
324
|
+
# === Parameters
|
325
|
+
# recipe, definition, resource<String>:: The thing we provide
|
326
|
+
# version<String>:: A version constraint of the form "OP VERSION",
|
327
|
+
# where OP is one of < <= = > >= ~> and VERSION has
|
328
|
+
# the form x.y.z or x.y.
|
329
|
+
#
|
330
|
+
# === Returns
|
331
|
+
# versions<Array>:: Returns the list of versions for the platform
|
332
|
+
def provides(cookbook, *version_args)
|
333
|
+
version = new_args_format(:provides, cookbook, version_args)
|
334
|
+
validate_version_constraint(:provides, cookbook, version)
|
335
|
+
@providing[cookbook] = version
|
336
|
+
@providing[cookbook]
|
337
|
+
end
|
338
|
+
|
339
|
+
# Adds a cookbook that is replaced by this one, with version checking strings.
|
340
|
+
#
|
341
|
+
# === Parameters
|
342
|
+
# cookbook<String>:: The cookbook we replace
|
343
|
+
# version<String>:: A version constraint of the form "OP VERSION",
|
344
|
+
# where OP is one of < <= = > >= ~> and VERSION has the form x.y.z or x.y.
|
345
|
+
#
|
346
|
+
# === Returns
|
347
|
+
# versions<Array>:: Returns the list of versions for the platform
|
348
|
+
def replaces(cookbook, *version_args)
|
349
|
+
version = new_args_format(:replaces, cookbook, version_args)
|
350
|
+
validate_version_constraint(:replaces, cookbook, version)
|
351
|
+
@replacing[cookbook] = version
|
352
|
+
@replacing[cookbook]
|
353
|
+
end
|
354
|
+
|
355
|
+
# Adds a description for a recipe.
|
356
|
+
#
|
357
|
+
# === Parameters
|
358
|
+
# recipe<String>:: The recipe
|
359
|
+
# description<String>:: The description of the recipe
|
360
|
+
#
|
361
|
+
# === Returns
|
362
|
+
# description<String>:: Returns the current description
|
363
|
+
def recipe(name, description)
|
364
|
+
@recipes[name] = description
|
365
|
+
end
|
366
|
+
|
367
|
+
# Adds an attribute )hat a user needs to configure for this cookbook. Takes
|
368
|
+
# a name (with the / notation for a nested attribute), followed by any of
|
369
|
+
# these options
|
370
|
+
#
|
371
|
+
# display_name<String>:: What a UI should show for this attribute
|
372
|
+
# description<String>:: A hint as to what this attr is for
|
373
|
+
# choice<Array>:: An array of choices to present to the user.
|
374
|
+
# calculated<Boolean>:: If true, the default value is calculated by the recipe and cannot be displayed.
|
375
|
+
# type<String>:: "string" or "array" - default is "string" ("hash" is supported for backwards compatibility)
|
376
|
+
# required<String>:: Whether this attr is 'required', 'recommended' or 'optional' - default 'optional' (true/false values also supported for backwards compatibility)
|
377
|
+
# recipes<Array>:: An array of recipes which need this attr set.
|
378
|
+
# default<String>,<Array>,<Hash>:: The default value
|
379
|
+
#
|
380
|
+
# === Parameters
|
381
|
+
# name<String>:: The name of the attribute ('foo', or 'apache2/log_dir')
|
382
|
+
# options<Hash>:: The description of the options
|
383
|
+
#
|
384
|
+
# === Returns
|
385
|
+
# options<Hash>:: Returns the current options hash
|
386
|
+
def attribute(name, options)
|
387
|
+
validate(
|
388
|
+
options,
|
389
|
+
{
|
390
|
+
:display_name => { :kind_of => String },
|
391
|
+
:description => { :kind_of => String },
|
392
|
+
:choice => { :kind_of => [ Array ], :default => [] },
|
393
|
+
:calculated => { :equal_to => [ true, false ], :default => false },
|
394
|
+
:type => { :equal_to => [ "string", "array", "hash", "symbol" ], :default => "string" },
|
395
|
+
:required => { :equal_to => [ "required", "recommended", "optional", true, false ], :default => "optional" },
|
396
|
+
:recipes => { :kind_of => [ Array ], :default => [] },
|
397
|
+
:default => { :kind_of => [ String, Array, Hash ] }
|
398
|
+
}
|
399
|
+
)
|
400
|
+
options[:required] = remap_required_attribute(options[:required]) unless options[:required].nil?
|
401
|
+
validate_string_array(options[:choice])
|
402
|
+
validate_calculated_default_rule(options)
|
403
|
+
validate_choice_default_rule(options)
|
404
|
+
|
405
|
+
@attributes[name] = options
|
406
|
+
@attributes[name]
|
407
|
+
end
|
408
|
+
|
409
|
+
def grouping(name, options)
|
410
|
+
validate(
|
411
|
+
options,
|
412
|
+
{
|
413
|
+
:title => { :kind_of => String },
|
414
|
+
:description => { :kind_of => String }
|
415
|
+
}
|
416
|
+
)
|
417
|
+
@groupings[name] = options
|
418
|
+
@groupings[name]
|
419
|
+
end
|
420
|
+
|
421
|
+
def to_hash
|
422
|
+
{
|
423
|
+
NAME => self.name,
|
424
|
+
DESCRIPTION => self.description,
|
425
|
+
LONG_DESCRIPTION => self.long_description,
|
426
|
+
MAINTAINER => self.maintainer,
|
427
|
+
MAINTAINER_EMAIL => self.maintainer_email,
|
428
|
+
LICENSE => self.license,
|
429
|
+
PLATFORMS => self.platforms,
|
430
|
+
DEPENDENCIES => self.dependencies,
|
431
|
+
RECOMMENDATIONS => self.recommendations,
|
432
|
+
SUGGESTIONS => self.suggestions,
|
433
|
+
CONFLICTING => self.conflicting,
|
434
|
+
PROVIDING => self.providing,
|
435
|
+
REPLACING => self.replacing,
|
436
|
+
ATTRIBUTES => self.attributes,
|
437
|
+
GROUPINGS => self.groupings,
|
438
|
+
RECIPES => self.recipes,
|
439
|
+
VERSION => self.version
|
440
|
+
}
|
441
|
+
end
|
442
|
+
|
443
|
+
def to_json(*a)
|
444
|
+
self.to_hash.to_json(*a)
|
445
|
+
end
|
446
|
+
|
447
|
+
def self.from_hash(o)
|
448
|
+
cm = self.new()
|
449
|
+
cm.from_hash(o)
|
450
|
+
cm
|
451
|
+
end
|
452
|
+
|
453
|
+
def from_hash(o)
|
454
|
+
@name = o[NAME] if o.has_key?(NAME)
|
455
|
+
@description = o[DESCRIPTION] if o.has_key?(DESCRIPTION)
|
456
|
+
@long_description = o[LONG_DESCRIPTION] if o.has_key?(LONG_DESCRIPTION)
|
457
|
+
@maintainer = o[MAINTAINER] if o.has_key?(MAINTAINER)
|
458
|
+
@maintainer_email = o[MAINTAINER_EMAIL] if o.has_key?(MAINTAINER_EMAIL)
|
459
|
+
@license = o[LICENSE] if o.has_key?(LICENSE)
|
460
|
+
@platforms = o[PLATFORMS] if o.has_key?(PLATFORMS)
|
461
|
+
@dependencies = handle_deprecated_constraints(o[DEPENDENCIES]) if o.has_key?(DEPENDENCIES)
|
462
|
+
@recommendations = handle_deprecated_constraints(o[RECOMMENDATIONS]) if o.has_key?(RECOMMENDATIONS)
|
463
|
+
@suggestions = handle_deprecated_constraints(o[SUGGESTIONS]) if o.has_key?(SUGGESTIONS)
|
464
|
+
@conflicting = handle_deprecated_constraints(o[CONFLICTING]) if o.has_key?(CONFLICTING)
|
465
|
+
@providing = o[PROVIDING] if o.has_key?(PROVIDING)
|
466
|
+
@replacing = handle_deprecated_constraints(o[REPLACING]) if o.has_key?(REPLACING)
|
467
|
+
@attributes = o[ATTRIBUTES] if o.has_key?(ATTRIBUTES)
|
468
|
+
@groupings = o[GROUPINGS] if o.has_key?(GROUPINGS)
|
469
|
+
@recipes = o[RECIPES] if o.has_key?(RECIPES)
|
470
|
+
@version = o[VERSION] if o.has_key?(VERSION)
|
471
|
+
self
|
472
|
+
end
|
473
|
+
|
474
|
+
def self.from_json(string)
|
475
|
+
o = Chef::JSONCompat.from_json(string)
|
476
|
+
self.from_hash(o)
|
477
|
+
end
|
478
|
+
|
479
|
+
def self.validate_json(json_str)
|
480
|
+
o = Chef::JSONCompat.from_json(json_str)
|
481
|
+
metadata = new()
|
482
|
+
VERSION_CONSTRAINTS.each do |method_name, hash_key|
|
483
|
+
if constraints = o[hash_key]
|
484
|
+
constraints.each do |cb_name, constraints|
|
485
|
+
metadata.send(method_name, cb_name, *Array(constraints))
|
486
|
+
end
|
487
|
+
end
|
488
|
+
end
|
489
|
+
true
|
490
|
+
end
|
491
|
+
|
492
|
+
def from_json(string)
|
493
|
+
o = Chef::JSONCompat.from_json(string)
|
494
|
+
from_hash(o)
|
495
|
+
end
|
496
|
+
|
497
|
+
private
|
498
|
+
|
499
|
+
def new_args_format(caller_name, dep_name, version_constraints)
|
500
|
+
if version_constraints.empty?
|
501
|
+
">= 0.0.0"
|
502
|
+
elsif version_constraints.size == 1
|
503
|
+
version_constraints.first
|
504
|
+
else
|
505
|
+
msg=<<-OBSOLETED
|
506
|
+
The dependency specification syntax you are using is no longer valid. You may not
|
507
|
+
specify more than one version constraint for a particular cookbook.
|
508
|
+
Consult http://wiki.opscode.com/display/chef/Metadata for the updated syntax.
|
509
|
+
|
510
|
+
Called by: #{caller_name} '#{dep_name}', #{version_constraints.map {|vc| vc.inspect}.join(", ")}
|
511
|
+
Called from:
|
512
|
+
#{caller[0...5].map {|line| " " + line}.join("\n")}
|
513
|
+
OBSOLETED
|
514
|
+
raise Exceptions::ObsoleteDependencySyntax, msg
|
515
|
+
end
|
516
|
+
end
|
517
|
+
|
518
|
+
def validate_version_constraint(caller_name, dep_name, constraint_str)
|
519
|
+
Chef::VersionConstraint.new(constraint_str)
|
520
|
+
rescue Chef::Exceptions::InvalidVersionConstraint => e
|
521
|
+
Log.debug(e)
|
522
|
+
|
523
|
+
msg=<<-INVALID
|
524
|
+
The version constraint syntax you are using is not valid. If you recently
|
525
|
+
upgraded to Chef 0.10.0, be aware that you no may longer use "<<" and ">>" for
|
526
|
+
'less than' and 'greater than'; use '<' and '>' instead.
|
527
|
+
Consult http://wiki.opscode.com/display/chef/Metadata for more information.
|
528
|
+
|
529
|
+
Called by: #{caller_name} '#{dep_name}', '#{constraint_str}'
|
530
|
+
Called from:
|
531
|
+
#{caller[0...5].map {|line| " " + line}.join("\n")}
|
532
|
+
INVALID
|
533
|
+
raise Exceptions::InvalidVersionConstraint, msg
|
534
|
+
end
|
535
|
+
# Verify that the given array is an array of strings
|
536
|
+
#
|
537
|
+
# Raise an exception if the members of the array are not Strings
|
538
|
+
#
|
539
|
+
# === Parameters
|
540
|
+
# arry<Array>:: An array to be validated
|
541
|
+
def validate_string_array(arry)
|
542
|
+
if arry.kind_of?(Array)
|
543
|
+
arry.each do |choice|
|
544
|
+
validate( {:choice => choice}, {:choice => {:kind_of => String}} )
|
545
|
+
end
|
546
|
+
end
|
547
|
+
end
|
548
|
+
|
549
|
+
# For backwards compatibility, remap Boolean values to String
|
550
|
+
# true is mapped to "required"
|
551
|
+
# false is mapped to "optional"
|
552
|
+
#
|
553
|
+
# === Parameters
|
554
|
+
# required_attr<String><Boolean>:: The value of options[:required]
|
555
|
+
#
|
556
|
+
# === Returns
|
557
|
+
# required_attr<String>:: "required", "recommended", or "optional"
|
558
|
+
def remap_required_attribute(value)
|
559
|
+
case value
|
560
|
+
when true
|
561
|
+
value = "required"
|
562
|
+
when false
|
563
|
+
value = "optional"
|
564
|
+
end
|
565
|
+
value
|
566
|
+
end
|
567
|
+
|
568
|
+
def validate_calculated_default_rule(options)
|
569
|
+
calculated_conflict = ((options[:default].is_a?(Array) && !options[:default].empty?) ||
|
570
|
+
(options[:default].is_a?(String) && !options[:default] != "")) &&
|
571
|
+
options[:calculated] == true
|
572
|
+
raise ArgumentError, "Default cannot be specified if calculated is true!" if calculated_conflict
|
573
|
+
end
|
574
|
+
|
575
|
+
def validate_choice_default_rule(options)
|
576
|
+
return if !options[:choice].is_a?(Array) || options[:choice].empty?
|
577
|
+
|
578
|
+
if options[:default].is_a?(String) && options[:default] != ""
|
579
|
+
raise ArgumentError, "Default must be one of your choice values!" if options[:choice].index(options[:default]) == nil
|
580
|
+
end
|
581
|
+
|
582
|
+
if options[:default].is_a?(Array) && !options[:default].empty?
|
583
|
+
options[:default].each do |val|
|
584
|
+
raise ArgumentError, "Default values must be a subset of your choice values!" if options[:choice].index(val) == nil
|
585
|
+
end
|
586
|
+
end
|
587
|
+
end
|
588
|
+
|
589
|
+
# This method translates version constraint strings from
|
590
|
+
# cookbooks with the old format.
|
591
|
+
#
|
592
|
+
# Before we began respecting version constraints, we allowed
|
593
|
+
# multiple constraints to be placed on cookbooks, as well as the
|
594
|
+
# << and >> operators, which are now just < and >. For
|
595
|
+
# specifications with more than one constraint, we return an
|
596
|
+
# empty array (otherwise, we're silently abiding only part of
|
597
|
+
# the contract they have specified to us). If there is only one
|
598
|
+
# constraint, we are replacing the old << and >> with the new <
|
599
|
+
# and >.
|
600
|
+
def handle_deprecated_constraints(specification)
|
601
|
+
specification.inject(Mash.new) do |acc, (cb, constraints)|
|
602
|
+
constraints = Array(constraints)
|
603
|
+
acc[cb] = (constraints.empty? || constraints.size > 1) ? [] : constraints.first.gsub(/>>/, '>').gsub(/<</, '<')
|
604
|
+
acc
|
605
|
+
end
|
606
|
+
end
|
607
|
+
|
608
|
+
end
|
609
|
+
|
610
|
+
#== Chef::Cookbook::MinimalMetadata
|
611
|
+
# MinimalMetadata is a duck type of Cookbook::Metadata, used
|
612
|
+
# internally by Chef Server when determining the optimal set of
|
613
|
+
# cookbooks for a node.
|
614
|
+
#
|
615
|
+
# MinimalMetadata objects typically contain only enough information
|
616
|
+
# to solve the cookbook collection for a run list, but not enough to
|
617
|
+
# generate the proper response
|
618
|
+
class MinimalMetadata < Metadata
|
619
|
+
def initialize(name, params)
|
620
|
+
@name = name
|
621
|
+
from_hash(params)
|
622
|
+
end
|
623
|
+
end
|
624
|
+
|
625
|
+
|
626
|
+
end
|
627
|
+
end
|