rmm-chef 0.10.0.rc.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +201 -0
- data/README.rdoc +171 -0
- data/bin/chef-client +26 -0
- data/bin/chef-solo +25 -0
- data/bin/knife +26 -0
- data/bin/shef +34 -0
- 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 +76 -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 +141 -0
- data/distro/common/html/chef-expander-cluster.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-solo.8.html +191 -0
- data/distro/common/html/chef-solr.8.html +163 -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 +239 -0
- data/distro/common/html/knife-cookbook.1.html +373 -0
- data/distro/common/html/knife-data-bag.1.html +234 -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 +270 -0
- data/distro/common/html/knife-recipe.1.html +92 -0
- data/distro/common/html/knife-role.1.html +200 -0
- data/distro/common/html/knife-search.1.html +143 -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 +295 -0
- data/distro/common/html/shef.1.html +283 -0
- data/distro/common/man/man1/knife-bootstrap.1 +189 -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 +137 -0
- data/distro/common/man/man1/knife-cookbook.1 +320 -0
- data/distro/common/man/man1/knife-data-bag.1 +130 -0
- data/distro/common/man/man1/knife-environment.1 +178 -0
- data/distro/common/man/man1/knife-exec.1 +46 -0
- data/distro/common/man/man1/knife-index.1 +29 -0
- data/distro/common/man/man1/knife-node.1 +154 -0
- data/distro/common/man/man1/knife-role.1 +88 -0
- data/distro/common/man/man1/knife-search.1 +61 -0
- data/distro/common/man/man1/knife-ssh.1 +74 -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 +251 -0
- data/distro/common/man/man1/shef.1 +256 -0
- data/distro/common/man/man8/chef-client.8 +84 -0
- data/distro/common/man/man8/chef-expander-cluster.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 +114 -0
- data/distro/common/markdown/README +3 -0
- data/distro/common/markdown/man1/knife-bootstrap.mkd +138 -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 +119 -0
- data/distro/common/markdown/man1/knife-cookbook.mkd +253 -0
- data/distro/common/markdown/man1/knife-data-bag.mkd +117 -0
- data/distro/common/markdown/man1/knife-environment.mkd +151 -0
- data/distro/common/markdown/man1/knife-exec.mkd +37 -0
- data/distro/common/markdown/man1/knife-index.mkd +30 -0
- data/distro/common/markdown/man1/knife-node.mkd +147 -0
- data/distro/common/markdown/man1/knife-role.mkd +85 -0
- data/distro/common/markdown/man1/knife-search.mkd +55 -0
- data/distro/common/markdown/man1/knife-ssh.mkd +62 -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 +189 -0
- data/distro/common/markdown/man1/shef.mkd +189 -0
- data/distro/common/markdown/man8/chef-client.mkd +65 -0
- data/distro/common/markdown/man8/chef-expander-cluster.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 +85 -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 +175 -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 +106 -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/lib/chef.rb +40 -0
- data/lib/chef/api_client.rb +265 -0
- data/lib/chef/application.rb +152 -0
- data/lib/chef/application/agent.rb +18 -0
- data/lib/chef/application/client.rb +280 -0
- data/lib/chef/application/knife.rb +188 -0
- data/lib/chef/application/solo.rb +218 -0
- data/lib/chef/applications.rb +4 -0
- data/lib/chef/certificate.rb +194 -0
- data/lib/chef/checksum.rb +182 -0
- data/lib/chef/checksum_cache.rb +189 -0
- data/lib/chef/client.rb +366 -0
- data/lib/chef/config.rb +244 -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 +173 -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 +629 -0
- data/lib/chef/cookbook/remote_file_vendor.rb +87 -0
- data/lib/chef/cookbook/syntax_check.rb +136 -0
- data/lib/chef/cookbook_loader.rb +103 -0
- data/lib/chef/cookbook_site_streaming_uploader.rb +244 -0
- data/lib/chef/cookbook_uploader.rb +151 -0
- data/lib/chef/cookbook_version.rb +1071 -0
- data/lib/chef/cookbook_version_selector.rb +168 -0
- data/lib/chef/couchdb.rb +246 -0
- data/lib/chef/daemon.rb +172 -0
- data/lib/chef/data_bag.rb +223 -0
- data/lib/chef/data_bag_item.rb +267 -0
- data/lib/chef/encrypted_data_bag_item.rb +126 -0
- data/lib/chef/environment.rb +449 -0
- data/lib/chef/exceptions.rb +153 -0
- data/lib/chef/file_access_control.rb +144 -0
- data/lib/chef/file_cache.rb +218 -0
- data/lib/chef/handler.rb +206 -0
- data/lib/chef/handler/error_report.rb +40 -0
- data/lib/chef/handler/json_file.rb +58 -0
- data/lib/chef/index_queue.rb +29 -0
- data/lib/chef/index_queue/amqp_client.rb +116 -0
- data/lib/chef/index_queue/consumer.rb +76 -0
- data/lib/chef/index_queue/indexable.rb +109 -0
- data/lib/chef/json_compat.rb +52 -0
- data/lib/chef/knife.rb +548 -0
- data/lib/chef/knife/bootstrap.rb +228 -0
- data/lib/chef/knife/bootstrap/archlinux-gems.erb +48 -0
- data/lib/chef/knife/bootstrap/centos5-gems.erb +50 -0
- data/lib/chef/knife/bootstrap/fedora13-gems.erb +39 -0
- data/lib/chef/knife/bootstrap/ubuntu10.04-apt.erb +32 -0
- data/lib/chef/knife/bootstrap/ubuntu10.04-gems.erb +48 -0
- data/lib/chef/knife/client_bulk_delete.rb +43 -0
- data/lib/chef/knife/client_create.rb +73 -0
- data/lib/chef/knife/client_delete.rb +48 -0
- data/lib/chef/knife/client_edit.rb +48 -0
- data/lib/chef/knife/client_list.rb +43 -0
- data/lib/chef/knife/client_reregister.rb +59 -0
- data/lib/chef/knife/client_show.rb +53 -0
- data/lib/chef/knife/configure.rb +149 -0
- data/lib/chef/knife/configure_client.rb +52 -0
- data/lib/chef/knife/cookbook_bulk_delete.rb +72 -0
- data/lib/chef/knife/cookbook_create.rb +274 -0
- data/lib/chef/knife/cookbook_delete.rb +149 -0
- data/lib/chef/knife/cookbook_download.rb +134 -0
- data/lib/chef/knife/cookbook_list.rb +53 -0
- data/lib/chef/knife/cookbook_metadata.rb +107 -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 +70 -0
- data/lib/chef/knife/cookbook_site_install.rb +148 -0
- data/lib/chef/knife/cookbook_site_list.rb +60 -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 +57 -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 +93 -0
- data/lib/chef/knife/cookbook_upload.rb +169 -0
- data/lib/chef/knife/core/cookbook_scm_repo.rb +149 -0
- data/lib/chef/knife/core/generic_presenter.rb +184 -0
- data/lib/chef/knife/core/node_editor.rb +127 -0
- data/lib/chef/knife/core/node_presenter.rb +103 -0
- data/lib/chef/knife/core/object_loader.rb +75 -0
- data/lib/chef/knife/core/subcommand_loader.rb +112 -0
- data/lib/chef/knife/core/text_formatter.rb +100 -0
- data/lib/chef/knife/core/ui.rb +211 -0
- data/lib/chef/knife/data_bag_create.rb +95 -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 +91 -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/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 +50 -0
- data/lib/chef/knife/environment_list.rb +42 -0
- data/lib/chef/knife/environment_show.rb +46 -0
- data/lib/chef/knife/exec.rb +51 -0
- data/lib/chef/knife/help.rb +102 -0
- data/lib/chef/knife/index_rebuild.rb +50 -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 +67 -0
- data/lib/chef/knife/node_run_list_remove.rb +48 -0
- data/lib/chef/knife/node_show.rb +68 -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 +54 -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 +138 -0
- data/lib/chef/knife/ssh.rb +329 -0
- data/lib/chef/knife/status.rb +104 -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/log.rb +39 -0
- data/lib/chef/mash.rb +211 -0
- data/lib/chef/mixin/check_helper.rb +31 -0
- data/lib/chef/mixin/checksum.rb +32 -0
- data/lib/chef/mixin/command.rb +221 -0
- data/lib/chef/mixin/command/unix.rb +215 -0
- data/lib/chef/mixin/command/windows.rb +76 -0
- data/lib/chef/mixin/convert_to_class_name.rb +63 -0
- data/lib/chef/mixin/create_path.rb +56 -0
- data/lib/chef/mixin/deep_merge.rb +225 -0
- data/lib/chef/mixin/deprecation.rb +65 -0
- data/lib/chef/mixin/from_file.rb +50 -0
- data/lib/chef/mixin/language.rb +165 -0
- data/lib/chef/mixin/language_include_attribute.rb +61 -0
- data/lib/chef/mixin/language_include_recipe.rb +52 -0
- data/lib/chef/mixin/params_validate.rb +225 -0
- data/lib/chef/mixin/recipe_definition_dsl_core.rb +78 -0
- data/lib/chef/mixin/shell_out.rb +41 -0
- data/lib/chef/mixin/template.rb +95 -0
- data/lib/chef/mixin/xml_escape.rb +140 -0
- data/lib/chef/mixins.rb +15 -0
- data/lib/chef/monkey_patches/dir.rb +36 -0
- data/lib/chef/monkey_patches/numeric.rb +7 -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 +28 -0
- data/lib/chef/monkey_patches/tempfile.rb +64 -0
- data/lib/chef/nil_argument.rb +3 -0
- data/lib/chef/node.rb +677 -0
- data/lib/chef/node/attribute.rb +487 -0
- data/lib/chef/openid_registration.rb +187 -0
- data/lib/chef/platform.rb +409 -0
- data/lib/chef/provider.rb +124 -0
- data/lib/chef/provider/breakpoint.rb +36 -0
- data/lib/chef/provider/cookbook_file.rb +100 -0
- data/lib/chef/provider/cron.rb +186 -0
- data/lib/chef/provider/cron/solaris.rb +195 -0
- data/lib/chef/provider/deploy.rb +343 -0
- data/lib/chef/provider/deploy/revision.rb +80 -0
- data/lib/chef/provider/deploy/timestamped.rb +33 -0
- data/lib/chef/provider/directory.rb +72 -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 +101 -0
- data/lib/chef/provider/execute.rb +65 -0
- data/lib/chef/provider/file.rb +222 -0
- data/lib/chef/provider/git.rb +230 -0
- data/lib/chef/provider/group.rb +133 -0
- data/lib/chef/provider/group/aix.rb +70 -0
- data/lib/chef/provider/group/dscl.rb +121 -0
- data/lib/chef/provider/group/gpasswd.rb +53 -0
- data/lib/chef/provider/group/groupadd.rb +81 -0
- data/lib/chef/provider/group/pw.rb +84 -0
- data/lib/chef/provider/group/usermod.rb +57 -0
- data/lib/chef/provider/group/windows.rb +79 -0
- data/lib/chef/provider/http_request.rb +122 -0
- data/lib/chef/provider/ifconfig.rb +134 -0
- data/lib/chef/provider/link.rb +164 -0
- data/lib/chef/provider/log.rb +54 -0
- data/lib/chef/provider/mdadm.rb +91 -0
- data/lib/chef/provider/mount.rb +114 -0
- data/lib/chef/provider/mount/mount.rb +232 -0
- data/lib/chef/provider/mount/windows.rb +81 -0
- data/lib/chef/provider/ohai.rb +42 -0
- data/lib/chef/provider/package.rb +164 -0
- data/lib/chef/provider/package/apt.rb +110 -0
- data/lib/chef/provider/package/dpkg.rb +112 -0
- data/lib/chef/provider/package/easy_install.rb +136 -0
- data/lib/chef/provider/package/freebsd.rb +122 -0
- data/lib/chef/provider/package/macports.rb +105 -0
- data/lib/chef/provider/package/pacman.rb +101 -0
- data/lib/chef/provider/package/portage.rb +135 -0
- data/lib/chef/provider/package/rpm.rb +101 -0
- data/lib/chef/provider/package/rubygems.rb +462 -0
- data/lib/chef/provider/package/solaris.rb +127 -0
- data/lib/chef/provider/package/yum-dump.py +128 -0
- data/lib/chef/provider/package/yum.rb +261 -0
- data/lib/chef/provider/package/zypper.rb +127 -0
- data/lib/chef/provider/remote_directory.rb +139 -0
- data/lib/chef/provider/remote_file.rb +118 -0
- data/lib/chef/provider/route.rb +193 -0
- data/lib/chef/provider/ruby_block.rb +34 -0
- data/lib/chef/provider/script.rb +55 -0
- data/lib/chef/provider/service.rb +122 -0
- data/lib/chef/provider/service/arch.rb +109 -0
- data/lib/chef/provider/service/debian.rb +130 -0
- data/lib/chef/provider/service/freebsd.rb +154 -0
- data/lib/chef/provider/service/gentoo.rb +53 -0
- data/lib/chef/provider/service/init.rb +71 -0
- data/lib/chef/provider/service/insserv.rb +52 -0
- data/lib/chef/provider/service/redhat.rb +60 -0
- data/lib/chef/provider/service/simple.rb +120 -0
- data/lib/chef/provider/service/solaris.rb +85 -0
- data/lib/chef/provider/service/upstart.rb +192 -0
- data/lib/chef/provider/service/windows.rb +146 -0
- data/lib/chef/provider/subversion.rb +197 -0
- data/lib/chef/provider/template.rb +104 -0
- data/lib/chef/provider/user.rb +186 -0
- data/lib/chef/provider/user/dscl.rb +280 -0
- data/lib/chef/provider/user/pw.rb +113 -0
- data/lib/chef/provider/user/useradd.rb +137 -0
- data/lib/chef/provider/user/windows.rb +124 -0
- data/lib/chef/providers.rb +93 -0
- data/lib/chef/recipe.rb +128 -0
- data/lib/chef/resource.rb +554 -0
- data/lib/chef/resource/apt_package.rb +34 -0
- data/lib/chef/resource/bash.rb +33 -0
- data/lib/chef/resource/breakpoint.rb +35 -0
- data/lib/chef/resource/cookbook_file.rb +45 -0
- data/lib/chef/resource/cron.rb +188 -0
- data/lib/chef/resource/csh.rb +33 -0
- data/lib/chef/resource/deploy.rb +371 -0
- data/lib/chef/resource/deploy_revision.rb +40 -0
- data/lib/chef/resource/directory.rb +76 -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 +58 -0
- data/lib/chef/resource/erl_call.rb +83 -0
- data/lib/chef/resource/execute.rb +127 -0
- data/lib/chef/resource/file.rb +99 -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 +37 -0
- data/lib/chef/resource/group.rb +70 -0
- data/lib/chef/resource/http_request.rb +61 -0
- data/lib/chef/resource/ifconfig.rb +134 -0
- data/lib/chef/resource/link.rb +78 -0
- data/lib/chef/resource/log.rb +62 -0
- data/lib/chef/resource/macports_package.rb +29 -0
- data/lib/chef/resource/mdadm.rb +82 -0
- data/lib/chef/resource/mount.rb +135 -0
- data/lib/chef/resource/ohai.rb +40 -0
- data/lib/chef/resource/package.rb +80 -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/remote_directory.rb +109 -0
- data/lib/chef/resource/remote_file.rb +83 -0
- data/lib/chef/resource/route.rb +135 -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 +40 -0
- data/lib/chef/resource/scm.rb +147 -0
- data/lib/chef/resource/script.rb +60 -0
- data/lib/chef/resource/service.rb +160 -0
- data/lib/chef/resource/solaris_package.rb +36 -0
- data/lib/chef/resource/subversion.rb +36 -0
- data/lib/chef/resource/template.rb +69 -0
- data/lib/chef/resource/timestamped_deploy.rb +31 -0
- data/lib/chef/resource/user.rb +130 -0
- data/lib/chef/resource/yum_package.rb +43 -0
- data/lib/chef/resource_collection.rb +217 -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/resources.rb +64 -0
- data/lib/chef/rest.rb +392 -0
- data/lib/chef/rest/auth_credentials.rb +71 -0
- data/lib/chef/rest/cookie_jar.rb +31 -0
- data/lib/chef/rest/rest_request.rb +213 -0
- data/lib/chef/role.rb +342 -0
- data/lib/chef/run_context.rb +126 -0
- data/lib/chef/run_list.rb +165 -0
- data/lib/chef/run_list/run_list_expansion.rb +193 -0
- data/lib/chef/run_list/run_list_item.rb +92 -0
- data/lib/chef/run_list/versioned_recipe_list.rb +68 -0
- data/lib/chef/run_status.rb +121 -0
- data/lib/chef/runner.rb +92 -0
- data/lib/chef/sandbox.rb +153 -0
- data/lib/chef/search/query.rb +65 -0
- data/lib/chef/shef.rb +327 -0
- data/lib/chef/shef/ext.rb +569 -0
- data/lib/chef/shef/model_wrapper.rb +120 -0
- data/lib/chef/shef/shef_rest.rb +28 -0
- data/lib/chef/shef/shef_session.rb +284 -0
- data/lib/chef/shell_out.rb +250 -0
- data/lib/chef/shell_out/unix.rb +223 -0
- data/lib/chef/shell_out/windows.rb +98 -0
- data/lib/chef/solr_query.rb +187 -0
- data/lib/chef/solr_query/lucene.treetop +150 -0
- data/lib/chef/solr_query/lucene_nodes.rb +285 -0
- data/lib/chef/solr_query/query_transform.rb +65 -0
- data/lib/chef/solr_query/solr_http_request.rb +118 -0
- data/lib/chef/streaming_cookbook_uploader.rb +201 -0
- data/lib/chef/tasks/chef_repo.rake +330 -0
- data/lib/chef/util/file_edit.rb +122 -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/webui_user.rb +231 -0
- metadata +759 -0
data/lib/chef/config.rb
ADDED
@@ -0,0 +1,244 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Adam Jacob (<adam@opscode.com>)
|
3
|
+
# Author:: Christopher Brown (<cb@opscode.com>)
|
4
|
+
# Author:: AJ Christensen (<aj@opscode.com>)
|
5
|
+
# Copyright:: Copyright (c) 2008 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
|
+
require 'chef/log'
|
21
|
+
require 'mixlib/config'
|
22
|
+
|
23
|
+
class Chef
|
24
|
+
class Config
|
25
|
+
|
26
|
+
extend Mixlib::Config
|
27
|
+
|
28
|
+
# Manages the chef secret session key
|
29
|
+
# === Returns
|
30
|
+
# <newkey>:: A new or retrieved session key
|
31
|
+
#
|
32
|
+
def self.manage_secret_key
|
33
|
+
newkey = nil
|
34
|
+
if Chef::FileCache.has_key?("chef_server_cookie_id")
|
35
|
+
newkey = Chef::FileCache.load("chef_server_cookie_id")
|
36
|
+
else
|
37
|
+
chars = ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a
|
38
|
+
newkey = ""
|
39
|
+
40.times { |i| newkey << chars[rand(chars.size-1)] }
|
40
|
+
Chef::FileCache.store("chef_server_cookie_id", newkey)
|
41
|
+
end
|
42
|
+
newkey
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.inspect
|
46
|
+
configuration.inspect
|
47
|
+
end
|
48
|
+
|
49
|
+
# Override the config dispatch to set the value of multiple server options simultaneously
|
50
|
+
#
|
51
|
+
# === Parameters
|
52
|
+
# url<String>:: String to be set for all of the chef-server-api URL's
|
53
|
+
#
|
54
|
+
config_attr_writer :chef_server_url do |url|
|
55
|
+
configure do |c|
|
56
|
+
[ :registration_url,
|
57
|
+
:template_url,
|
58
|
+
:remotefile_url,
|
59
|
+
:search_url,
|
60
|
+
:chef_server_url,
|
61
|
+
:role_url ].each do |u|
|
62
|
+
c[u] = url
|
63
|
+
end
|
64
|
+
end
|
65
|
+
url
|
66
|
+
end
|
67
|
+
|
68
|
+
# When you are using ActiveSupport, they monkey-patch 'daemonize' into Kernel.
|
69
|
+
# So while this is basically identical to what method_missing would do, we pull
|
70
|
+
# it up here and get a real method written so that things get dispatched
|
71
|
+
# properly.
|
72
|
+
config_attr_writer :daemonize do |v|
|
73
|
+
configure do |c|
|
74
|
+
c[:daemonize] = v
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
# Override the config dispatch to set the value of log_location configuration option
|
79
|
+
#
|
80
|
+
# === Parameters
|
81
|
+
# location<IO||String>:: Logging location as either an IO stream or string representing log file path
|
82
|
+
#
|
83
|
+
config_attr_writer :log_location do |location|
|
84
|
+
if location.respond_to? :sync=
|
85
|
+
location.sync = true
|
86
|
+
location
|
87
|
+
elsif location.respond_to? :to_str
|
88
|
+
f = File.new(location.to_str, "a")
|
89
|
+
f.sync = true
|
90
|
+
f
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
# Override the config dispatch to set the value of authorized_openid_providers when openid_providers (deprecated) is used
|
95
|
+
#
|
96
|
+
# === Parameters
|
97
|
+
# providers<Array>:: An array of openid providers that are authorized to login to the chef server
|
98
|
+
#
|
99
|
+
config_attr_writer :openid_providers do |providers|
|
100
|
+
configure { |c| c[:authorized_openid_providers] = providers }
|
101
|
+
providers
|
102
|
+
end
|
103
|
+
|
104
|
+
# Turn on "path sanity" by default. See also: http://wiki.opscode.com/display/chef/User+Environment+PATH+Sanity
|
105
|
+
enforce_path_sanity(true)
|
106
|
+
|
107
|
+
# Used when OpenID authentication is enabled in the Web UI
|
108
|
+
authorized_openid_identifiers nil
|
109
|
+
authorized_openid_providers nil
|
110
|
+
openid_cstore_couchdb false
|
111
|
+
openid_cstore_path "/var/chef/openid/cstore"
|
112
|
+
|
113
|
+
# The number of times the client should retry when registering with the server
|
114
|
+
client_registration_retries 5
|
115
|
+
|
116
|
+
# Where the cookbooks are located. Meaning is somewhat context dependent between
|
117
|
+
# knife, chef-client, and chef-solo.
|
118
|
+
cookbook_path [ "/var/chef/cookbooks", "/var/chef/site-cookbooks" ]
|
119
|
+
|
120
|
+
# Where files are stored temporarily during uploads
|
121
|
+
sandbox_path "/var/chef/sandboxes"
|
122
|
+
|
123
|
+
# Where cookbook files are stored on the server (by content checksum)
|
124
|
+
checksum_path "/var/chef/checksums"
|
125
|
+
|
126
|
+
# CouchDB database name to use
|
127
|
+
couchdb_database "chef"
|
128
|
+
|
129
|
+
couchdb_url "http://localhost:5984"
|
130
|
+
|
131
|
+
# Where chef's cache files should be stored
|
132
|
+
file_cache_path "/var/chef/cache"
|
133
|
+
|
134
|
+
# Where backups of chef-managed files should go
|
135
|
+
file_backup_path "/var/chef/backup"
|
136
|
+
|
137
|
+
## Daemonization Settings ##
|
138
|
+
# What user should Chef run as?
|
139
|
+
user nil
|
140
|
+
# What group should the chef-server, -solr, -solr-indexer run as
|
141
|
+
group nil
|
142
|
+
umask 0022
|
143
|
+
|
144
|
+
http_retry_count 5
|
145
|
+
http_retry_delay 5
|
146
|
+
interval nil
|
147
|
+
json_attribs nil
|
148
|
+
log_level :info
|
149
|
+
log_location STDOUT
|
150
|
+
verbose_logging nil
|
151
|
+
node_name nil
|
152
|
+
node_path "/var/chef/node"
|
153
|
+
|
154
|
+
pid_file nil
|
155
|
+
|
156
|
+
chef_server_url "http://localhost:4000"
|
157
|
+
registration_url "http://localhost:4000"
|
158
|
+
template_url "http://localhost:4000"
|
159
|
+
role_url "http://localhost:4000"
|
160
|
+
remotefile_url "http://localhost:4000"
|
161
|
+
search_url "http://localhost:4000"
|
162
|
+
|
163
|
+
client_url "http://localhost:4042"
|
164
|
+
|
165
|
+
rest_timeout 300
|
166
|
+
run_command_stderr_timeout 120
|
167
|
+
run_command_stdout_timeout 120
|
168
|
+
solo false
|
169
|
+
splay nil
|
170
|
+
|
171
|
+
# Set these to enable SSL authentication / mutual-authentication
|
172
|
+
# with the server
|
173
|
+
ssl_client_cert nil
|
174
|
+
ssl_client_key nil
|
175
|
+
ssl_verify_mode :verify_none
|
176
|
+
ssl_ca_path nil
|
177
|
+
ssl_ca_file nil
|
178
|
+
|
179
|
+
|
180
|
+
# Where should chef-solo look for role files?
|
181
|
+
role_path "/var/chef/roles"
|
182
|
+
|
183
|
+
# Where should chef-solo download recipes from?
|
184
|
+
recipe_url nil
|
185
|
+
|
186
|
+
solr_url "http://localhost:8983"
|
187
|
+
solr_jetty_path "/var/chef/solr-jetty"
|
188
|
+
solr_data_path "/var/chef/solr/data"
|
189
|
+
solr_home_path "/var/chef/solr"
|
190
|
+
solr_heap_size "256M"
|
191
|
+
solr_java_opts nil
|
192
|
+
|
193
|
+
# Parameters for connecting to RabbitMQ
|
194
|
+
amqp_host '0.0.0.0'
|
195
|
+
amqp_port '5672'
|
196
|
+
amqp_user 'chef'
|
197
|
+
amqp_pass 'testing'
|
198
|
+
amqp_vhost '/chef'
|
199
|
+
# Setting this to a UUID string also makes the queue durable
|
200
|
+
# (persist across rabbitmq restarts)
|
201
|
+
amqp_consumer_id "default"
|
202
|
+
|
203
|
+
client_key "/etc/chef/client.pem"
|
204
|
+
validation_key "/etc/chef/validation.pem"
|
205
|
+
validation_client_name "chef-validator"
|
206
|
+
web_ui_client_name "chef-webui"
|
207
|
+
web_ui_key "/etc/chef/webui.pem"
|
208
|
+
web_ui_admin_user_name "admin"
|
209
|
+
web_ui_admin_default_password "p@ssw0rd1"
|
210
|
+
|
211
|
+
# Server Signing CA
|
212
|
+
#
|
213
|
+
# In truth, these don't even have to change
|
214
|
+
signing_ca_cert "/var/chef/ca/cert.pem"
|
215
|
+
signing_ca_key "/var/chef/ca/key.pem"
|
216
|
+
signing_ca_user nil
|
217
|
+
signing_ca_group nil
|
218
|
+
signing_ca_country "US"
|
219
|
+
signing_ca_state "Washington"
|
220
|
+
signing_ca_location "Seattle"
|
221
|
+
signing_ca_org "Chef User"
|
222
|
+
signing_ca_domain "opensource.opscode.com"
|
223
|
+
signing_ca_email "opensource-cert@opscode.com"
|
224
|
+
|
225
|
+
# Report Handlers
|
226
|
+
report_handlers []
|
227
|
+
|
228
|
+
# Exception Handlers
|
229
|
+
exception_handlers []
|
230
|
+
|
231
|
+
# Checksum Cache
|
232
|
+
# Uses Moneta on the back-end
|
233
|
+
cache_type "BasicFile"
|
234
|
+
cache_options({ :path => "/var/chef/cache/checksums", :skip_expires => true })
|
235
|
+
|
236
|
+
# Arbitrary knife configuration data
|
237
|
+
knife Hash.new
|
238
|
+
|
239
|
+
# Those lists of regular expressions define what chef considers a
|
240
|
+
# valid user and group name
|
241
|
+
user_valid_regex [ /^([-a-zA-Z0-9_.]+)$/, /^\d+$/ ]
|
242
|
+
group_valid_regex [ /^([-a-zA-Z0-9_.\\ ]+)$/, /^\d+$/ ]
|
243
|
+
end
|
244
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
#--
|
2
|
+
# Author:: Daniel DeLeo (<dan@opscode.com>)
|
3
|
+
# Copyright:: Copyright (c) 2011 Opscode, Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
class Chef
|
20
|
+
class Cookbook
|
21
|
+
class Chefignore
|
22
|
+
|
23
|
+
COMMENTS_AND_WHITESPACE = /^\w*(?:#.*)?$/
|
24
|
+
|
25
|
+
attr_reader :ignores
|
26
|
+
|
27
|
+
def initialize(ignore_file_or_repo)
|
28
|
+
@ignore_file = find_ignore_file(ignore_file_or_repo)
|
29
|
+
@ignores = parse_ignore_file
|
30
|
+
end
|
31
|
+
|
32
|
+
def remove_ignores_from(file_list)
|
33
|
+
Array(file_list).inject([]) do |unignored, file|
|
34
|
+
ignored?(file) ? unignored : unignored << file
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def ignored?(file_name)
|
39
|
+
@ignores.any? {|glob| File.fnmatch?(glob, file_name)}
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def parse_ignore_file
|
45
|
+
ignore_globs = []
|
46
|
+
if File.exist?(@ignore_file) && File.readable?(@ignore_file)
|
47
|
+
File.foreach(@ignore_file) do |line|
|
48
|
+
ignore_globs << line.strip unless line =~ COMMENTS_AND_WHITESPACE
|
49
|
+
end
|
50
|
+
else
|
51
|
+
Chef::Log.debug("No chefignore file found at #@ignore_file no files will be ignored")
|
52
|
+
end
|
53
|
+
ignore_globs
|
54
|
+
end
|
55
|
+
|
56
|
+
def find_ignore_file(path)
|
57
|
+
if File.basename(path) =~ /chefignore/
|
58
|
+
path
|
59
|
+
else
|
60
|
+
File.join(path, 'chefignore')
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
@@ -0,0 +1,45 @@
|
|
1
|
+
#--
|
2
|
+
# Author:: Tim Hinderliter (<tim@opscode.com>)
|
3
|
+
# Author:: Christopher Walters (<cw@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/mash'
|
21
|
+
|
22
|
+
class Chef
|
23
|
+
# == Chef::CookbookCollection
|
24
|
+
# This class is the consistent interface for a node to obtain its
|
25
|
+
# cookbooks by name.
|
26
|
+
#
|
27
|
+
# This class is basically a glorified Hash, but since there are
|
28
|
+
# several ways this cookbook information is collected,
|
29
|
+
# (e.g. CookbookLoader for solo, hash of auto-vivified Cookbook
|
30
|
+
# objects for lazily-loaded remote cookbooks), it gets transformed
|
31
|
+
# into this.
|
32
|
+
class CookbookCollection < Mash
|
33
|
+
|
34
|
+
# The input is a mapping of cookbook name to CookbookVersion objects. We
|
35
|
+
# simply extract them
|
36
|
+
def initialize(cookbook_versions={})
|
37
|
+
super() do |hash, key|
|
38
|
+
raise Chef::Exceptions::CookbookNotFound, "Cookbook #{key} not found. " <<
|
39
|
+
"If you're loading #{key} from another cookbook, make sure you configure the dependency in your metadata"
|
40
|
+
end
|
41
|
+
cookbook_versions.each{ |cookbook_name, cookbook_version| self[cookbook_name] = cookbook_version }
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,173 @@
|
|
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.inject(true) do |all_empty, files|
|
108
|
+
all_empty && files.last.empty?
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def merge!(other_cookbook_loader)
|
113
|
+
other_cookbook_settings = other_cookbook_loader.cookbook_settings
|
114
|
+
@cookbook_settings.each do |file_type, file_list|
|
115
|
+
file_list.merge!(other_cookbook_settings[file_type])
|
116
|
+
end
|
117
|
+
@metadata_filenames.concat(other_cookbook_loader.metadata_filenames)
|
118
|
+
end
|
119
|
+
|
120
|
+
def chefignore
|
121
|
+
@chefignore ||= Chefignore.new(File.basename(@cookbook_path))
|
122
|
+
end
|
123
|
+
|
124
|
+
def load_root_files
|
125
|
+
Dir.glob(File.join(@cookbook_path, '*'), File::FNM_DOTMATCH).each do |file|
|
126
|
+
next if File.directory?(file)
|
127
|
+
@cookbook_settings[:root_filenames][file[@relative_path, 1]] = file
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def load_recursively_as(category, category_dir, glob)
|
132
|
+
file_spec = File.join(@cookbook_path, category_dir, '**', glob)
|
133
|
+
Dir.glob(file_spec, File::FNM_DOTMATCH).each do |file|
|
134
|
+
next if File.directory?(file)
|
135
|
+
@cookbook_settings[category][file[@relative_path, 1]] = file
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
def load_as(category, *path_glob)
|
140
|
+
Dir[File.join(@cookbook_path, *path_glob)].each do |file|
|
141
|
+
@cookbook_settings[category][file[@relative_path, 1]] = file
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
def remove_ignored_files
|
146
|
+
@cookbook_settings.each_value do |file_list|
|
147
|
+
file_list.reject! do |relative_path, full_path|
|
148
|
+
chefignore.ignored?(relative_path)
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
def apply_ruby_metadata(file)
|
154
|
+
begin
|
155
|
+
@metadata.from_file(file)
|
156
|
+
rescue JSON::ParserError
|
157
|
+
Chef::Log.error("Error evaluating metadata.rb for #@cookbook_name in " + file)
|
158
|
+
raise
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
def apply_json_metadata(file)
|
163
|
+
begin
|
164
|
+
@metadata.from_json(IO.read(file))
|
165
|
+
rescue JSON::ParserError
|
166
|
+
Chef::Log.error("Couldn't parse cookbook metadata JSON for #@cookbook_name in " + file)
|
167
|
+
raise
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|