├── chef-server ├── spec │ ├── spec.opts │ └── spec_helper.rb ├── app │ ├── controllers │ │ └── application.rb │ ├── helpers │ │ └── global_helpers.rb │ └── views │ │ └── layout │ │ └── application.html.erb ├── public │ ├── javascripts │ │ └── application.js │ ├── favicon.ico │ ├── images │ │ └── merb.jpg │ ├── robots.txt │ ├── .htaccess │ └── merb.fcgi ├── lib │ ├── views │ │ └── exceptions │ │ │ └── bad_request.html.haml │ └── tasks │ │ ├── uninstall.rake │ │ ├── install.rake │ │ └── package.rake ├── contrib │ └── el │ │ ├── chef-indexer.config │ │ └── chef-server.config ├── config │ ├── environments │ │ ├── production.rb │ │ ├── staging.rb │ │ ├── rake.rb │ │ ├── test.rb │ │ └── development.rb │ ├── dependencies.rb │ ├── rack.rb │ └── init.rb ├── config.ru ├── tasks │ └── merb.thor │ │ ├── utils.rb │ │ └── app_script.rb └── bin │ └── chef-indexer ├── chef ├── spec │ ├── data │ │ ├── fileedit │ │ │ ├── blank │ │ │ └── hosts │ │ ├── bad-config.rb │ │ ├── cookbooks │ │ │ ├── openldap │ │ │ │ ├── files │ │ │ │ │ └── default │ │ │ │ │ │ ├── .ssh │ │ │ │ │ │ └── id_rsa │ │ │ │ │ │ └── .dotfile │ │ │ │ ├── attributes │ │ │ │ │ ├── smokey.rb │ │ │ │ │ └── default.rb │ │ │ │ ├── templates │ │ │ │ │ └── default │ │ │ │ │ │ └── test.erb │ │ │ │ ├── recipes │ │ │ │ │ ├── default.rb │ │ │ │ │ ├── gigantor.rb │ │ │ │ │ └── one.rb │ │ │ │ ├── definitions │ │ │ │ │ ├── client.rb │ │ │ │ │ └── server.rb │ │ │ │ └── ignore │ │ │ └── apache2 │ │ │ │ └── recipes │ │ │ │ └── default.rb │ │ ├── compile │ │ │ ├── cookbooks │ │ │ │ └── test │ │ │ │ │ ├── attributes │ │ │ │ │ └── george.rb │ │ │ │ │ ├── recipes │ │ │ │ │ ├── default.rb │ │ │ │ │ ├── one.rb │ │ │ │ │ └── two.rb │ │ │ │ │ └── definitions │ │ │ │ │ └── new_cat.rb │ │ │ └── nodes │ │ │ │ └── compile.rb │ │ ├── kitchen │ │ │ └── openldap │ │ │ │ ├── attributes │ │ │ │ ├── robinson.rb │ │ │ │ └── default.rb │ │ │ │ ├── definitions │ │ │ │ ├── client.rb │ │ │ │ └── drewbarrymore.rb │ │ │ │ └── recipes │ │ │ │ ├── woot.rb │ │ │ │ ├── ignoreme.rb │ │ │ │ └── gigantor.rb │ │ ├── seattle.txt │ │ ├── config.rb │ │ ├── definitions │ │ │ └── test.rb │ │ ├── recipes │ │ │ └── test.rb │ │ └── nodes │ │ │ ├── test.rb │ │ │ ├── default.rb │ │ │ └── test.example.com.rb │ ├── unit │ │ ├── application │ │ │ ├── agent_spec.rb │ │ │ └── server_spec.rb │ │ ├── log_spec.rb │ │ ├── chef_spec.rb │ │ └── resource │ │ │ ├── csh_spec.rb │ │ │ ├── bash_spec.rb │ │ │ ├── perl_spec.rb │ │ │ ├── ruby_spec.rb │ │ │ ├── python_spec.rb │ │ │ ├── apt_package_spec.rb │ │ │ ├── dpkg_package_spec.rb │ │ │ ├── portage_package_spec.rb │ │ │ └── macports_package_spec.rb │ ├── spec.opts │ ├── rcov.opts │ ├── lib │ │ └── chef │ │ │ ├── provider │ │ │ ├── easy.rb │ │ │ └── snakeoil.rb │ │ │ └── resource │ │ │ ├── cat.rb │ │ │ ├── zen_master.rb │ │ │ └── one_two_three_four.rb │ └── spec_helper.rb ├── docs │ └── design │ │ └── HighLevel.graffle ├── lib │ ├── chef │ │ ├── provider │ │ │ ├── ruby_block.rb │ │ │ └── script.rb │ │ ├── resource │ │ │ ├── ruby_block.rb │ │ │ ├── bash.rb │ │ │ ├── csh.rb │ │ │ ├── perl.rb │ │ │ ├── python.rb │ │ │ ├── ruby.rb │ │ │ ├── macports_package.rb │ │ │ ├── portage_package.rb │ │ │ ├── apt_package.rb │ │ │ ├── dpkg_package.rb │ │ │ ├── gem_package.rb │ │ │ └── script.rb │ │ ├── application │ │ │ ├── agent.rb │ │ │ └── server.rb │ │ ├── mixin │ │ │ ├── checksum.rb │ │ │ ├── check_helper.rb │ │ │ ├── deep_merge.rb │ │ │ └── from_file.rb │ │ ├── log.rb │ │ ├── provider.rb │ │ └── exceptions.rb │ └── chef.rb ├── contrib │ └── el │ │ └── chef-client.config ├── History.txt ├── config │ └── server.rb ├── examples │ └── user_index.rb ├── bin │ ├── chef-client │ └── chef-solo └── tasks │ └── rspec.rb ├── features ├── data │ ├── cookbooks │ │ ├── packages │ │ │ └── recipes │ │ │ │ ├── default.rb │ │ │ │ ├── macports_purge_yydecode.rb │ │ │ │ ├── macports_remove_yydecode.rb │ │ │ │ ├── macports_install_bad_package.rb │ │ │ │ ├── macports_install_yydecode.rb │ │ │ │ └── macports_upgrade_yydecode.rb │ │ ├── synchronize_deps │ │ │ ├── metadata.rb │ │ │ ├── metadata.json │ │ │ └── recipes │ │ │ │ └── default.rb │ │ ├── transfer_remote_files │ │ │ ├── metadata.rb │ │ │ ├── files │ │ │ │ └── default │ │ │ │ │ └── transfer_a_file_from_a_cookbook.txt │ │ │ ├── recipes │ │ │ │ ├── default.rb │ │ │ │ ├── transfer_a_file_from_a_specific_cookbook.rb │ │ │ │ ├── should_prefer_the_file_for_this_specific_host.rb │ │ │ │ ├── transfer_a_file_from_a_cookbook.rb │ │ │ │ ├── transfer_a_non-existent_file_from_a_cookbook.rb │ │ │ │ └── change_remote_file_perms_trickery.rb │ │ │ └── metadata.json │ │ ├── transfer_remote_files_definition │ │ │ ├── files │ │ │ │ └── default │ │ │ │ │ └── easy.txt │ │ │ └── definitions │ │ │ │ └── transfer.rb │ │ ├── search │ │ │ ├── attributes │ │ │ │ └── search_attrs.rb │ │ │ └── recipes │ │ │ │ ├── default.rb │ │ │ │ └── search_data.rb │ │ ├── recipe_include │ │ │ ├── README.rdoc │ │ │ ├── metadata.rb │ │ │ └── recipes │ │ │ │ ├── default.rb │ │ │ │ └── second.rb │ │ ├── execute_commands │ │ │ ├── metadata.rb │ │ │ └── recipes │ │ │ │ ├── default.rb │ │ │ │ ├── umask.rb │ │ │ │ ├── debug.rb │ │ │ │ └── 4k.rb │ │ ├── metadata │ │ │ ├── metadata.rb │ │ │ └── recipes │ │ │ │ └── default.rb │ │ ├── roles │ │ │ └── recipes │ │ │ │ └── default.rb │ │ ├── manage_files │ │ │ └── recipes │ │ │ │ ├── default.rb │ │ │ │ ├── touch_a_file.rb │ │ │ │ ├── create_a_file.rb │ │ │ │ ├── delete_a_file_that_does_not_already_exist.rb │ │ │ │ ├── set_the_owner_of_a_created_file.rb │ │ │ │ └── delete_a_file.rb │ │ ├── run_interval │ │ │ └── recipes │ │ │ │ └── default.rb │ │ ├── synchronize │ │ │ └── recipes │ │ │ │ └── default.rb │ │ ├── directory_provider │ │ │ └── recipes │ │ │ │ ├── default.rb │ │ │ │ ├── delete_nonexistent.rb │ │ │ │ ├── create.rb │ │ │ │ ├── delete.rb │ │ │ │ └── set_the_accessibility_of_a_created_directory.rb │ │ ├── delayed_notifications │ │ │ └── recipes │ │ │ │ ├── default.rb │ │ │ │ ├── notify_a_resource_from_a_single_source.rb │ │ │ │ ├── notify_a_resource_from_multiple_sources.rb │ │ │ │ └── notify_different_resources_for_different_actions.rb │ │ └── integration_setup │ │ │ ├── recipes │ │ │ └── default.rb │ │ │ └── attributes │ │ │ └── integration.rb │ ├── roles │ │ ├── role_test.rb │ │ └── role_test.json │ ├── config │ │ ├── client.rb │ │ └── server.rb │ └── Rakefile ├── support │ └── packages.rb ├── steps │ ├── result_steps.rb │ ├── packages.rb │ ├── request_steps.rb │ ├── webrat_steps.rb │ ├── recipe_steps.rb │ ├── couchdb_steps.rb │ └── node_steps.rb ├── chef-client │ ├── roles.feature │ ├── run_interval.feature │ └── cookbook_sync.feature ├── search │ └── search_data.feature ├── language │ ├── recipe_inclusion.feature │ └── delayed_notifications.feature ├── provider │ ├── directory │ │ ├── delete_directories.feature │ │ └── create_directories.feature │ └── package │ │ └── macports.feature ├── api │ ├── nodes │ │ ├── show_node_api.feature │ │ ├── delete_node_api.feature │ │ ├── create_node_api.feature │ │ ├── update_node_api.feature │ │ └── list_nodes_api.feature │ └── roles │ │ ├── delete_role_api.feature │ │ ├── show_roles_api.feature │ │ ├── create_role_api.feature │ │ ├── update_roles_api.feature │ │ └── list_roles_api.feature └── cookbooks │ └── metadata.feature ├── chef-server-slice ├── app │ ├── helpers │ │ ├── roles_helper.rb │ │ ├── exceptions_helper.rb │ │ ├── openid_server_helper.rb │ │ ├── search_entries_helper.rb │ │ ├── cookbook_attributes_helper.rb │ │ ├── cookbook_files_helper.rb │ │ ├── cookbook_libraries_helper.rb │ │ ├── openid_consumer_helper.rb │ │ ├── openid_register_helper.rb │ │ ├── cookbook_recipes_helper.rb │ │ ├── cookbook_templates_helper.rb │ │ ├── cookbook_definitions_helper.rb │ │ ├── status_helper.rb │ │ ├── openid_server_helpers.rb │ │ ├── search_helper.rb │ │ ├── cookbooks_helper.rb │ │ ├── global_helpers.rb │ │ └── nodes_helper.rb │ ├── views │ │ ├── main │ │ │ └── index.html.erb │ │ ├── exceptions │ │ │ └── bad_request.json.erb │ │ ├── openid_consumer │ │ │ ├── start.html.haml │ │ │ └── index.html.haml │ │ ├── openid_login │ │ │ └── index.html.haml │ │ ├── search_entries │ │ │ ├── show.html.haml │ │ │ └── index.html.haml │ │ ├── search │ │ │ ├── _search_form.html.haml │ │ │ ├── index.html.haml │ │ │ └── show.html.haml │ │ ├── cookbook_templates │ │ │ └── index.html.haml │ │ ├── openid_register │ │ │ ├── show.html.haml │ │ │ └── index.html.haml │ │ ├── nodes │ │ │ ├── new.html.haml │ │ │ ├── edit.html.haml │ │ │ ├── _action.html.haml │ │ │ ├── _navigation.html.haml │ │ │ ├── _resource.html.haml │ │ │ └── index.html.haml │ │ ├── roles │ │ │ ├── new.html.haml │ │ │ ├── edit.html.haml │ │ │ ├── _navigation.html.haml │ │ │ ├── index.html.haml │ │ │ └── show.html.haml │ │ ├── cookbooks │ │ │ └── index.html.haml │ │ ├── openid_server │ │ │ └── decide.html.haml │ │ └── layout │ │ │ └── login.html.haml │ └── controllers │ │ ├── main.rb │ │ ├── status.rb │ │ └── exceptions.rb ├── public │ ├── facebox │ │ ├── b.png │ │ ├── bl.png │ │ ├── br.png │ │ ├── tl.png │ │ ├── tr.png │ │ ├── loading.gif │ │ ├── closelabel.gif │ │ └── README.txt │ ├── images │ │ ├── avatar.png │ │ ├── merb.jpg │ │ ├── black_big.png │ │ ├── indicator.gif │ │ ├── toggle-expand.gif │ │ ├── toggle-collapse.gif │ │ ├── toggle-expand-dark.png │ │ ├── toggle-collapse-dark.png │ │ ├── toggle-collapse-light.png │ │ ├── toggle-expand-light.png │ │ └── treeBuilderImages │ │ │ ├── doc.gif │ │ │ ├── Thumbs.db │ │ │ ├── docNode.gif │ │ │ ├── folder.gif │ │ │ ├── vertLine.gif │ │ │ ├── folderNode.gif │ │ │ ├── folderOpen.gif │ │ │ ├── docNodeLast.gif │ │ │ ├── folderNodeFirst.gif │ │ │ ├── folderNodeLast.gif │ │ │ ├── folderNodeOpen.gif │ │ │ ├── docNodeLastFirst.gif │ │ │ ├── folderNodeOpenLast.gif │ │ │ ├── folderNodeLastFirst.gif │ │ │ ├── folderNodeOpenFirst.gif │ │ │ └── folderNodeOpenLastFirst.gif │ └── stylesheets │ │ ├── images │ │ ├── ui-icons_222222_256x240.png │ │ ├── ui-icons_2694e8_256x240.png │ │ ├── ui-icons_2e83ff_256x240.png │ │ ├── ui-icons_72a7cf_256x240.png │ │ ├── ui-icons_888888_256x240.png │ │ ├── ui-icons_cd0a0a_256x240.png │ │ ├── ui-icons_ffffff_256x240.png │ │ ├── ui-bg_glass_100_f0f0f0_1x400.png │ │ ├── ui-bg_glass_50_99c2ff_1x400.png │ │ ├── ui-bg_glass_55_fbf5d0_1x400.png │ │ ├── ui-bg_glass_80_e6e6e6_1x400.png │ │ ├── ui-bg_glass_95_fef1ec_1x400.png │ │ ├── ui-bg_diagonals-small_0_aaaaaa_40x40.png │ │ ├── ui-bg_diagonals-thick_15_444444_40x40.png │ │ ├── ui-bg_highlight-hard_100_f9f9f9_1x100.png │ │ └── ui-bg_highlight-soft_100_e7eef3_1x100.png │ │ └── jquery.treeTable.css ├── config │ └── router.rb ├── NOTICE └── lib │ └── chef-server-slice │ └── slicetasks.rb ├── .gitmodules ├── .gitignore └── NOTICE /chef-server/spec/spec.opts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chef/spec/data/fileedit/blank: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chef/spec/unit/application/agent_spec.rb: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chef/spec/unit/application/server_spec.rb: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /features/data/cookbooks/packages/recipes/default.rb: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chef/spec/data/bad-config.rb: -------------------------------------------------------------------------------- 1 | monkey_soup("tastes nice") -------------------------------------------------------------------------------- /chef/spec/spec.opts: -------------------------------------------------------------------------------- 1 | --color 2 | --loadby 3 | mtime 4 | -------------------------------------------------------------------------------- /chef/spec/rcov.opts: -------------------------------------------------------------------------------- 1 | --exclude 2 | spec,bin,/Library/Ruby 3 | -------------------------------------------------------------------------------- /chef/spec/data/cookbooks/openldap/files/default/.ssh/id_rsa: -------------------------------------------------------------------------------- 1 | FAKE KEY -------------------------------------------------------------------------------- /chef/spec/data/cookbooks/openldap/attributes/smokey.rb: -------------------------------------------------------------------------------- 1 | smokey "robinson" -------------------------------------------------------------------------------- /chef/spec/data/compile/cookbooks/test/attributes/george.rb: -------------------------------------------------------------------------------- 1 | george "washington" -------------------------------------------------------------------------------- /features/data/cookbooks/synchronize_deps/metadata.rb: -------------------------------------------------------------------------------- 1 | depends 'synchronize' 2 | -------------------------------------------------------------------------------- /chef-server/app/controllers/application.rb: -------------------------------------------------------------------------------- 1 | class Application < Merb::Controller 2 | end -------------------------------------------------------------------------------- /chef/spec/data/cookbooks/apache2/recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Nothing ot see here 3 | # -------------------------------------------------------------------------------- /chef/spec/data/kitchen/openldap/attributes/robinson.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Smokey lives here 3 | # -------------------------------------------------------------------------------- /chef/spec/data/kitchen/openldap/definitions/client.rb: -------------------------------------------------------------------------------- 1 | # 2 | # A sad client 3 | # 4 | -------------------------------------------------------------------------------- /chef/spec/data/kitchen/openldap/recipes/woot.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Such a funny word.. 3 | # 4 | -------------------------------------------------------------------------------- /chef/spec/data/kitchen/openldap/recipes/ignoreme.rb: -------------------------------------------------------------------------------- 1 | # 2 | # this file will never be seen 3 | # -------------------------------------------------------------------------------- /chef/spec/data/cookbooks/openldap/templates/default/test.erb: -------------------------------------------------------------------------------- 1 | We could be diving for pearls! 2 | -------------------------------------------------------------------------------- /chef/spec/data/seattle.txt: -------------------------------------------------------------------------------- 1 | Seattle is a great town. Next time you visit, you should buy me a beer. -------------------------------------------------------------------------------- /chef/spec/data/kitchen/openldap/attributes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Nothing to see here, move along 3 | # 4 | -------------------------------------------------------------------------------- /chef/spec/data/kitchen/openldap/recipes/gigantor.rb: -------------------------------------------------------------------------------- 1 | cat "blanket" do 2 | pretty_kitty true 3 | end -------------------------------------------------------------------------------- /chef-server/public/javascripts/application.js: -------------------------------------------------------------------------------- 1 | // Common JavaScript code across your application goes here. -------------------------------------------------------------------------------- /chef/spec/data/cookbooks/openldap/recipes/default.rb: -------------------------------------------------------------------------------- 1 | cat "blanket" do 2 | pretty_kitty true 3 | end 4 | -------------------------------------------------------------------------------- /chef/spec/data/cookbooks/openldap/recipes/gigantor.rb: -------------------------------------------------------------------------------- 1 | cat "blanket" do 2 | pretty_kitty false 3 | end 4 | -------------------------------------------------------------------------------- /features/data/cookbooks/transfer_remote_files/metadata.rb: -------------------------------------------------------------------------------- 1 | depends "transfer_remote_files_definition" 2 | -------------------------------------------------------------------------------- /features/data/cookbooks/transfer_remote_files_definition/files/default/easy.txt: -------------------------------------------------------------------------------- 1 | easy like saturday morning -------------------------------------------------------------------------------- /chef-server-slice/app/helpers/roles_helper.rb: -------------------------------------------------------------------------------- 1 | module Merb 2 | module RolesHelper 3 | 4 | end 5 | end # Merb -------------------------------------------------------------------------------- /chef-server/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server/public/favicon.ico -------------------------------------------------------------------------------- /chef/spec/data/kitchen/openldap/definitions/drewbarrymore.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Was in people magazine this month... 3 | # -------------------------------------------------------------------------------- /chef-server-slice/app/views/main/index.html.erb: -------------------------------------------------------------------------------- 1 | <%= slice.description %> (v. <%= slice.version %>) -------------------------------------------------------------------------------- /chef-server/public/images/merb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server/public/images/merb.jpg -------------------------------------------------------------------------------- /chef/docs/design/HighLevel.graffle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef/docs/design/HighLevel.graffle -------------------------------------------------------------------------------- /chef/spec/data/cookbooks/openldap/files/default/.dotfile: -------------------------------------------------------------------------------- 1 | I am here to test .dotfiles work in file directories. 2 | -------------------------------------------------------------------------------- /features/data/cookbooks/search/attributes/search_attrs.rb: -------------------------------------------------------------------------------- 1 | search_files([ "search_one.txt", "search_two.txt" ]) 2 | -------------------------------------------------------------------------------- /chef-server-slice/app/views/exceptions/bad_request.json.erb: -------------------------------------------------------------------------------- 1 | <%= { :error => params[:exception], :code => 400 }.to_json %> -------------------------------------------------------------------------------- /chef-server/lib/views/exceptions/bad_request.html.haml: -------------------------------------------------------------------------------- 1 | - request.exceptions.each do |exception| 2 | = exception.message -------------------------------------------------------------------------------- /chef/spec/data/compile/cookbooks/test/recipes/default.rb: -------------------------------------------------------------------------------- 1 | 2 | cat "einstein" do 3 | pretty_kitty true 4 | end 5 | 6 | -------------------------------------------------------------------------------- /features/data/cookbooks/packages/recipes/macports_purge_yydecode.rb: -------------------------------------------------------------------------------- 1 | package "yydecode" do 2 | action :purge 3 | end 4 | -------------------------------------------------------------------------------- /features/data/cookbooks/packages/recipes/macports_remove_yydecode.rb: -------------------------------------------------------------------------------- 1 | package "yydecode" do 2 | action :remove 3 | end 4 | -------------------------------------------------------------------------------- /chef-server-slice/public/facebox/b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/facebox/b.png -------------------------------------------------------------------------------- /chef-server-slice/public/facebox/bl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/facebox/bl.png -------------------------------------------------------------------------------- /chef-server-slice/public/facebox/br.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/facebox/br.png -------------------------------------------------------------------------------- /chef-server-slice/public/facebox/tl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/facebox/tl.png -------------------------------------------------------------------------------- /chef-server-slice/public/facebox/tr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/facebox/tr.png -------------------------------------------------------------------------------- /features/data/cookbooks/packages/recipes/macports_install_bad_package.rb: -------------------------------------------------------------------------------- 1 | package "fdsafdsa" do 2 | action :install 3 | end 4 | -------------------------------------------------------------------------------- /features/data/cookbooks/packages/recipes/macports_install_yydecode.rb: -------------------------------------------------------------------------------- 1 | package "yydecode" do 2 | action :install 3 | end 4 | -------------------------------------------------------------------------------- /features/data/cookbooks/transfer_remote_files/files/default/transfer_a_file_from_a_cookbook.txt: -------------------------------------------------------------------------------- 1 | easy like sunday morning 2 | -------------------------------------------------------------------------------- /chef-server-slice/public/images/avatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/images/avatar.png -------------------------------------------------------------------------------- /chef-server-slice/public/images/merb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/images/merb.jpg -------------------------------------------------------------------------------- /chef-server-slice/public/facebox/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/facebox/loading.gif -------------------------------------------------------------------------------- /chef-server-slice/public/facebox/closelabel.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/facebox/closelabel.gif -------------------------------------------------------------------------------- /chef-server-slice/public/images/black_big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/images/black_big.png -------------------------------------------------------------------------------- /chef-server-slice/public/images/indicator.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/images/indicator.gif -------------------------------------------------------------------------------- /chef/spec/data/config.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Sample Chef Config File 3 | # 4 | 5 | cookbook_path "/etc/chef/cookbook", "/etc/chef/site-cookbook" 6 | 7 | -------------------------------------------------------------------------------- /features/data/cookbooks/recipe_include/README.rdoc: -------------------------------------------------------------------------------- 1 | = DESCRIPTION: 2 | 3 | = REQUIREMENTS: 4 | 5 | = ATTRIBUTES: 6 | 7 | = USAGE: 8 | 9 | -------------------------------------------------------------------------------- /chef-server-slice/public/images/toggle-expand.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/images/toggle-expand.gif -------------------------------------------------------------------------------- /chef-server-slice/public/images/toggle-collapse.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/images/toggle-collapse.gif -------------------------------------------------------------------------------- /chef/spec/data/fileedit/hosts: -------------------------------------------------------------------------------- 1 | 127.0.0.1 localhost 2 | 255.255.255.255 broadcasthost 3 | ::1 localhost 4 | fe80::1%lo0 localhost 5 | -------------------------------------------------------------------------------- /chef-server-slice/public/images/toggle-expand-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/images/toggle-expand-dark.png -------------------------------------------------------------------------------- /chef/spec/data/compile/nodes/compile.rb: -------------------------------------------------------------------------------- 1 | ## 2 | # Nodes should have a unique name 3 | ## 4 | name "compile" 5 | recipes "test", "test::one", "test::two" 6 | -------------------------------------------------------------------------------- /chef/spec/data/definitions/test.rb: -------------------------------------------------------------------------------- 1 | define :rico_suave, :rich => "smooth" do 2 | zen_master "test" do 3 | something "#{params[:rich]}" 4 | end 5 | end -------------------------------------------------------------------------------- /chef/spec/data/recipes/test.rb: -------------------------------------------------------------------------------- 1 | 2 | file "/etc/nsswitch.conf" do 3 | action :create 4 | owner "root" 5 | group "root" 6 | mode 0644 7 | end 8 | -------------------------------------------------------------------------------- /chef-server-slice/public/images/toggle-collapse-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/images/toggle-collapse-dark.png -------------------------------------------------------------------------------- /chef-server-slice/public/images/toggle-collapse-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/images/toggle-collapse-light.png -------------------------------------------------------------------------------- /chef-server-slice/public/images/toggle-expand-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/images/toggle-expand-light.png -------------------------------------------------------------------------------- /chef-server-slice/public/images/treeBuilderImages/doc.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/images/treeBuilderImages/doc.gif -------------------------------------------------------------------------------- /chef-server/app/helpers/global_helpers.rb: -------------------------------------------------------------------------------- 1 | module Merb 2 | module GlobalHelpers 3 | # helpers defined here available to all views. 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /chef-server-slice/app/controllers/main.rb: -------------------------------------------------------------------------------- 1 | class ChefServerSlice::Main < ChefServerSlice::Application 2 | 3 | def index 4 | render 5 | end 6 | 7 | end 8 | -------------------------------------------------------------------------------- /chef-server-slice/app/helpers/exceptions_helper.rb: -------------------------------------------------------------------------------- 1 | module Merb 2 | module ChefServerSlice 3 | module ExceptionsHelper 4 | end 5 | end 6 | end # Merb 7 | -------------------------------------------------------------------------------- /chef-server-slice/public/images/treeBuilderImages/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/images/treeBuilderImages/Thumbs.db -------------------------------------------------------------------------------- /chef/spec/data/compile/cookbooks/test/recipes/one.rb: -------------------------------------------------------------------------------- 1 | cat "loulou" do 2 | pretty_kitty true 3 | end 4 | 5 | new_cat "birthday" do 6 | pretty_kitty false 7 | end 8 | -------------------------------------------------------------------------------- /chef-server-slice/app/helpers/openid_server_helper.rb: -------------------------------------------------------------------------------- 1 | module Merb 2 | module ChefServerSlice 3 | module OpenidServerHelper 4 | end 5 | end 6 | end # Merb 7 | -------------------------------------------------------------------------------- /chef-server-slice/public/images/treeBuilderImages/docNode.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/images/treeBuilderImages/docNode.gif -------------------------------------------------------------------------------- /chef-server-slice/public/images/treeBuilderImages/folder.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/images/treeBuilderImages/folder.gif -------------------------------------------------------------------------------- /chef-server-slice/public/images/treeBuilderImages/vertLine.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/images/treeBuilderImages/vertLine.gif -------------------------------------------------------------------------------- /chef/spec/data/compile/cookbooks/test/recipes/two.rb: -------------------------------------------------------------------------------- 1 | cat "peanut" do 2 | pretty_kitty true 3 | end 4 | 5 | new_cat "fat peanut" do 6 | pretty_kitty false 7 | end 8 | -------------------------------------------------------------------------------- /chef-server-slice/public/images/treeBuilderImages/folderNode.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/images/treeBuilderImages/folderNode.gif -------------------------------------------------------------------------------- /chef-server-slice/public/images/treeBuilderImages/folderOpen.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/images/treeBuilderImages/folderOpen.gif -------------------------------------------------------------------------------- /chef-server-slice/app/helpers/search_entries_helper.rb: -------------------------------------------------------------------------------- 1 | module Merb 2 | module ChefServerSlice 3 | module SearchEntriesHelper 4 | 5 | end 6 | end 7 | 8 | end # Merb 9 | -------------------------------------------------------------------------------- /chef-server-slice/app/views/openid_consumer/start.html.haml: -------------------------------------------------------------------------------- 1 | <%= @form_text %> 2 | -------------------------------------------------------------------------------- /chef-server-slice/public/images/treeBuilderImages/docNodeLast.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/images/treeBuilderImages/docNodeLast.gif -------------------------------------------------------------------------------- /chef-server-slice/app/helpers/cookbook_attributes_helper.rb: -------------------------------------------------------------------------------- 1 | module Merb 2 | module ChefServerSlice 3 | module CookbookAttributesHelper 4 | 5 | end 6 | end 7 | end # Merb 8 | -------------------------------------------------------------------------------- /chef-server-slice/app/helpers/cookbook_files_helper.rb: -------------------------------------------------------------------------------- 1 | module Merb 2 | module ChefServerSlice 3 | module CookbookFilesHelper 4 | 5 | end 6 | 7 | end 8 | end # Merb 9 | -------------------------------------------------------------------------------- /chef-server-slice/app/helpers/cookbook_libraries_helper.rb: -------------------------------------------------------------------------------- 1 | module Merb 2 | module ChefServerSlice 3 | module CookbookLibrariesHelper 4 | 5 | end 6 | end 7 | end # Merb 8 | -------------------------------------------------------------------------------- /chef-server-slice/app/helpers/openid_consumer_helper.rb: -------------------------------------------------------------------------------- 1 | module Merb 2 | module ChefServerSlice 3 | module OpenidConsumerHelper 4 | 5 | end 6 | end 7 | 8 | end # Merb 9 | -------------------------------------------------------------------------------- /chef-server-slice/app/helpers/openid_register_helper.rb: -------------------------------------------------------------------------------- 1 | module Merb 2 | module ChefServerSlice 3 | module OpenidRegisterHelper 4 | 5 | end 6 | end 7 | 8 | end # Merb 9 | -------------------------------------------------------------------------------- /chef-server-slice/public/images/treeBuilderImages/folderNodeFirst.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/images/treeBuilderImages/folderNodeFirst.gif -------------------------------------------------------------------------------- /chef-server-slice/public/images/treeBuilderImages/folderNodeLast.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/images/treeBuilderImages/folderNodeLast.gif -------------------------------------------------------------------------------- /chef-server-slice/public/images/treeBuilderImages/folderNodeOpen.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/images/treeBuilderImages/folderNodeOpen.gif -------------------------------------------------------------------------------- /features/data/cookbooks/packages/recipes/macports_upgrade_yydecode.rb: -------------------------------------------------------------------------------- 1 | package "yydecode" do 2 | action :remove 3 | end 4 | 5 | package "yydecode" do 6 | action :upgrade 7 | end 8 | -------------------------------------------------------------------------------- /chef-server-slice/app/helpers/cookbook_recipes_helper.rb: -------------------------------------------------------------------------------- 1 | module Merb 2 | module ChefServerSlice 3 | module CookbookRecipesHelper 4 | 5 | end 6 | 7 | end 8 | end # Merb 9 | -------------------------------------------------------------------------------- /chef-server-slice/app/helpers/cookbook_templates_helper.rb: -------------------------------------------------------------------------------- 1 | module Merb 2 | module ChefServerSlice 3 | module CookbookTemplatesHelper 4 | 5 | end 6 | 7 | end 8 | end # Merb 9 | -------------------------------------------------------------------------------- /chef-server-slice/config/router.rb: -------------------------------------------------------------------------------- 1 | # This file is here so slice can be testing as a stand alone application. 2 | 3 | #Merb::Router.prepare do 4 | # resources :roles 5 | # ... 6 | #end 7 | -------------------------------------------------------------------------------- /chef-server-slice/public/images/treeBuilderImages/docNodeLastFirst.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/images/treeBuilderImages/docNodeLastFirst.gif -------------------------------------------------------------------------------- /chef-server-slice/public/images/treeBuilderImages/folderNodeOpenLast.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/images/treeBuilderImages/folderNodeOpenLast.gif -------------------------------------------------------------------------------- /chef-server-slice/public/stylesheets/images/ui-icons_222222_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/stylesheets/images/ui-icons_222222_256x240.png -------------------------------------------------------------------------------- /chef-server-slice/public/stylesheets/images/ui-icons_2694e8_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/stylesheets/images/ui-icons_2694e8_256x240.png -------------------------------------------------------------------------------- /chef-server-slice/public/stylesheets/images/ui-icons_2e83ff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/stylesheets/images/ui-icons_2e83ff_256x240.png -------------------------------------------------------------------------------- /chef-server-slice/public/stylesheets/images/ui-icons_72a7cf_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/stylesheets/images/ui-icons_72a7cf_256x240.png -------------------------------------------------------------------------------- /chef-server-slice/public/stylesheets/images/ui-icons_888888_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/stylesheets/images/ui-icons_888888_256x240.png -------------------------------------------------------------------------------- /chef-server-slice/public/stylesheets/images/ui-icons_cd0a0a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/stylesheets/images/ui-icons_cd0a0a_256x240.png -------------------------------------------------------------------------------- /chef-server-slice/public/stylesheets/images/ui-icons_ffffff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/stylesheets/images/ui-icons_ffffff_256x240.png -------------------------------------------------------------------------------- /chef/spec/data/cookbooks/openldap/definitions/client.rb: -------------------------------------------------------------------------------- 1 | define :openldap_client, :mothra => "a big monster" do 2 | cat "#{params[:name]}" do 3 | pretty_kitty true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /chef/spec/data/cookbooks/openldap/definitions/server.rb: -------------------------------------------------------------------------------- 1 | define :openldap_server, :mothra => "a big monster" do 2 | cat "#{params[:name]}" do 3 | pretty_kitty true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /chef-server-slice/app/helpers/cookbook_definitions_helper.rb: -------------------------------------------------------------------------------- 1 | module Merb 2 | module ChefServerSlice 3 | module CookbookDefinitionsHelper 4 | 5 | end 6 | 7 | end 8 | end # Merb 9 | -------------------------------------------------------------------------------- /chef-server-slice/public/images/treeBuilderImages/folderNodeLastFirst.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/images/treeBuilderImages/folderNodeLastFirst.gif -------------------------------------------------------------------------------- /chef-server-slice/public/images/treeBuilderImages/folderNodeOpenFirst.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/images/treeBuilderImages/folderNodeOpenFirst.gif -------------------------------------------------------------------------------- /chef/spec/data/compile/cookbooks/test/definitions/new_cat.rb: -------------------------------------------------------------------------------- 1 | define :new_cat, :is_pretty => true do 2 | cat "#{params[:name]}" do 3 | pretty_kitty params[:is_pretty] 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /chef-server-slice/public/images/treeBuilderImages/folderNodeOpenLastFirst.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/images/treeBuilderImages/folderNodeOpenLastFirst.gif -------------------------------------------------------------------------------- /chef-server-slice/public/stylesheets/images/ui-bg_glass_100_f0f0f0_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/stylesheets/images/ui-bg_glass_100_f0f0f0_1x400.png -------------------------------------------------------------------------------- /chef-server-slice/public/stylesheets/images/ui-bg_glass_50_99c2ff_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/stylesheets/images/ui-bg_glass_50_99c2ff_1x400.png -------------------------------------------------------------------------------- /chef-server-slice/public/stylesheets/images/ui-bg_glass_55_fbf5d0_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/stylesheets/images/ui-bg_glass_55_fbf5d0_1x400.png -------------------------------------------------------------------------------- /chef-server-slice/public/stylesheets/images/ui-bg_glass_80_e6e6e6_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/stylesheets/images/ui-bg_glass_80_e6e6e6_1x400.png -------------------------------------------------------------------------------- /chef-server-slice/public/stylesheets/images/ui-bg_glass_95_fef1ec_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/stylesheets/images/ui-bg_glass_95_fef1ec_1x400.png -------------------------------------------------------------------------------- /chef-server/lib/tasks/uninstall.rake: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'rake/gempackagetask' 3 | 4 | task :uninstall do 5 | sh %{sudo gem uninstall #{GEM} -x -v #{CHEF_SERVER_VERSION}} 6 | end 7 | 8 | -------------------------------------------------------------------------------- /chef/spec/data/cookbooks/openldap/ignore: -------------------------------------------------------------------------------- 1 | # 2 | # The ignore file allows you to skip files in cookbooks with the same name that appear 3 | # later in the search path. 4 | # 5 | 6 | recipes/ignoreme.rb -------------------------------------------------------------------------------- /chef-server-slice/public/stylesheets/images/ui-bg_diagonals-small_0_aaaaaa_40x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/stylesheets/images/ui-bg_diagonals-small_0_aaaaaa_40x40.png -------------------------------------------------------------------------------- /chef-server-slice/public/stylesheets/images/ui-bg_diagonals-thick_15_444444_40x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/stylesheets/images/ui-bg_diagonals-thick_15_444444_40x40.png -------------------------------------------------------------------------------- /chef-server-slice/public/stylesheets/images/ui-bg_highlight-hard_100_f9f9f9_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/stylesheets/images/ui-bg_highlight-hard_100_f9f9f9_1x100.png -------------------------------------------------------------------------------- /chef-server-slice/public/stylesheets/images/ui-bg_highlight-soft_100_e7eef3_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jchris/chef/master/chef-server-slice/public/stylesheets/images/ui-bg_highlight-soft_100_e7eef3_1x100.png -------------------------------------------------------------------------------- /chef-server/lib/tasks/install.rake: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'rake/gempackagetask' 3 | 4 | task :install => :package do 5 | sh %{sudo gem install pkg/#{GEM}-#{CHEF_SERVER_VERSION} --no-rdoc --no-ri} 6 | end 7 | 8 | -------------------------------------------------------------------------------- /chef-server-slice/public/facebox/README.txt: -------------------------------------------------------------------------------- 1 | Please visit http://famspam.com/facebox/ or open index.html in your favorite browser. 2 | 3 | Need help? Join our Google Groups mailing list: 4 | http://groups.google.com/group/facebox/ 5 | -------------------------------------------------------------------------------- /chef-server/public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-Agent: * 5 | # Disallow: / -------------------------------------------------------------------------------- /chef-server-slice/app/views/openid_login/index.html.haml: -------------------------------------------------------------------------------- 1 | #login-form 2 | %form{ :method => "get", :action => url(:openid_login_submit) } 3 | %input{ :type => "text", :name => "username" }/ 4 | %input{ :type => "submit", :value => "Log In"}/ 5 | -------------------------------------------------------------------------------- /features/data/cookbooks/transfer_remote_files_definition/definitions/transfer.rb: -------------------------------------------------------------------------------- 1 | define :transfer_cookbook do 2 | remote_file "#{node[:tmpdir]}/#{params[:name]}" do 3 | source "easy.txt" 4 | cookbook "transfer_remote_files_definition" 5 | end 6 | end -------------------------------------------------------------------------------- /features/data/roles/role_test.rb: -------------------------------------------------------------------------------- 1 | name "role_test" 2 | description "A simple test role" 3 | default_attributes( 4 | :reason => "unbalancing", 5 | :ossining => "this time around" 6 | ) 7 | override_attributes( 8 | :snakes => "on a plane" 9 | ) 10 | recipes "roles" 11 | -------------------------------------------------------------------------------- /chef-server-slice/app/views/search_entries/show.html.haml: -------------------------------------------------------------------------------- 1 | .search_result 2 | %h3= "#{h @entry[:index_name]} (#{h @entry[:id]})" 3 | %table 4 | - @entry.each do |k, v| 5 | %tr.attr_group 6 | %td.attr_name= k 7 | %td.attr_value= v.kind_of?(Array) ? v.join(",") : v -------------------------------------------------------------------------------- /chef-server/contrib/el/chef-indexer.config: -------------------------------------------------------------------------------- 1 | # 2 | # Chef Server Config File 3 | # 4 | 5 | log_level :info 6 | search_index_path "/var/lib/chef/search_index" 7 | 8 | Chef::Log::Formatter.show_time = false 9 | 10 | pid_file "/var/run/chef/chef-indexer.pid" 11 | -------------------------------------------------------------------------------- /chef-server-slice/app/views/search/_search_form.html.haml: -------------------------------------------------------------------------------- 1 | %form{ :method => "get", :action => slice_url(:search, { :id => index_name }) } 2 | Q: 3 | %input{ :type => "text", :name => "q" } 4 | A: 5 | %input{ :type => "text", :name => "a" } 6 | %input{ :type => "submit", :value => "Search #{index_name}" } 7 | -------------------------------------------------------------------------------- /features/data/cookbooks/recipe_include/metadata.rb: -------------------------------------------------------------------------------- 1 | maintainer "Opscode" 2 | maintainer_email "do_not_reply@opscode.com" 3 | license "Apache 2.0" 4 | description "Installs/Configures recipe_include" 5 | long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc')) 6 | version "0.1" 7 | -------------------------------------------------------------------------------- /chef-server-slice/app/views/search_entries/index.html.haml: -------------------------------------------------------------------------------- 1 | - @entries.each do |result| 2 | .search_result 3 | %h3= "#{h result[:index_name]} (#{h result[:id]})" 4 | %table 5 | - result.each do |k, v| 6 | %tr.attr_group 7 | %td.attr_name= k 8 | %td.attr_value= v.kind_of?(Array) ? v.join(",") : v -------------------------------------------------------------------------------- /chef/spec/data/nodes/test.rb: -------------------------------------------------------------------------------- 1 | ## 2 | # Nodes should have a unique name 3 | ## 4 | name "test.example.com short" 5 | 6 | ## 7 | # Nodes can set arbitrary arguments 8 | ## 9 | sunshine "in" 10 | something "else" 11 | 12 | ## 13 | # Nodes should have recipes 14 | ## 15 | recipes "operations-master", "operations-monitoring" 16 | -------------------------------------------------------------------------------- /chef/spec/data/nodes/default.rb: -------------------------------------------------------------------------------- 1 | ## 2 | # Nodes should have a unique name 3 | ## 4 | name "test.example.com default" 5 | 6 | ## 7 | # Nodes can set arbitrary arguments 8 | ## 9 | sunshine "in" 10 | something "else" 11 | 12 | ## 13 | # Nodes should have recipes 14 | ## 15 | recipes "operations-master", "operations-monitoring" 16 | -------------------------------------------------------------------------------- /chef/spec/data/nodes/test.example.com.rb: -------------------------------------------------------------------------------- 1 | ## 2 | # Nodes should have a unique name 3 | ## 4 | name "test.example.com" 5 | 6 | ## 7 | # Nodes can set arbitrary arguments 8 | ## 9 | sunshine "in" 10 | something "else" 11 | 12 | ## 13 | # Nodes should have recipes 14 | ## 15 | recipes "operations-master", "operations-monitoring" 16 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "chef-server-slice/public/javascripts/jsoneditor"] 2 | path = chef-server-slice/public/javascripts/jsoneditor 3 | url = git://github.com/iterationlabs/jsoneditor.git 4 | [submodule "chef-server-slice/public/web-app-theme"] 5 | path = chef-server-slice/public/web-app-theme 6 | url = git://github.com/pilu/web-app-theme.git 7 | -------------------------------------------------------------------------------- /chef/spec/data/cookbooks/openldap/recipes/one.rb: -------------------------------------------------------------------------------- 1 | ## 2 | # Nodes should have a unique name 3 | ## 4 | name "test.example.com default" 5 | 6 | ## 7 | # Nodes can set arbitrary arguments 8 | ## 9 | sunshine "in" 10 | something "else" 11 | 12 | ## 13 | # Nodes should have recipes 14 | ## 15 | recipes "operations-master", "operations-monitoring" 16 | -------------------------------------------------------------------------------- /chef-server-slice/NOTICE: -------------------------------------------------------------------------------- 1 | Chef NOTICE 2 | =========== 3 | 4 | Developed at HJK Solutions (http://www.hjksolutions.com). 5 | 6 | Contributors and Copyright holders: 7 | 8 | * Copyright 2008, Adam Jacob 9 | * Copyright 2008, Arjuna Christensen 10 | * Copyright 2008, Ezra Zygmuntowicz 11 | -------------------------------------------------------------------------------- /chef-server-slice/app/views/cookbook_templates/index.html.haml: -------------------------------------------------------------------------------- 1 | - @templates.each do |template, data| 2 | .index 3 | %table 4 | %tr 5 | %td 6 | %a{ :href => url(:cookbook_template, { :cookbook_id => params[:cookbook_id], :id => data[:link_name], :version => data[:version] }) } 7 | = "#{data[:version]} - #{data[:name]}" 8 | -------------------------------------------------------------------------------- /chef/lib/chef/provider/ruby_block.rb: -------------------------------------------------------------------------------- 1 | 2 | class Chef 3 | class Provider 4 | class RubyBlock < Chef::Provider 5 | def load_current_resource 6 | Chef::Log.debug(@new_resource.inspect) 7 | true 8 | end 9 | 10 | def action_create 11 | @new_resource.block.call 12 | end 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /features/support/packages.rb: -------------------------------------------------------------------------------- 1 | # Provides a method to quickly lookup whether we have 2 | # a given packaging system installed. 3 | def package_system_available?(name) 4 | case name 5 | when 'MacPorts' 6 | uname = `uname` 7 | port = `which port` 8 | (uname =~ /Darwin/ and !port.match(/not found/)) 9 | else 10 | false 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /chef-server-slice/app/views/openid_register/show.html.haml: -------------------------------------------------------------------------------- 1 | .block#block-text 2 | .content 3 | %h2.title= "Registration #{@registered_node.name}" 4 | .inner 5 | = link_to "OpenID URL", slice_url(:openid_node, { :id => @registered_node.name.gsub(/\./, "_")}) 6 | %br= "Validated: #{@registered_node.validated}" 7 | %br= "Admin: #{@registered_node.admin}" -------------------------------------------------------------------------------- /chef-server-slice/app/views/nodes/new.html.haml: -------------------------------------------------------------------------------- 1 | .block#block-tables 2 | .content 3 | %h2.title= "Node" 4 | .inner 5 | = partial('navigation', :active => 'create') 6 | = partial('form', :header => "Create new Node", :form_id => 'create_node', :submit_name => "Create Node", :submit_id => "create_node_button", :form_for => 'create', :form_url => slice_url(:nodes)) 7 | -------------------------------------------------------------------------------- /chef-server-slice/app/views/roles/new.html.haml: -------------------------------------------------------------------------------- 1 | .block#block-tables 2 | .content 3 | %h2.title= "Role" 4 | .inner 5 | = partial('navigation', :active => 'create') 6 | = partial('form', :header => "Create new Role", :form_id => 'create_role', :submit_name => "Create Role", :submit_id => "create_role_button", :form_for => 'create', :form_url => slice_url(:roles)) 7 | -------------------------------------------------------------------------------- /chef-server/config/environments/production.rb: -------------------------------------------------------------------------------- 1 | Merb.logger.info("Loaded PRODUCTION Environment...") 2 | Merb::Config.use { |c| 3 | c[:exception_details] = false 4 | c[:reload_classes] = false 5 | c[:log_level] = Chef::Config[:log_level] 6 | c[:log_stream] = Chef::Config[:log_location] 7 | # or redirect logger using IO handle 8 | # c[:log_stream] = STDOUT 9 | } 10 | -------------------------------------------------------------------------------- /chef-server/config/environments/staging.rb: -------------------------------------------------------------------------------- 1 | Merb.logger.info("Loaded STAGING Environment...") 2 | Merb::Config.use { |c| 3 | c[:exception_details] = false 4 | c[:reload_classes] = false 5 | c[:log_level] = :error 6 | c[:log_stream] = Chef::Config[:log_location] 7 | c[:log_file] = nil 8 | # or redirect logger using IO handle 9 | # c[:log_stream] = STDOUT 10 | } 11 | -------------------------------------------------------------------------------- /chef-server-slice/app/views/roles/edit.html.haml: -------------------------------------------------------------------------------- 1 | .block#block-tables 2 | .content 3 | %h2.title= "Role #{h @role.name}" 4 | .inner 5 | = partial('navigation', :active => 'edit') 6 | = partial('form', :header => "Edit Role #{@role.name}", :form_id => 'edit_role', :submit_name => "Save Role", :submit_id => "edit_role_button", :form_for => 'edit', :form_url => slice_url(:role, @role.name) ) 7 | -------------------------------------------------------------------------------- /features/data/roles/role_test.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "role_test", 3 | "chef_type": "role", 4 | "json_class": "Chef::Role", 5 | "default_attributes": { 6 | "ossining": "this time around", 7 | "reason": "unbalancing" 8 | }, 9 | "description": "A simple test role", 10 | "recipes": [ 11 | "roles" 12 | ], 13 | "override_attributes": { 14 | "snakes": "on a plane" 15 | } 16 | } -------------------------------------------------------------------------------- /chef-server/config/environments/rake.rb: -------------------------------------------------------------------------------- 1 | Merb.logger.info("Loaded RAKE Environment...") 2 | Merb::Config.use { |c| 3 | c[:exception_details] = true 4 | c[:reload_classes] = false 5 | c[:log_auto_flush ] = true 6 | c[:log_stream] = Chef::Config[:log_location] 7 | c[:log_file] = nil 8 | # Or redirect logging into a file: 9 | # c[:log_file] = Merb.root / "log" / "development.log" 10 | } 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .autotest 2 | coverage 3 | doc 4 | .DS_Store 5 | packages/chef-server/db 6 | examples/search_index 7 | examples/store 8 | examples/openid-cstore 9 | examples/openid-db 10 | chef/pkg 11 | chef-server/pkg 12 | chef-server-slice/pkg 13 | chef/log 14 | chef-server/log 15 | log 16 | couchdb.stderr 17 | couchdb.stdout 18 | features/data/tmp/** 19 | *.swp 20 | features/data/cookbooks/**/metadata.json 21 | -------------------------------------------------------------------------------- /chef-server-slice/app/views/nodes/edit.html.haml: -------------------------------------------------------------------------------- 1 | .block#block-tables 2 | .content 3 | %h2.title= "Node #{h @node.name}" 4 | .inner 5 | = partial('navigation', :active => 'edit') 6 | = partial('form', :header => "Edit Node #{@node.name}", :form_id => 'edit_node', :submit_name => "Save Node", :submit_id => "edit_node_button", :form_for => 'edit', :form_url => slice_url(:node, escape_node_id(@node.name)) ) 7 | 8 | -------------------------------------------------------------------------------- /features/data/cookbooks/execute_commands/metadata.rb: -------------------------------------------------------------------------------- 1 | 2 | version "1.0" 3 | maintainer "Bobo T. Clown" 4 | maintainer_email "bobo@example.com" 5 | long_description "I have a long arm!" 6 | supports :ubuntu, ">> 8.04" 7 | depends "bobo", "= 1.0" 8 | depends "bobotclown", "= 1.1" 9 | recommends "snark", "<< 3.0" 10 | suggests "kindness", ">> 2.0", "<< 4.0" 11 | conflicts "hatred" 12 | provides "foo(:bar, :baz)" 13 | replaces "snarkitron" 14 | 15 | -------------------------------------------------------------------------------- /chef-server-slice/app/views/cookbooks/index.html.haml: -------------------------------------------------------------------------------- 1 | .block#block-tables 2 | .content 3 | %h2.title Cookbooks 4 | .inner 5 | %table.table 6 | %tr 7 | %th.first Cookbook Name 8 | - @cl.sort{ |a,b| a.name.to_s <=> b.name.to_s }.each_with_index do |cookbook, index| 9 | %tr{:class => "#{index % 2 == 1 ? 'odd' : 'even'}"} 10 | %td= link_to cookbook.name, slice_url(:cookbook, { :id => cookbook.name }) -------------------------------------------------------------------------------- /chef/contrib/el/chef-client.config: -------------------------------------------------------------------------------- 1 | # 2 | # Chef Client Config File 3 | # 4 | 5 | log_level :info 6 | ssl_verify_mode :verify_none 7 | registration_url "http://127.0.0.1:4000" 8 | openid_url "http://127.0.0.1:4001" 9 | template_url "http://127.0.0.1:4000" 10 | remotefile_url "http://127.0.0.1:4000" 11 | search_url "http://127.0.0.1:4000" 12 | 13 | pid_file "/var/run/chef/chef-client.pid" 14 | 15 | #interval 1800 16 | #splay 0 17 | -------------------------------------------------------------------------------- /features/steps/result_steps.rb: -------------------------------------------------------------------------------- 1 | Then /^I should see "(.*)"$/ do |text| 2 | response.body.to_s.should =~ /#{text}/m 3 | end 4 | 5 | Then /^I should not see "(.*)"$/ do |text| 6 | response.body.to_s.should_not =~ /#{text}/m 7 | end 8 | 9 | Then /^I should see an? (\w+) message$/ do |message_type| 10 | response.should have_xpath("//*[@class='#{message_type}']") 11 | end 12 | 13 | Then /^the (.*) ?request should fail/ do |_| 14 | response.should_not be_successful 15 | end -------------------------------------------------------------------------------- /features/data/cookbooks/metadata/metadata.rb: -------------------------------------------------------------------------------- 1 | 2 | version "1.0" 3 | maintainer "Bobo T. Clown" 4 | maintainer_email "bobo@example.com" 5 | long_description "I have a long arm!" 6 | supports :ubuntu, ">> 8.04" 7 | 8 | depends "bobo", "= 1.0" 9 | depends "bobotclown", "= 1.1" 10 | recommends "snark", "<< 3.0" 11 | suggests "kindness", ">> 2.0", "<< 4.0" 12 | conflicts "hatred" 13 | 14 | depends "foo(:bar, :baz)" 15 | provides "foo(:bar, :baz)" 16 | replaces "snarkitron" 17 | 18 | -------------------------------------------------------------------------------- /chef-server/config/environments/test.rb: -------------------------------------------------------------------------------- 1 | Merb.logger.info("Loaded TEST Environment...") 2 | Merb::Config.use { |c| 3 | c[:testing] = true 4 | c[:exception_details] = true 5 | c[:log_auto_flush ] = true 6 | 7 | # log less in testing environment 8 | c[:log_level] = :error 9 | c[:log_stream] = Chef::Config[:log_location] 10 | c[:log_file] = nil 11 | #c[:log_file] = Merb.root / "log" / "test.log" 12 | # or redirect logger using IO handle 13 | } 14 | -------------------------------------------------------------------------------- /chef/spec/data/cookbooks/openldap/attributes/default.rb: -------------------------------------------------------------------------------- 1 | chef_env ||= nil 2 | case chef_env 3 | when "prod" 4 | ldap_server "ops1prod" 5 | ldap_basedn "dc=hjksolutions,dc=com" 6 | ldap_replication_password "yes" 7 | when "corp" 8 | ldap_server "ops1prod" 9 | ldap_basedn "dc=hjksolutions,dc=com" 10 | ldap_replication_password "yougotit" 11 | else 12 | ldap_server "ops1prod" 13 | ldap_basedn "dc=hjksolutions,dc=com" 14 | ldap_replication_password "forsure" 15 | end 16 | -------------------------------------------------------------------------------- /features/chef-client/roles.feature: -------------------------------------------------------------------------------- 1 | @client @roles 2 | Feature: Configure nodes based on their role 3 | In order to easily configure similar systems 4 | As an Administrator 5 | I want to define and utilize roles 6 | 7 | Scenario: Apply a role to a node 8 | Given a validated node 9 | And it includes the role 'role_test' 10 | When I run the chef-client with '-l debug' 11 | Then the run should exit '0' 12 | And 'stdout' should have 'DEBUG: Loading Recipe roles' 13 | 14 | -------------------------------------------------------------------------------- /chef-server-slice/app/views/search/index.html.haml: -------------------------------------------------------------------------------- 1 | .block#block-forms 2 | .content 3 | %h2.title Search Indexes 4 | .inner 5 | - @search_indexes.sort{ |a,b| a.to_s <=> b.to_s}.each do |index| 6 | %form.form{ :method => "get", "accept-charset" => "UTF-8", :action => slice_url(:search, { :id => index})} 7 | .group.label= text_field :name => "q", :label => "Query" 8 | .group.label= text_field :name => "a", :label => "Attributes" 9 | .group= submit "Search #{index}" -------------------------------------------------------------------------------- /chef-server-slice/app/views/nodes/_action.html.haml: -------------------------------------------------------------------------------- 1 | %table 2 | - actions.each do |action, resource_hash| 3 | %tr 4 | %td.action_name= action.to_s 5 | %td.action_resources 6 | %table 7 | - resource_hash.keys.sort{ |a,b| a.to_s <=> b.to_s }.each do |rk| 8 | %tr 9 | %td.action_when= rk.to_s 10 | %td 11 | - resource_hash[rk].each do |resource| 12 | = partial(:resource, :resource => resource) 13 | -------------------------------------------------------------------------------- /features/search/search_data.feature: -------------------------------------------------------------------------------- 1 | @search 2 | Feature: Search Data 3 | In order to access information about my infrastructure 4 | As a Developer 5 | I want to search the data 6 | 7 | Scenario: Search the node index 8 | Given a validated node 9 | And it includes the recipe 'search::search_data' 10 | When I run the chef-client 11 | Then the run should exit '0' 12 | And a file named 'search_one.txt' should exist 13 | And a file named 'search_two.txt' should exist 14 | 15 | -------------------------------------------------------------------------------- /chef/History.txt: -------------------------------------------------------------------------------- 1 | === 1.0.0 / 2008-03-05 2 | 3 | * 1 major enhancement 4 | * Birthday! 5 | 6 | Sun Apr 27 20:30:43 PDT 2008 7 | * Compiled first full recipes, and actually passed them to a provider. :) 8 | 9 | Mon Jun 9 01:57:58 PDT 2008 10 | * Compiled first full recipes over a network, with registration and authorization. 11 | 12 | Thu Jul 10 19:59:46 PDT 2008 13 | * Search support functional! 14 | 15 | Sat Aug 16 17:46:34 PDT 2008 16 | * Compiled a template! 17 | * Remote files and directories 18 | -------------------------------------------------------------------------------- /chef/lib/chef/resource/ruby_block.rb: -------------------------------------------------------------------------------- 1 | class Chef 2 | class Resource 3 | class RubyBlock < Chef::Resource 4 | def initialize(name, collection=nil, node=nil) 5 | super(name, collection, node) 6 | @resource_name = :ruby_block 7 | @action = :create 8 | @allowed_actions.push(:create) 9 | end 10 | 11 | def block(&block) 12 | if block 13 | @block = block 14 | else 15 | @block 16 | end 17 | end 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /chef-server/config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Merb.logger.info("Loaded DEVELOPMENT Environment...") 2 | Merb::Config.use { |c| 3 | c[:exception_details] = true 4 | c[:reload_templates] = true 5 | c[:reload_classes] = true 6 | c[:reload_time] = 0.5 7 | c[:ignore_tampered_cookies] = true 8 | c[:log_auto_flush ] = true 9 | c[:log_level] = :debug 10 | c[:log_stream] = Chef::Config[:log_location] 11 | c[:log_file] = nil 12 | # Or redirect logging into a file: 13 | # c[:log_file] = Merb.root / "log" / "development.log" 14 | } 15 | -------------------------------------------------------------------------------- /features/chef-client/run_interval.feature: -------------------------------------------------------------------------------- 1 | @client 2 | Feature: Run chef-client at periodic intervals 3 | In order to ensure a system is always correctly configured 4 | As an Administrator 5 | I want to run the chef-client repeatedly at an interval 6 | 7 | Scenario: Run the client at an interval 8 | Given a validated node 9 | And it includes the recipe 'run_interval' 10 | When I run the chef-client with '-l info -i 5' for '10' seconds 11 | Then the run should exit '2' 12 | And 'INFO: Starting Chef Run' should appear on 'stdout' '2' times 13 | 14 | -------------------------------------------------------------------------------- /chef-server-slice/app/views/search/show.html.haml: -------------------------------------------------------------------------------- 1 | .block#block-tables 2 | .content 3 | %h2.title Search Results 4 | .inner 5 | - @results.each do |result| 6 | %table.table.search{:width => '400px'} 7 | %tr 8 | %th.first Attribute 9 | %th.last Value 10 | - @results.each do |result| 11 | - result.sort { |a,b| a[0].to_s <=> b[0].to_s}.each_with_index do |h,index| 12 | %tr{:class => "#{index % 2 == 1 ? 'odd' : 'even'}"} 13 | %td= "#{h[0]} (#{h[1].class})" 14 | %td= h[1] -------------------------------------------------------------------------------- /chef-server/app/views/layout/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Fresh Merb App 5 | 6 | 7 | 8 | 9 | <%#= message[:notice] %> 10 | <%= catch_content :for_layout %> 11 | 12 | -------------------------------------------------------------------------------- /chef-server/public/.htaccess: -------------------------------------------------------------------------------- 1 | # Sets the default handler for FastCGI scripts 2 | AddHandler fastcgi-script .fcgi 3 | 4 | # If Apache2 is used together with mod_fcgid, 5 | # uncomment the line below and comment in the line 6 | # above to set the correct script handler 7 | #AddHandler fcgid-script .fcgi 8 | 9 | RewriteEngine On 10 | 11 | RewriteRule ^$ index.html [QSA] 12 | RewriteRule ^([^.]+)$ $1.html [QSA] 13 | RewriteCond %{REQUEST_FILENAME} !-f 14 | RewriteRule ^(.*)$ merb.fcgi [QSA,L] 15 | 16 | 17 | ErrorDocument 500 "

Application Error

Merb could not be reached" 18 | -------------------------------------------------------------------------------- /features/data/config/client.rb: -------------------------------------------------------------------------------- 1 | supportdir = File.expand_path(File.join(File.dirname(__FILE__), "..")) 2 | tmpdir = File.expand_path(File.join(File.dirname(__FILE__), "..", "tmp")) 3 | 4 | log_level :error 5 | log_location STDOUT 6 | file_cache_path File.join(tmpdir, "cache") 7 | ssl_verify_mode :verify_none 8 | registration_url "http://127.0.0.1:4000" 9 | openid_url "http://127.0.0.1:4001" 10 | template_url "http://127.0.0.1:4000" 11 | remotefile_url "http://127.0.0.1:4000" 12 | search_url "http://127.0.0.1:4000" 13 | role_url "http://127.0.0.1:4000" 14 | couchdb_database 'chef_integration' 15 | -------------------------------------------------------------------------------- /chef-server-slice/lib/chef-server-slice/slicetasks.rb: -------------------------------------------------------------------------------- 1 | namespace :slices do 2 | namespace :chefserverslice do 3 | 4 | # add your own chefserver tasks here 5 | 6 | # # Uncomment the following lines and edit the pre defined tasks 7 | # 8 | # # implement this to test for structural/code dependencies 9 | # # like certain directories or availability of other files 10 | # desc "Test for any dependencies" 11 | # task :preflight do 12 | # end 13 | # 14 | # # implement this to perform any database related setup steps 15 | # desc "Migrate the database" 16 | # task :migrate do 17 | # end 18 | 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /chef-server/config.ru: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'merb-core' 3 | require 'chef' 4 | 5 | Chef::Config.from_file(File.join("/etc", "chef", "server.rb")) 6 | 7 | Merb::Config.setup(:merb_root => File.expand_path(File.dirname(__FILE__)), 8 | :environment => ENV['RACK_ENV'], :init_file => File.dirname(__FILE__) / "config/init.rb") 9 | Merb.environment = Merb::Config[:environment] 10 | Merb.root = Merb::Config[:merb_root] 11 | Merb::BootLoader.run 12 | 13 | # Uncomment if your app is mounted at a suburi 14 | #if prefix = ::Merb::Config[:path_prefix] 15 | # use Merb::Rack::PathPrefix, prefix 16 | #end 17 | 18 | run Merb::Rack::Application.new 19 | 20 | -------------------------------------------------------------------------------- /chef-server/config/dependencies.rb: -------------------------------------------------------------------------------- 1 | # dependencies are generated using a strict version, don't forget to edit the dependency versions when upgrading. 2 | merb_gems_version = "> 1.0" 3 | 4 | # For more information about each component, please read http://wiki.merbivore.com/faqs/merb_components 5 | dependency "merb-core", merb_gems_version 6 | dependency "merb-assets", merb_gems_version 7 | dependency "merb-helpers", merb_gems_version 8 | dependency "merb-slices", merb_gems_version 9 | if defined?(CHEF_SERVER_VERSION) 10 | dependency "chef-server-slice", CHEF_SERVER_VERSION unless defined?(ChefServerSlice) 11 | else 12 | dependency "chef-server-slice" unless defined?(ChefServerSlice) 13 | end 14 | -------------------------------------------------------------------------------- /chef-server-slice/app/views/roles/_navigation.html.haml: -------------------------------------------------------------------------------- 1 | .secondary-navigation 2 | %ul 3 | %li{ :class => "first #{active == 'index' ? "active" : ''}"}= link_to('List', slice_url(:roles)) 4 | %li{ :class => (active == 'create' ? "active" : '')}= link_to('Create', slice_url(:new_role)) 5 | - if active != 'create' && active != 'index' 6 | %li{ :class => (active == 'show' ? "active" : '')}= link_to('Show', slice_url(:role, @role.name)) 7 | %li{ :class => (active == 'edit' ? "active" : '')}= link_to('Edit', slice_url(:edit_role, @role.name)) 8 | %li= link_to('Delete', slice_url(:role, @role.name), :method => "delete", :confirm => "Really delete Role #{@role.name}? There is no undo.") 9 | .clear 10 | -------------------------------------------------------------------------------- /features/data/cookbooks/synchronize_deps/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "maintainer_email": "youremail@example.com", 3 | "recipes": { 4 | "synchronize_deps": "" 5 | }, 6 | "suggestions": { 7 | 8 | }, 9 | "license": "Apache v2.0", 10 | "conflicting": { 11 | 12 | }, 13 | "dependencies": { 14 | "synchronize": [ 15 | 16 | ] 17 | }, 18 | "attributes": { 19 | 20 | }, 21 | "name": "synchronize_deps", 22 | "providing": { 23 | "synchronize_deps": [ 24 | 25 | ] 26 | }, 27 | "replacing": { 28 | 29 | }, 30 | "long_description": "", 31 | "description": "A fabulous new cookbook", 32 | "maintainer": "Your Name", 33 | "recommendations": { 34 | 35 | }, 36 | "platforms": { 37 | 38 | } 39 | } -------------------------------------------------------------------------------- /features/steps/packages.rb: -------------------------------------------------------------------------------- 1 | Given /^that I have the (.+) package system installed$/ do |package_system| 2 | unless package_system_available?(package_system) 3 | pending "This Cucumber feature will not execute, as it is missing the #{package_system} packaging system." 4 | end 5 | end 6 | 7 | Then /^there should be a binary on the path called '(.+)'$/ do |binary_name| 8 | binary_name.strip! 9 | result = `which #{binary_name}` 10 | result.should_not =~ /not found/ 11 | end 12 | 13 | Then /^there should not be a binary on the path called '(.+)'$/ do |binary_name| 14 | binary_name.strip! 15 | result = `which #{binary_name}`.strip 16 | 17 | unless result.empty? 18 | result.should =~ /not found/ 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /features/data/cookbooks/roles/recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: roles 3 | # Recipe:: default 4 | # 5 | # Copyright 2009, Opscode 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 | -------------------------------------------------------------------------------- /chef/config/server.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Example Chef Server Config 3 | 4 | log_level :debug 5 | 6 | cookbook_path File.join(File.dirname(__FILE__), "..", "examples", "config", "cookbooks") 7 | node_path File.join(File.dirname(__FILE__), "..", "examples", "config", "nodes") 8 | file_store_path File.join(File.dirname(__FILE__), "..", "examples", "store") 9 | openid_store_path File.join(File.dirname(__FILE__), "..", "examples", "openid-db") 10 | openid_cstore_path File.join(File.dirname(__FILE__), "..", "examples", "openid-cstore") 11 | search_index_path File.join(File.dirname(__FILE__), "..", "examples", "search_index") 12 | 13 | # openid_providers [ "localhost:4001", "openid.hjksolutions.com" ] 14 | 15 | Chef::Log::Formatter.show_time = false 16 | -------------------------------------------------------------------------------- /features/data/cookbooks/metadata/recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: metadata 3 | # Recipe:: default 4 | # 5 | # Copyright 2009, Opscode 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 | -------------------------------------------------------------------------------- /features/data/cookbooks/search/recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: search 3 | # Recipe:: default 4 | # 5 | # Copyright 2009, Opscode 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 | -------------------------------------------------------------------------------- /features/data/cookbooks/manage_files/recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: files 3 | # Recipe:: default 4 | # 5 | # Copyright 2009, Opscode 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 | -------------------------------------------------------------------------------- /features/data/cookbooks/run_interval/recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: run_interval 3 | # Recipe:: default 4 | # 5 | # Copyright 2009, Opscode 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 | -------------------------------------------------------------------------------- /features/data/cookbooks/synchronize/recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: synchronize 3 | # Recipe:: default 4 | # 5 | # Copyright 2009, Opscode 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 | -------------------------------------------------------------------------------- /features/data/cookbooks/directory_provider/recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: directory_provider 3 | # Recipe:: default 4 | # 5 | # Copyright 2009, Opscode 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 | -------------------------------------------------------------------------------- /features/data/cookbooks/synchronize_deps/recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: synchronize_deps 3 | # Recipe:: default 4 | # 5 | # Copyright 2009, Opscode 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 | -------------------------------------------------------------------------------- /chef/examples/user_index.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # Create a users index, based on /etc/passwd 4 | 5 | require 'etc' 6 | require File.join(File.dirname(__FILE__), "..", "lib", "chef") 7 | 8 | Chef::Config[:log_level] = :info 9 | r = Chef::REST.new("http://localhost:4000") 10 | 11 | users = Array.new 12 | Etc.passwd do |passwd| 13 | Chef::Log.info("Ensuring we have #{passwd.name}") 14 | r.post_rest("search/user/entries", 15 | { 16 | :id => passwd.name, 17 | :name => passwd.name, 18 | :uid => passwd.uid, 19 | :gid => passwd.gid, 20 | :gecos => passwd.gecos, 21 | :dir => passwd.dir, 22 | :shell => passwd.shell, 23 | :change => passwd.change, 24 | :expire => passwd.expire 25 | } 26 | ) 27 | end 28 | -------------------------------------------------------------------------------- /chef-server-slice/app/views/nodes/_navigation.html.haml: -------------------------------------------------------------------------------- 1 | .secondary-navigation 2 | %ul 3 | %li{ :class => "first #{active == 'index' ? "active" : ''}"}= link_to('List', slice_url(:nodes)) 4 | %li{ :class => (active == 'create' ? "active" : '')}= link_to('Create', slice_url(:new_node)) 5 | - if active != 'create' && active != 'index' 6 | %li{ :class => (active == 'show' ? "active" : '')}= link_to('Show', slice_url(:node, escape_node_id(@node.name))) 7 | %li{ :class => (active == 'edit' ? "active" : '')}= link_to('Edit', slice_url(:edit_node, escape_node_id(@node.name))) 8 | %li= link_to('Delete', slice_url(:node, escape_node_id(@node.name)), :method => "delete", :confirm => "Really delete node #{@node.name}? There is no undo.") 9 | .clear 10 | -------------------------------------------------------------------------------- /features/data/cookbooks/delayed_notifications/recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: delayed_notifications 3 | # Recipe:: default 4 | # 5 | # Copyright 2009, Opscode 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 | -------------------------------------------------------------------------------- /features/data/cookbooks/transfer_remote_files/recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: transfer_remote_files 3 | # Recipe:: default 4 | # 5 | # Copyright 2009, Opscode 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 | -------------------------------------------------------------------------------- /features/steps/request_steps.rb: -------------------------------------------------------------------------------- 1 | When /^I '(.+)' the path '(.+)'$/ do |http_method, request_uri| 2 | begin 3 | self.response = rest.send("#{http_method}_rest".downcase.to_sym, request_uri) 4 | self.inflated_response = self.response 5 | rescue 6 | self.exception = $! 7 | end 8 | end 9 | 10 | When /^I '(.+)' the '(.+)' to the path '(.+)'$/ do |http_method, stash_key, request_uri| 11 | begin 12 | self.response = rest.send("#{http_method}_rest".downcase.to_sym, request_uri, stash[stash_key]) 13 | self.inflated_response = response 14 | rescue 15 | self.exception = $! 16 | end 17 | end 18 | 19 | When /^I authenticate as '(.+)'$/ do |reg| 20 | begin 21 | rest.authenticate(reg, 'tclown') 22 | rescue 23 | self.exception = $! 24 | end 25 | end 26 | 27 | -------------------------------------------------------------------------------- /chef-server/config/rack.rb: -------------------------------------------------------------------------------- 1 | # use PathPrefix Middleware if :path_prefix is set in Merb::Config 2 | if prefix = ::Merb::Config[:path_prefix] 3 | use Merb::Rack::PathPrefix, prefix 4 | end 5 | 6 | # comment this out if you are running merb behind a load balancer 7 | # that serves static files 8 | use Merb::Rack::Static, Merb.dir_for(:public) 9 | 10 | Merb::Slices.config.each do |slice_module, config| 11 | slice_module = Object.full_const_get(slice_module.to_s.camel_case) if slice_module.class.in?(String, Symbol) 12 | slice_module.send("public_components").each do |component| 13 | slice_static_dir = slice_module.send("dir_for", :public) 14 | use Merb::Rack::Static, slice_static_dir 15 | end 16 | end 17 | 18 | # this is our main merb application 19 | run Merb::Rack::Application.new 20 | -------------------------------------------------------------------------------- /chef/lib/chef/application/agent.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: AJ Christensen () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | require 'chef/application' -------------------------------------------------------------------------------- /chef/lib/chef/application/server.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: AJ Christensen () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | require 'chef/application' -------------------------------------------------------------------------------- /features/data/cookbooks/recipe_include/recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: recipe_include 3 | # Recipe:: default 4 | # 5 | # Copyright 2009, Opscode 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 | include_recipe "recipe_include::second" 21 | 22 | -------------------------------------------------------------------------------- /features/data/cookbooks/manage_files/recipes/touch_a_file.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: files 3 | # Recipe:: default 4 | # 5 | # Copyright 2009, Opscode 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 | file "#{node[:tmpdir]}/touch_test.txt" do 21 | action :touch 22 | end -------------------------------------------------------------------------------- /features/data/cookbooks/manage_files/recipes/create_a_file.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: files 3 | # Recipe:: default 4 | # 5 | # Copyright 2009, Opscode 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 | file "#{node[:tmpdir]}/create_a_file.txt" do 21 | action :create 22 | end -------------------------------------------------------------------------------- /chef-server/contrib/el/chef-server.config: -------------------------------------------------------------------------------- 1 | # 2 | # Chef Server Config File 3 | # 4 | 5 | log_level :info 6 | ssl_verify_mode :verify_none 7 | registration_url "http://cserver:4000" 8 | openid_url "http://cserver:4001" 9 | template_url "http://cserver:4000" 10 | remotefile_url "http://cserver:4000" 11 | search_url "http://cserver:4000" 12 | cookbook_path [ "/var/lib/chef/site-cookbooks", "/var/lib/chef/cookbooks" ] 13 | 14 | merb_root "/var/lib/chef/merb" 15 | node_path "/etc/chef/node" 16 | file_store_path "/var/lib/chef/store" 17 | search_index_path "/var/lib/chef/search_index" 18 | openid_store_path "/var/lib/chef/openid/db" 19 | openid_cstore_path "/var/lib/chef/openid/cstore" 20 | file_cache_path "/var/lib/chef/cache" 21 | 22 | Chef::Log::Formatter.show_time = false 23 | -------------------------------------------------------------------------------- /chef-server/public/merb.fcgi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require 'rubygems' 4 | require 'merb-core' 5 | 6 | # this is Merb.root, change this if you have some funky setup. 7 | merb_root = File.expand_path(File.dirname(__FILE__) / '../') 8 | 9 | # If the fcgi process runs as apache, make sure 10 | # we have an inlinedir set for Rubyinline action-args to work 11 | unless ENV["INLINEDIR"] || ENV["HOME"] 12 | tmpdir = merb_root / "tmp" 13 | unless File.directory?(tmpdir) 14 | Dir.mkdir(tmpdir) 15 | end 16 | ENV["INLINEDIR"] = tmpdir 17 | end 18 | 19 | # start merb with the fcgi adapter, add options or change the log dir here 20 | Merb.start(:adapter => 'fcgi', 21 | :merb_root => merb_root, 22 | :log_file => merb_root /'log'/'merb.log') -------------------------------------------------------------------------------- /features/data/cookbooks/transfer_remote_files/recipes/transfer_a_file_from_a_specific_cookbook.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: transfer_remote_files 3 | # Recipe:: default 4 | # 5 | # Copyright 2009, Opscode 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 | transfer_cookbook "from_definition.txt" 21 | -------------------------------------------------------------------------------- /features/data/cookbooks/manage_files/recipes/delete_a_file_that_does_not_already_exist.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: files 3 | # Recipe:: default 4 | # 5 | # Copyright 2009, Opscode 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 | file "#{node[:tmpdir]}/create_a_file.txt" do 21 | action :delete 22 | end -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Chef NOTICE 2 | =========== 3 | 4 | Developed at Opscode (http://www.opscode.com). 5 | 6 | Contributors and Copyright holders: 7 | 8 | * Copyright 2008, Adam Jacob 9 | * Copyright 2008, Arjuna Christensen 10 | * Copyright 2008, Bryan McLellan 11 | * Copyright 2008, Ezra Zygmuntowicz 12 | * Copyright 2009, Sean Cribbs 13 | * Copyright 2009, Christopher Brown 14 | * Copyright 2009, Thom May 15 | * Copyright 2009, Joe Williams 16 | 17 | Chef incorporates code modified from Open4 (http://www.codeforpeople.com/lib/ruby/open4/), which was written by Ara T. Howard. 18 | 19 | Chef incorporates code modified from Merb (http://www.merbivore.com), which is Copyright (c) 2008 Engine Yard. 20 | -------------------------------------------------------------------------------- /features/data/cookbooks/directory_provider/recipes/delete_nonexistent.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: directory_ 3 | # Recipe:: delete_nonexistent 4 | # 5 | # Copyright 2009, Opscode 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 | directory "#{node[:tmpdir]}/particles" do 21 | action :delete 22 | end 23 | 24 | -------------------------------------------------------------------------------- /features/data/cookbooks/execute_commands/recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: execute_commands 3 | # Recipe:: default 4 | # 5 | # Copyright 2009, Opscode 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 | execute "create-mastodon" do 21 | command "echo wewt > #{node[:tmpdir]}/mastodon_rocks" 22 | end 23 | -------------------------------------------------------------------------------- /features/data/cookbooks/manage_files/recipes/set_the_owner_of_a_created_file.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: files 3 | # Recipe:: default 4 | # 5 | # Copyright 2009, Opscode 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 | file "#{node[:tmpdir]}/create_a_file.txt" do 21 | owner 'nobody' 22 | action :create 23 | end -------------------------------------------------------------------------------- /features/data/cookbooks/execute_commands/recipes/umask.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: execute_commands 3 | # Recipe:: umask 4 | # 5 | # Copyright 2009, Opscode 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 | execute "create-mastodon" do 21 | umask '777' 22 | command "echo wewt > /mastodon_rocks_umask" 23 | end 24 | -------------------------------------------------------------------------------- /features/language/recipe_inclusion.feature: -------------------------------------------------------------------------------- 1 | @language @recipe_inclusion 2 | Feature: Recipe Inclusion 3 | In order to encapsulate functionality and re-use it 4 | As a developer 5 | I want to include a recipe from another one 6 | 7 | Scenario: Include a recipe directly 8 | Given a validated node 9 | And it includes the recipe 'recipe_include' 10 | When I run the chef-client 11 | Then the run should exit '0' 12 | And a file named 'fire_once' should contain 'mars_volta' only '1' time 13 | 14 | Scenario: Include a recipe multipe times 15 | Given a validated node 16 | And it includes the recipe 'recipe_include' 17 | And it includes the recipe 'recipe_include::second' 18 | When I run the chef-client 19 | Then the run should exit '0' 20 | And a file named 'fire_once' should contain 'mars_volta' only '1' time 21 | 22 | -------------------------------------------------------------------------------- /chef-server-slice/app/views/nodes/_resource.html.haml: -------------------------------------------------------------------------------- 1 | .resource 2 | %h3= "#{h resource.to_s} (#{resource.class})" 3 | %table 4 | - resource.instance_variables.sort.each do |v| 5 | - attr_name = v.gsub(/\@/, "") 6 | - unless attr_name == "collection" 7 | %tr.attr_group 8 | %td.attr_name 9 | = "#{h attr_name}" 10 | %td.attr_value 11 | - value = resource.instance_variable_get(v) 12 | - if value.kind_of?(String) 13 | = "#{h value}" 14 | - elsif value.kind_of?(Array) 15 | = "#{h value.join(", ")}" 16 | - elsif value.kind_of?(Symbol) 17 | = "#{h value.to_s}" 18 | - elsif attr_name == "actions" 19 | = partial(:action, :actions => value) 20 | - else 21 | = "#{h value.inspect}" 22 | 23 | -------------------------------------------------------------------------------- /features/data/cookbooks/integration_setup/recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: integration_setup 3 | # Recipe:: default 4 | # 5 | # Copyright 2009, Opscode 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 | directory node[:int][:tmpdir] do 21 | owner "root" 22 | mode 1777 23 | action :create 24 | end 25 | 26 | -------------------------------------------------------------------------------- /features/provider/directory/delete_directories.feature: -------------------------------------------------------------------------------- 1 | Feature: Delete Directories 2 | In order to save time 3 | As a Developer 4 | I want to manage directories declaratively 5 | 6 | Scenario: Delete a directory 7 | Given a validated node 8 | And it includes the recipe 'directory_provider::delete' 9 | When I run the chef-client at log level 'info' 10 | Then the run should exit '0' 11 | And a directory named 'particles' should not exist 12 | And 'stdout' should have 'INFO: Deleting directory' 13 | 14 | Scenario: Delete a directory that already does not exist 15 | Given a validated node 16 | And it includes the recipe 'directory_provider::delete_nonexistent' 17 | When I run the chef-client at log level 'info' 18 | Then the run should exit '0' 19 | And 'stdout' should not have 'INFO: Deleting directory' 20 | 21 | -------------------------------------------------------------------------------- /features/data/cookbooks/directory_provider/recipes/create.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: directory_provider 3 | # Recipe:: create 4 | # 5 | # Copyright 2009, Opscode 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 | directory "#{node[:tmpdir]}/isis" do 21 | mode "755" 22 | owner "nobody" 23 | action :create 24 | end 25 | 26 | -------------------------------------------------------------------------------- /features/data/cookbooks/manage_files/recipes/delete_a_file.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: files 3 | # Recipe:: default 4 | # 5 | # Copyright 2009, Opscode 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 | include_recipe 'manage_files::create_a_file' 21 | 22 | file "#{node[:tmpdir]}/create_a_file.txt" do 23 | action :delete 24 | end -------------------------------------------------------------------------------- /features/data/cookbooks/recipe_include/recipes/second.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: recipe_include 3 | # Recipe:: second 4 | # 5 | # Copyright 2009, Opscode 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 | execute "append to #{node[:tmpdir]}/fire_once" do 21 | command "echo mars_volta >> #{node[:tmpdir]}/fire_once" 22 | end 23 | 24 | -------------------------------------------------------------------------------- /features/steps/webrat_steps.rb: -------------------------------------------------------------------------------- 1 | # Commonly used webrat steps 2 | # http://github.com/brynary/webrat 3 | 4 | When /^I go to \/(.*)$/ do |path| 5 | visit path 6 | end 7 | 8 | When /^I press "(.*)"$/ do |button| 9 | click_button(button) 10 | end 11 | 12 | When /^I follow "(.*)"$/ do |link| 13 | click_link(link) 14 | end 15 | 16 | When /^I fill in "(.*)" with "(.*)"$/ do |field, value| 17 | fill_in(field, :with => value) 18 | end 19 | 20 | When /^I select "(.*)" from "(.*)"$/ do |value, field| 21 | select(value, :from => field) 22 | end 23 | 24 | When /^I check "(.*)"$/ do |field| 25 | check(field) 26 | end 27 | 28 | When /^I uncheck "(.*)"$/ do |field| 29 | uncheck(field) 30 | end 31 | 32 | When /^I choose "(.*)"$/ do |field| 33 | choose(field) 34 | end 35 | 36 | When /^I attach the file at "(.*)" to "(.*)" $/ do |path, field| 37 | attach_file(field, path) 38 | end 39 | -------------------------------------------------------------------------------- /chef-server/tasks/merb.thor/utils.rb: -------------------------------------------------------------------------------- 1 | class String 2 | def /(other) 3 | (Pathname.new(self) + other).to_s 4 | end 5 | end 6 | 7 | module ColorfulMessages 8 | 9 | # red 10 | def error(*messages) 11 | puts messages.map { |msg| "\033[1;31m#{msg}\033[0m" } 12 | end 13 | 14 | # yellow 15 | def warning(*messages) 16 | puts messages.map { |msg| "\033[1;33m#{msg}\033[0m" } 17 | end 18 | 19 | # green 20 | def success(*messages) 21 | puts messages.map { |msg| "\033[1;32m#{msg}\033[0m" } 22 | end 23 | 24 | alias_method :message, :success 25 | 26 | # magenta 27 | def note(*messages) 28 | puts messages.map { |msg| "\033[1;35m#{msg}\033[0m" } 29 | end 30 | 31 | # blue 32 | def info(*messages) 33 | puts messages.map { |msg| "\033[1;34m#{msg}\033[0m" } 34 | end 35 | 36 | end 37 | 38 | module ThorUI 39 | extend ColorfulMessages 40 | end 41 | -------------------------------------------------------------------------------- /features/data/cookbooks/integration_setup/attributes/integration.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: integration_setup 3 | # Recipe:: default 4 | # 5 | # Copyright 2009, Opscode 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 'tmpdir' 21 | 22 | int(Mash.new) 23 | int[:tmpdir] = File.join(Dir.tmpdir, "chef_integration") 24 | 25 | tmpdir int[:tmpdir] -------------------------------------------------------------------------------- /features/data/cookbooks/transfer_remote_files/recipes/should_prefer_the_file_for_this_specific_host.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: transfer_remote_files 3 | # Recipe:: default 4 | # 5 | # Copyright 2009, Opscode 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 | remote_file "#{node[:tmpdir]}/host_specific.txt" do 21 | source "host_specific.txt" 22 | end -------------------------------------------------------------------------------- /chef-server-slice/app/views/roles/index.html.haml: -------------------------------------------------------------------------------- 1 | .block#block-tables 2 | .content 3 | %h2.title Roles 4 | .inner 5 | = partial('navigation', :active => 'index') 6 | .content 7 | .inner 8 | %table.table 9 | %tr 10 | %th.first Name 11 | %th Description 12 | %th.last   13 | - even = false; 14 | - @role_list.each do |role| 15 | %tr{ :class => even ? "even" : "odd" } 16 | %td= link_to(role.name, slice_url(:role, role.name)) 17 | %td= role.description 18 | %td 19 | = link_to('Edit', slice_url(:edit_role, role.name)) 20 | | 21 | = link_to('Delete', slice_url(:role, role.name), :method => "delete", :confirm => "Really delete Role #{role.name}? there is no undo.") 22 | - even ? even = false: even = true 23 | -------------------------------------------------------------------------------- /features/data/cookbooks/execute_commands/recipes/debug.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | execute "debug-log" do 20 | command "ruby -e 'puts \"whats up\"; STDERR.puts \"doc!\"'" 21 | end 22 | 23 | -------------------------------------------------------------------------------- /chef-server/lib/tasks/package.rake: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'rake/gempackagetask' 3 | 4 | spec = Gem::Specification.new do |s| 5 | s.name = GEM 6 | s.version = CHEF_SERVER_VERSION 7 | s.platform = Gem::Platform::RUBY 8 | s.has_rdoc = true 9 | s.extra_rdoc_files = ["README.rdoc", "LICENSE" ] 10 | s.summary = SUMMARY 11 | s.description = s.summary 12 | s.author = AUTHOR 13 | s.email = EMAIL 14 | s.homepage = HOMEPAGE 15 | 16 | %w{stomp stompserver ferret 17 | merb-core merb-haml merb-assets 18 | merb-helpers mongrel haml 19 | ruby-openid json syntax}.each { |gem| s.add_dependency gem } 20 | 21 | s.bindir = "bin" 22 | s.executables = %w( chef-server chef-indexer ) 23 | s.files = %w(LICENSE README.rdoc) + Dir.glob("{app,bin,config,lib,public}/**/*") 24 | end 25 | 26 | Rake::GemPackageTask.new(spec) do |pkg| 27 | pkg.gem_spec = spec 28 | end 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /chef-server/tasks/merb.thor/app_script.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | # This was added by Merb's bundler 4 | 5 | require "rubygems" 6 | require File.join(File.dirname(__FILE__), "common") 7 | 8 | gems_dir = File.join(File.dirname(__FILE__), '..', 'gems') 9 | 10 | if File.directory?(gems_dir) 11 | $BUNDLE = true 12 | Gem.clear_paths 13 | Gem.path.replace([File.expand_path(gems_dir)]) 14 | ENV["PATH"] = "#{File.dirname(__FILE__)}:#{ENV["PATH"]}" 15 | 16 | gem_file = File.join(gems_dir, "specifications", "<%= spec.name %>-*.gemspec") 17 | 18 | if local_gem = Dir[gem_file].last 19 | version = File.basename(local_gem)[/-([\.\d]+)\.gemspec$/, 1] 20 | end 21 | end 22 | 23 | version ||= "<%= Gem::Requirement.default %>" 24 | 25 | if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then 26 | version = $1 27 | ARGV.shift 28 | end 29 | 30 | gem '<%= @spec.name %>', version 31 | load '<%= bin_file_name %>' -------------------------------------------------------------------------------- /features/data/cookbooks/transfer_remote_files/recipes/transfer_a_file_from_a_cookbook.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: transfer_remote_files 3 | # Recipe:: default 4 | # 5 | # Copyright 2009, Opscode 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 | remote_file "#{node[:tmpdir]}/transfer_a_file_from_a_cookbook.txt" do 21 | source "transfer_a_file_from_a_cookbook.txt" 22 | end -------------------------------------------------------------------------------- /chef-server-slice/app/helpers/status_helper.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Joe Williams (joe@joetify.com) 3 | # Copyright:: Copyright (c) 2009 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 | require 'chef' / 'node' 19 | 20 | module Merb 21 | module ChefServerSlice 22 | module StatusHelper 23 | end 24 | 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /chef-server-slice/app/views/roles/show.html.haml: -------------------------------------------------------------------------------- 1 | .block#block-tables 2 | .content 3 | %h2.title= "Role #{h @role.name}" 4 | .inner 5 | = partial("navigation", :active => "show") 6 | .content 7 | .inner 8 | .left 9 | %h3 Description 10 | = @role.description 11 | 12 | .left 13 | %h3 Recipes 14 | %table#recipes.table 15 | %tr 16 | %th.first Position 17 | %th.last Name 18 | - @role.recipes.each_index do |i| 19 | %tr 20 | %td.position= i 21 | %td= @role.recipes[i] 22 | .left 23 | %h3 Default Attributes 24 | = build_tree('defattrs', @role.default_attributes) 25 | 26 | .left 27 | %h3 Override Attributes 28 | = build_tree('overattrs', @role.override_attributes) 29 | 30 | -------------------------------------------------------------------------------- /chef/spec/unit/log_spec.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | require 'tempfile' 20 | require 'logger' 21 | require File.expand_path(File.join(File.dirname(__FILE__), "..", "spec_helper")) 22 | 23 | describe Chef::Log do 24 | end -------------------------------------------------------------------------------- /features/data/cookbooks/search/recipes/search_data.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: search 3 | # Recipe:: default 4 | # 5 | # Copyright 2009, Opscode 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 | node.save 21 | sleep 5 22 | search(:node, "*") do |entry| 23 | Chef::Log.error(entry.inspect) 24 | entry["search_files"].each do |filename| 25 | file "#{node[:tmpdir]}/#{filename}" 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /features/data/cookbooks/directory_provider/recipes/delete.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: directory_provider 3 | # Recipe:: delete 4 | # 5 | # Copyright 2009, Opscode 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 | r = directory "#{node[:tmpdir]}/particles" do 21 | action :nothing 22 | end 23 | r.run_action(:create) 24 | 25 | directory "#{node[:tmpdir]}/particles" do 26 | action :delete 27 | end 28 | 29 | 30 | -------------------------------------------------------------------------------- /features/data/cookbooks/transfer_remote_files/recipes/transfer_a_non-existent_file_from_a_cookbook.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: transfer_remote_files 3 | # Recipe:: default 4 | # 5 | # Copyright 2009, Opscode 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 | remote_file "#{node[:tmpdir]}/transfer_a_non-existent_file_from_a_cookbook.txt" do 21 | source "transfer_a_non-existent_file_from_a_cookbook.txt" 22 | end 23 | -------------------------------------------------------------------------------- /chef/bin/chef-client: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # ./chef-client - Run the chef client 4 | # 5 | # Author:: AJ Christensen () 6 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 7 | # License:: Apache License, Version 2.0 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | 21 | $: << File.join(File.dirname(__FILE__), "..", "lib") 22 | 23 | require 'rubygems' 24 | require 'chef/application/client' 25 | 26 | Chef::Application::Client.new.run -------------------------------------------------------------------------------- /chef-server/bin/chef-indexer: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # ./chef-indexer - Run the chef indexer 4 | # 5 | # Author:: AJ Christensen () 6 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 7 | # License:: Apache License, Version 2.0 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | 21 | $: << File.join(File.dirname(__FILE__), "..", "lib") 22 | 23 | require 'rubygems' 24 | require 'chef/application/indexer' 25 | 26 | Chef::Application::Indexer.new.run -------------------------------------------------------------------------------- /chef/spec/unit/chef_spec.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | require File.expand_path(File.join(File.dirname(__FILE__), "..", "spec_helper")) 20 | 21 | describe Chef do 22 | it "should have a version defined" do 23 | Chef::VERSION.should match(/(\d+)\.(\d+)\.(\d+)/) 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /features/data/config/server.rb: -------------------------------------------------------------------------------- 1 | supportdir = File.expand_path(File.join(File.dirname(__FILE__), "..")) 2 | tmpdir = File.expand_path(File.join(File.dirname(__FILE__), "..", "tmp")) 3 | 4 | log_level :debug 5 | log_location STDOUT 6 | file_cache_path File.join(tmpdir, "cache") 7 | ssl_verify_mode :verify_none 8 | registration_url "http://127.0.0.1:4000" 9 | openid_url "http://127.0.0.1:4001" 10 | template_url "http://127.0.0.1:4000" 11 | remotefile_url "http://127.0.0.1:4000" 12 | search_url "http://127.0.0.1:4000" 13 | role_url "http://127.0.0.1:4000" 14 | cookbook_path File.join(supportdir, "cookbooks") 15 | openid_store_path File.join(tmpdir, "openid", "store") 16 | openid_cstore_path File.join(tmpdir, "openid", "cstore") 17 | search_index_path File.join(tmpdir, "search_index") 18 | role_path File.join(supportdir, "roles") 19 | validation_token 'ceelo' 20 | couchdb_database 'chef_integration' 21 | 22 | Chef::Log::Formatter.show_time = true 23 | -------------------------------------------------------------------------------- /chef-server-slice/app/views/openid_server/decide.html.haml: -------------------------------------------------------------------------------- 1 | %form{:method => "post", :action => url(:openid_server_decision)} 2 | %table 3 | %tr 4 | %td Site: 5 | %td= @oidreq.trust_root 6 | - if @oidreq.id_select 7 | %tr 8 | %td{:colspan => "2"} 9 | You entered the server identifier at the relying party. 10 | You will need to send an identifier of your choosing. 11 | Enter a username and password below. 12 | %tr 13 | %td Identity to send: 14 | %td 15 | %input{:type => "text", :name => "id_to_send", :size => "25"} 16 | - else 17 | %tr 18 | %td Identity: 19 | %td= @oidreq.identity 20 | %tr 21 | %td 22 | %label{:for => "password"} Password: 23 | %td 24 | %input{:type => "password", :name => "password"} 25 | %input{:type => "submit", :name => "submit", :value => "Authenticate"} 26 | %input{:type => "submit", :name => "cancel", :value => "Cancel"} 27 | 28 | -------------------------------------------------------------------------------- /chef-server/config/init.rb: -------------------------------------------------------------------------------- 1 | # Go to http://wiki.merbivore.com/pages/init-rb 2 | 3 | require 'config/dependencies.rb' 4 | unless defined?(Chef) 5 | gem "chef", "=" + CHEF_SERVER_VERSION if CHEF_SERVER_VERSION 6 | require 'chef' 7 | end 8 | 9 | use_test :rspec 10 | use_template_engine :haml 11 | 12 | Merb::Config.use do |c| 13 | c[:use_mutex] = false 14 | c[:session_id_key] = '_chef_server_session_id' 15 | c[:session_secret_key] = Chef::Config.manage_secret_key 16 | c[:session_store] = 'cookie' 17 | c[:exception_details] = true 18 | c[:reload_classes] = false 19 | c[:log_level] = Chef::Config[:log_level] 20 | c[:log_stream] = Chef::Config[:log_location] 21 | end 22 | 23 | Merb::BootLoader.before_app_loads do 24 | # This will get executed after dependencies have been loaded but before your app's classes have loaded. 25 | end 26 | 27 | Merb::BootLoader.after_app_loads do 28 | # This will get executed after your app's classes have been loaded. 29 | OpenID::Util.logger = Merb.logger 30 | end 31 | -------------------------------------------------------------------------------- /chef/bin/chef-solo: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # ./chef-solo - Run the chef client, in stand-alone mode 4 | # 5 | # Author:: AJ Christensen () 6 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 7 | # License:: Apache License, Version 2.0 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | 21 | $: << File.join(File.dirname(__FILE__), "..", "lib") 22 | 23 | require 'rubygems' 24 | require 'chef/application/solo' 25 | 26 | Chef::Application::Solo.new.run 27 | -------------------------------------------------------------------------------- /features/api/nodes/show_node_api.feature: -------------------------------------------------------------------------------- 1 | @api @nodes @nodes_show 2 | Feature: Show a node via the REST API 3 | In order to know what the details are for a node 4 | As a Developer 5 | I want to show the details for a specific node 6 | 7 | Scenario: Show a node 8 | Given a 'registration' named 'bobo' exists 9 | And a 'node' named 'webserver' exists 10 | When I authenticate as 'bobo' 11 | And I 'GET' the path '/nodes/webserver' 12 | Then the inflated response should respond to 'name' with 'webserver' 13 | 14 | Scenario: Show a missing node 15 | Given a 'registration' named 'bobo' exists 16 | And there are no nodes 17 | When I authenticate as 'bobo' 18 | And I 'GET' the path '/nodes/bobo' 19 | Then I should get a '404 "Not Found"' exception 20 | 21 | Scenario: Show a node without authenticating 22 | Given a 'node' named 'webserver' exists 23 | And I 'GET' the path '/nodes/webserver' 24 | Then I should get a '401 "Unauthorized"' exception 25 | 26 | -------------------------------------------------------------------------------- /features/data/cookbooks/execute_commands/recipes/4k.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | execute "create-4k-file" do 20 | command "dd if=/dev/random of=#{node[:tmpdir]}/execute-4k.txt bs=1024 count=5" 21 | end 22 | 23 | execute "read-4k-file" do 24 | command "cat #{node[:tmpdir]}/execute-4k.txt" 25 | end 26 | -------------------------------------------------------------------------------- /features/api/nodes/delete_node_api.feature: -------------------------------------------------------------------------------- 1 | @api @nodes @nodes_delete 2 | Feature: Delete a node via the REST API 3 | In order to remove a node 4 | As a Developer 5 | I want to delete a node via the REST API 6 | 7 | Scenario: Delete a node 8 | Given a 'registration' named 'bobo' exists 9 | And a 'node' named 'webserver' exists 10 | When I authenticate as 'bobo' 11 | And I 'DELETE' the path '/nodes/webserver' 12 | Then the inflated response should respond to 'name' with 'webserver' 13 | 14 | Scenario: Delete a node that does not exist 15 | Given a 'registration' named 'bobo' exists 16 | And there are no nodes 17 | When I authenticate as 'bobo' 18 | When I 'DELETE' the path '/nodes/webserver' 19 | Then I should get a '404 "Not Found"' exception 20 | 21 | Scenario: Delete a node without authenticating 22 | Given a 'node' named 'webserver' 23 | When I 'DELETE' the path '/nodes/webserver' 24 | Then I should get a '401 "Unauthorized"' exception 25 | 26 | -------------------------------------------------------------------------------- /features/api/roles/delete_role_api.feature: -------------------------------------------------------------------------------- 1 | @api @roles @roles_delete 2 | Feature: Delete a Role via the REST API 3 | In order to remove a role 4 | As a Developer 5 | I want to delete a role via the REST API 6 | 7 | Scenario: Delete a Role 8 | Given a 'registration' named 'bobo' exists 9 | And a 'role' named 'webserver' exists 10 | When I authenticate as 'bobo' 11 | And I 'DELETE' the path '/roles/webserver' 12 | Then the inflated response should respond to 'name' with 'webserver' 13 | 14 | Scenario: Delete a Role that does not exist 15 | Given a 'registration' named 'bobo' exists 16 | And there are no roles 17 | When I authenticate as 'bobo' 18 | When I 'DELETE' the path '/roles/webserver' 19 | Then I should get a '404 "Not Found"' exception 20 | 21 | Scenario: Delete a Role without authenticating 22 | Given a 'role' named 'webserver' 23 | When I 'DELETE' the path '/roles/webserver' 24 | Then I should get a '401 "Unauthorized"' exception 25 | 26 | -------------------------------------------------------------------------------- /features/api/roles/show_roles_api.feature: -------------------------------------------------------------------------------- 1 | @api @roles @roles_show 2 | Feature: Show a role via the REST API 3 | In order to know what the details are for a Role 4 | As a Developer 5 | I want to show the details for a specific Role 6 | 7 | Scenario: Show a role 8 | Given a 'registration' named 'bobo' exists 9 | And a 'role' named 'webserver' exists 10 | When I authenticate as 'bobo' 11 | And I 'GET' the path '/roles/webserver' 12 | Then the inflated response should respond to 'name' with 'webserver' 13 | 14 | Scenario: Show a missing role 15 | Given a 'registration' named 'bobo' exists 16 | And there are no roles 17 | When I authenticate as 'bobo' 18 | And I 'GET' the path '/roles/bobo' 19 | Then I should get a '404 "Not Found"' exception 20 | 21 | Scenario: Show a role without authenticating 22 | Given a 'role' named 'webserver' exists 23 | And I 'GET' the path '/roles/webserver' 24 | Then I should get a '401 "Unauthorized"' exception 25 | 26 | 27 | -------------------------------------------------------------------------------- /chef-server-slice/app/helpers/openid_server_helpers.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | module Merb 20 | module ChefServerSlice 21 | module OpenidServerHelper 22 | 23 | def url_for_user 24 | url(:openid_node, :username => session[:username]) 25 | end 26 | 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /chef-server/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require "rubygems" 2 | 3 | # Add the local gems dir if found within the app root; any dependencies loaded 4 | # hereafter will try to load from the local gems before loading system gems. 5 | if (local_gem_dir = File.join(File.dirname(__FILE__), '..', 'gems')) && $BUNDLE.nil? 6 | $BUNDLE = true; Gem.clear_paths; Gem.path.unshift(local_gem_dir) 7 | end 8 | 9 | require "merb-core" 10 | require "spec" # Satisfies Autotest and anyone else not using the Rake tasks 11 | 12 | # this loads all plugins required in your init file so don't add them 13 | # here again, Merb will do it for you 14 | Merb.start_environment(:testing => true, :adapter => 'runner', :environment => ENV['MERB_ENV'] || 'test') 15 | 16 | Spec::Runner.configure do |config| 17 | config.include(Merb::Test::ViewHelper) 18 | config.include(Merb::Test::RouteHelper) 19 | config.include(Merb::Test::ControllerHelper) 20 | 21 | config.before(:all) do 22 | DataMapper.auto_migrate! if Merb.orm == :datamapper 23 | end 24 | 25 | end 26 | -------------------------------------------------------------------------------- /chef-server-slice/app/helpers/search_helper.rb: -------------------------------------------------------------------------------- 1 | module Merb 2 | module ChefServerSlice 3 | module SearchHelper 4 | def output_path(attributes) 5 | res = Hash.new 6 | attributes.each do |path| 7 | parts = path.split("/") 8 | unless parts[0].nil? 9 | parts.shift if parts[0].length == 0 10 | end 11 | res[path] = ohai_walk(parts) 12 | end 13 | res 14 | end 15 | 16 | def ohai_walk(path) 17 | unless path[0] 18 | @@ohai.to_json 19 | else 20 | ohai_walk_r(@@ohai, path) 21 | end 22 | end 23 | 24 | def ohai_walk_r(ohai, path) 25 | hop = (ohai.is_a?(Array) ? path.shift.to_i : path.shift) 26 | if ohai[hop] 27 | if path[0] 28 | ohai_walk_r(ohai[hop], path) 29 | else 30 | ohai[hop].to_json 31 | end 32 | else 33 | nil 34 | end 35 | end 36 | end 37 | end 38 | end # Merb 39 | -------------------------------------------------------------------------------- /features/data/cookbooks/delayed_notifications/recipes/notify_a_resource_from_a_single_source.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: delayed_notifications 3 | # Recipe:: notify_a_resource_from_a_single_source 4 | # 5 | # Copyright 2009, Opscode 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 | file "#{node[:tmpdir]}/notified_file.txt" do 21 | action :nothing 22 | end 23 | 24 | execute "echo foo" do 25 | notifies :create, resources("file[#{node[:tmpdir]}/notified_file.txt]"), :delayed 26 | end -------------------------------------------------------------------------------- /features/provider/package/macports.feature: -------------------------------------------------------------------------------- 1 | @provider @package @macports 2 | Feature: Macports integration 3 | In order to easily manage my OS X machines 4 | As a Developer 5 | I want to manage packages installed on OS X machines 6 | 7 | Scenario Outline: OS X package management 8 | Given that I have the MacPorts package system installed 9 | When I run chef-solo with the '' recipe 10 | Then the run should exit '' 11 | And there be a binary on the path called '' 12 | 13 | Examples: 14 | | recipe | binary | should | exitcode | 15 | | packages::macports_install_yydecode | yydecode | should | 0 | 16 | | packages::macports_remove_yydecode | yydecode | should not | 0 | 17 | | packages::macports_upgrade_yydecode | yydecode | should | 0 | 18 | | packages::macports_purge_yydecode | yydecode | should not | 0 | 19 | | packages::macports_install_bad_package | fdsafdsa | should not | 1 | 20 | -------------------------------------------------------------------------------- /features/chef-client/cookbook_sync.feature: -------------------------------------------------------------------------------- 1 | @client 2 | Feature: Synchronize cookbooks from the server 3 | In order to configure a system according to a centralized repository 4 | As an Administrator 5 | I want to synchronize cookbooks to the edge nodes 6 | 7 | Scenario: Synchronize specific cookbooks 8 | Given a validated node 9 | And it includes the recipe 'synchronize' 10 | When I run the chef-client with '-l info' 11 | Then the run should exit '0' 12 | And 'stdout' should have 'INFO: Storing updated cookbooks/synchronize/recipes/default.rb in the cache.' 13 | 14 | Scenario: Synchronize dependent cookbooks 15 | Given a validated node 16 | And it includes the recipe 'synchronize_deps' 17 | When I run the chef-client with '-l info' 18 | Then the run should exit '0' 19 | And 'stdout' should have 'INFO: Storing updated cookbooks/synchronize_deps/recipes/default.rb in the cache.' 20 | And 'stdout' should have 'INFO: Storing updated cookbooks/synchronize/recipes/default.rb in the cache.' 21 | 22 | -------------------------------------------------------------------------------- /features/cookbooks/metadata.feature: -------------------------------------------------------------------------------- 1 | @cookbooks 2 | Feature: Cookbook Metadata 3 | In order to understand cookbooks without evaluating them 4 | As an Administrator 5 | I want to automatically generate metadata about cookbooks 6 | 7 | Scenario: Generate metadata for all cookbooks 8 | Given a local cookbook repository 9 | When I run the rake task to generate cookbook metadata 10 | Then the run should exit '0' 11 | And 'stdout' should have 'Generating metadata for metadata' 12 | And 'stdout' should have 'Generating metadata for execute_commands' 13 | And a file named 'cookbooks_dir/cookbooks/metadata/metadata.json' should exist 14 | 15 | Scenario: Generate metadata for a specific cookbook 16 | Given a local cookbook repository 17 | When I run the rake task to generate cookbook metadata for 'metadata' 18 | Then the run should exit '0' 19 | And 'stdout' should have 'Generating metadata for metadata' 20 | And a file named 'cookbooks_dir/cookbooks/metadata/metadata.json' should exist 21 | 22 | -------------------------------------------------------------------------------- /chef/spec/lib/chef/provider/easy.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | class Chef 20 | class Provider 21 | class Easy < Chef::Provider 22 | def load_current_resource 23 | true 24 | end 25 | 26 | def action_sell 27 | true 28 | end 29 | 30 | def action_buy 31 | true 32 | end 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /chef/spec/lib/chef/provider/snakeoil.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | class Chef 20 | class Provider 21 | class SnakeOil < Chef::Provider 22 | def load_current_resource 23 | true 24 | end 25 | 26 | def action_sell 27 | true 28 | end 29 | 30 | def action_buy 31 | true 32 | end 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /features/api/nodes/create_node_api.feature: -------------------------------------------------------------------------------- 1 | @api @nodes @nodes_create 2 | Feature: Create a node via the REST API 3 | In order to create nodes programatically 4 | As a Devleoper 5 | I want to create nodes via the REST API 6 | 7 | Scenario: Create a new node 8 | Given a 'registration' named 'bobo' exists 9 | And a 'node' named 'webserver' 10 | When I authenticate as 'bobo' 11 | And I 'POST' the 'node' to the path '/nodes' 12 | And the inflated responses key 'uri' should match '^http://.+/nodes/webserver$' 13 | 14 | Scenario: Create a node that already exists 15 | Given a 'registration' named 'bobo' exists 16 | And an 'node' named 'webserver' 17 | When I authenticate as 'bobo' 18 | And I 'POST' the 'node' to the path '/nodes' 19 | And I 'POST' the 'node' to the path '/nodes' 20 | Then I should get a '403 "Forbidden"' exception 21 | 22 | Scenario: Create a new node without authenticating 23 | Given a 'node' named 'webserver' 24 | When I 'POST' the 'node' to the path '/nodes' 25 | Then I should get a '401 "Unauthorized"' exception 26 | -------------------------------------------------------------------------------- /features/api/roles/create_role_api.feature: -------------------------------------------------------------------------------- 1 | @api @roles @roles_create 2 | Feature: Create a role via the REST API 3 | In order to create roles programatically 4 | As a Devleoper 5 | I want to create roles via the REST API 6 | 7 | Scenario: Create a new role 8 | Given a 'registration' named 'bobo' exists 9 | And a 'role' named 'webserver' 10 | When I authenticate as 'bobo' 11 | And I 'POST' the 'role' to the path '/roles' 12 | And the inflated responses key 'uri' should match '^http://.+/roles/webserver$' 13 | 14 | Scenario: Create a role that already exists 15 | Given a 'registration' named 'bobo' exists 16 | And an 'role' named 'webserver' 17 | When I authenticate as 'bobo' 18 | And I 'POST' the 'role' to the path '/roles' 19 | And I 'POST' the 'role' to the path '/roles' 20 | Then I should get a '403 "Forbidden"' exception 21 | 22 | Scenario: Create a new role without authenticating 23 | Given a 'role' named 'webserver' 24 | When I 'POST' the 'role' to the path '/roles' 25 | Then I should get a '401 "Unauthorized"' exception 26 | 27 | -------------------------------------------------------------------------------- /chef/lib/chef/resource/bash.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | require 'chef/resource/script' 20 | 21 | class Chef 22 | class Resource 23 | class Bash < Chef::Resource::Script 24 | 25 | def initialize(name, collection=nil, node=nil) 26 | super(name, collection, node) 27 | @resource_name = :bash 28 | @interpreter = "bash" 29 | end 30 | 31 | end 32 | end 33 | end -------------------------------------------------------------------------------- /chef/lib/chef/resource/csh.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | require 'chef/resource/script' 20 | 21 | class Chef 22 | class Resource 23 | class Csh < Chef::Resource::Script 24 | 25 | def initialize(name, collection=nil, node=nil) 26 | super(name, collection, node) 27 | @resource_name = :csh 28 | @interpreter = "csh" 29 | end 30 | 31 | end 32 | end 33 | end -------------------------------------------------------------------------------- /chef/lib/chef/resource/perl.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | require 'chef/resource/script' 20 | 21 | class Chef 22 | class Resource 23 | class Perl < Chef::Resource::Script 24 | 25 | def initialize(name, collection=nil, node=nil) 26 | super(name, collection, node) 27 | @resource_name = :perl 28 | @interpreter = "perl" 29 | end 30 | 31 | end 32 | end 33 | end -------------------------------------------------------------------------------- /chef/lib/chef/resource/python.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | require 'chef/resource/script' 20 | 21 | class Chef 22 | class Resource 23 | class Python < Chef::Resource::Script 24 | 25 | def initialize(name, collection=nil, node=nil) 26 | super(name, collection, node) 27 | @resource_name = :python 28 | @interpreter = "python" 29 | end 30 | 31 | end 32 | end 33 | end -------------------------------------------------------------------------------- /chef/lib/chef/resource/ruby.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | require 'chef/resource/script' 20 | 21 | class Chef 22 | class Resource 23 | class Ruby < Chef::Resource::Script 24 | 25 | def initialize(name, collection=nil, node=nil) 26 | super(name, collection, node) 27 | @resource_name = :ruby 28 | @interpreter = "ruby" 29 | end 30 | 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /chef/lib/chef/resource/macports_package.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: David Balatero () 3 | # Copyright:: Copyright (c) 2009 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 Resource 21 | class MacportsPackage < Chef::Resource::Package 22 | def initialize(name, collection = nil, node = nil) 23 | super(name, collection, node) 24 | @resource_name = :macports_package 25 | @provider = Chef::Provider::Package::Macports 26 | end 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /chef/lib/chef/mixin/checksum.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | require 'digest/sha2' 20 | 21 | class Chef 22 | module Mixin 23 | module Checksum 24 | 25 | def checksum(file) 26 | digest = Digest::SHA256.new 27 | fh = ::File.open(file) 28 | fh.each do |line| 29 | digest.update(line) 30 | end 31 | digest.hexdigest 32 | end 33 | 34 | end 35 | end 36 | end -------------------------------------------------------------------------------- /chef/lib/chef/mixin/check_helper.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | class Chef 19 | module Mixin 20 | module CheckHelper 21 | def set_if_args(thing, arguments) 22 | raise ArgumentError, "Must call set_if_args with a block!" unless Kernel.block_given? 23 | if arguments != nil 24 | yield(arguments) 25 | else 26 | thing 27 | end 28 | end 29 | end 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /features/data/cookbooks/delayed_notifications/recipes/notify_a_resource_from_multiple_sources.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: delayed_notifications 3 | # Recipe:: notify_a_resource_from_multiple_sources 4 | # 5 | # Copyright 2009, Opscode 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 | execute "bob dylan" do 21 | command "echo 'bob dylan' >> #{node[:tmpdir]}/notified_file.txt" 22 | action :nothing 23 | end 24 | 25 | execute "echo foo" do 26 | notifies :run, resources("execute[bob dylan]"), :delayed 27 | end 28 | 29 | execute "echo bar" do 30 | notifies :run, resources("execute[bob dylan]"), :delayed 31 | end 32 | -------------------------------------------------------------------------------- /chef-server-slice/app/views/nodes/index.html.haml: -------------------------------------------------------------------------------- 1 | .block#block-tables 2 | .content 3 | %h2.title Node List 4 | .inner 5 | = partial('navigation', :active => 'index') 6 | .content 7 | .inner 8 | %table.table 9 | %tr 10 | %th.first{:colspan => 2} Name 11 | %th   12 | %th.last   13 | - even = false 14 | - if @node_list.empty? 15 | %td{:colspan => 4}= "You appear to have no nodes - try connecting one, or validating an existing #{link_to('registration', slice_url(:registrations))}" 16 | - else 17 | - @node_list.each do |node| 18 | %tr{:class => even ? "even": "odd" } 19 | %td{:colspan => 2}= link_to node, slice_url(:node, { :id => escape_node_id(node) } ) 20 | %td 21 | = link_to('Edit', slice_url(:edit_node, escape_node_id(node))) 22 | | 23 | = link_to('Delete', slice_url(:node, escape_node_id(node)), :method => "delete", :confirm => "Really delete Node #{node}? There is no undo.") 24 | - even ? even = false: even = true 25 | 26 | -------------------------------------------------------------------------------- /features/steps/recipe_steps.rb: -------------------------------------------------------------------------------- 1 | Given /^the cookbook has a '(.+)' named '(.+)' in the '(.+)' specific directory$/ do |file_type, filename, specificity| 2 | cookbook_name, recipe_name = recipe.split('::') 3 | type_dir = file_type == 'file' ? 'files' : 'templates' 4 | specific_dir = nil 5 | case specificity 6 | when "host" 7 | specific_dir = "host-#{client.node[:fqdn]}" 8 | when "platform-version" 9 | specific_dir = "#{client.node[:platform]}-#{client.node[:platform_version]}" 10 | when "platform" 11 | specific_dir = client.node[:platform] 12 | when "default" 13 | specific_dir = "default" 14 | end 15 | new_file_dir = File.expand_path( 16 | File.join( 17 | File.dirname(__FILE__), 18 | "..", 19 | "data", 20 | "cookbooks", 21 | cookbook_name, 22 | type_dir, 23 | specific_dir 24 | ) 25 | ) 26 | cleanup_dirs << new_file_dir unless new_file_dir =~ /default$/ 27 | system("mkdir -p #{new_file_dir}") 28 | new_file_name = File.join(new_file_dir, filename) 29 | cleanup_files << new_file_name 30 | new_file = File.open(new_file_name, "w") 31 | new_file.puts(specificity) 32 | new_file.close 33 | end 34 | -------------------------------------------------------------------------------- /chef-server-slice/app/controllers/status.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Joe Williams (joe@joetify.com) 3 | # Copyright:: Copyright (c) 2009 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | require 'chef' / 'node' 20 | 21 | class ChefServerSlice::Status < ChefServerSlice::Application 22 | 23 | provides :html, :json 24 | before :login_required 25 | 26 | def index 27 | @status = Chef::CouchDB.new.get_view("nodes", "status")["rows"].inject([]) do |result, item| 28 | result << item["value"] 29 | result 30 | end 31 | display @status 32 | end 33 | 34 | end 35 | -------------------------------------------------------------------------------- /chef/lib/chef/resource/portage_package.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | require 'chef/resource/package' 20 | 21 | class Chef 22 | class Resource 23 | class PortagePackage < Chef::Resource::Package 24 | 25 | def initialize(name, collection=nil, node=nil) 26 | super(name, collection, node) 27 | @resource_name = :portage_package 28 | @provider = Chef::Provider::Package::Portage 29 | end 30 | 31 | end 32 | end 33 | end -------------------------------------------------------------------------------- /chef-server-slice/app/helpers/cookbooks_helper.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | module Merb 20 | module ChefServerSlice 21 | module CookbooksHelper 22 | def syntax_highlight(code) 23 | converter = Syntax::Convertors::HTML.for_syntax "ruby" 24 | if File.exists?(code) 25 | converter.convert(File.read(code), false) 26 | else 27 | converter.convert(code, false) 28 | end 29 | end 30 | end 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /chef/lib/chef/resource/apt_package.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | require 'chef/resource/package' 20 | require 'chef/provider/package/apt' 21 | 22 | class Chef 23 | class Resource 24 | class AptPackage < Chef::Resource::Package 25 | 26 | def initialize(name, collection=nil, node=nil) 27 | super(name, collection, node) 28 | @resource_name = :apt_package 29 | @provider = Chef::Provider::Package::Apt 30 | end 31 | 32 | end 33 | end 34 | end -------------------------------------------------------------------------------- /chef/lib/chef/resource/dpkg_package.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | require 'chef/resource/package' 20 | require 'chef/provider/package/dpkg' 21 | 22 | class Chef 23 | class Resource 24 | class DpkgPackage < Chef::Resource::Package 25 | 26 | def initialize(name, collection=nil, node=nil) 27 | super(name, collection, node) 28 | @resource_name = :dpkg_package 29 | @provider = Chef::Provider::Package::Dpkg 30 | end 31 | 32 | end 33 | end 34 | end -------------------------------------------------------------------------------- /chef-server-slice/app/controllers/exceptions.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Author:: Christopher Brown () 4 | # Copyright:: Copyright (c) 2008 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 | class ChefServerSlice::Exceptions < ChefServerSlice::Application 21 | 22 | provides :html, :json 23 | 24 | def standard_error 25 | Merb.logger.warn(request.content_type) 26 | if request.accept =~ /application\/json/ 27 | display({ "error" => request.exceptions }) 28 | else 29 | raise request.exceptions.first 30 | end 31 | end 32 | 33 | end 34 | -------------------------------------------------------------------------------- /features/api/nodes/update_node_api.feature: -------------------------------------------------------------------------------- 1 | @api @nodes @nodes_update 2 | Feature: Update a node 3 | In order to keep my node data up-to-date 4 | As a Developer 5 | I want to update my node via the API 6 | 7 | Scenario Outline: Update a node 8 | Given a 'registration' named 'bobo' exists 9 | And a 'node' named 'webserver' exists 10 | And sending the method '' to the 'node' with '' 11 | When I authenticate as 'bobo' 12 | When I 'PUT' the 'node' to the path '/nodes/webserver' 13 | Then the inflated response should respond to '' with '' 14 | When I 'GET' the path '/nodes/webserver' 15 | Then the inflated response should respond to '' with '' 16 | 17 | Examples: 18 | | method | updated_value | 19 | | run_list | [ "recipe[one]", "recipe[two]" ] | 20 | | snakes | really arent so bad | 21 | 22 | Scenario: Update a node without authenticating 23 | Given a 'node' named 'webserver' 24 | And sending the method 'snakes' to the 'node' with 'night train' 25 | When I 'PUT' the 'node' to the path '/nodes/webserver' 26 | Then I should get a '401 "Unauthorized"' exception 27 | 28 | -------------------------------------------------------------------------------- /features/data/cookbooks/delayed_notifications/recipes/notify_different_resources_for_different_actions.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: delayed_notifications 3 | # Recipe:: notify_different_resources_for_different_actions 4 | # 5 | # Copyright 2009, Opscode 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 | file "#{node[:tmpdir]}/notified_file_2.txt" do 21 | action :nothing 22 | end 23 | 24 | file "#{node[:tmpdir]}/notified_file_3.txt" do 25 | action :nothing 26 | end 27 | 28 | execute "echo foo" do 29 | notifies([{resources("file[#{node[:tmpdir]}/notified_file_2.txt]") => [:create, :delayed]}, 30 | {resources("file[#{node[:tmpdir]}/notified_file_3.txt]") => [:create, :delayed]}]) 31 | end 32 | -------------------------------------------------------------------------------- /features/steps/couchdb_steps.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | Before do 20 | system("mkdir -p #{tmpdir}") 21 | cdb = Chef::CouchDB.new(Chef::Config[:couchdb_url]) 22 | cdb.create_db 23 | Chef::Node.create_design_document 24 | Chef::Role.create_design_document 25 | Chef::Role.sync_from_disk_to_couchdb 26 | Chef::OpenIDRegistration.create_design_document 27 | end 28 | 29 | After do 30 | r = Chef::REST.new(Chef::Config[:couchdb_url]) 31 | r.delete_rest("#{Chef::Config[:couchdb_database]}/") 32 | system("rm -rf #{tmpdir}") 33 | end 34 | -------------------------------------------------------------------------------- /chef/lib/chef/log.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Author:: AJ Christensen (<@aj@opsocde.com>) 4 | # Copyright:: Copyright (c) 2008 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 | require 'chef' 20 | require 'mixlib/log' 21 | 22 | class Chef 23 | class Log 24 | extend Mixlib::Log 25 | 26 | # This is here for compatability, before we moved to 27 | # Mixlib::Log. 28 | class Formatter 29 | def self.show_time=(arg) 30 | Mixlib::Log::Formatter.show_time = arg 31 | end 32 | 33 | def self.show_time 34 | Mixlib::Log::Formatter.show_time 35 | end 36 | end 37 | end 38 | end 39 | 40 | -------------------------------------------------------------------------------- /features/data/Rakefile: -------------------------------------------------------------------------------- 1 | # 2 | # Rakefile for Chef Server Repository 3 | # 4 | # Author:: Adam Jacob () 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 | 21 | $: << File.join(File.dirname(__FILE__), "..", "..", "chef", "lib") 22 | 23 | require 'rubygems' 24 | require 'chef' 25 | require 'json' 26 | 27 | # Make sure you have loaded constants first 28 | require File.join(File.dirname(__FILE__), 'config', 'rake') 29 | 30 | # And choosen a VCS 31 | if File.directory?(File.join(TOPDIR, ".svn")) 32 | $vcs = :svn 33 | elsif File.directory?(File.join(TOPDIR, ".git")) 34 | $vcs = :git 35 | end 36 | 37 | load 'chef/tasks/chef_repo.rake' 38 | 39 | -------------------------------------------------------------------------------- /chef-server-slice/app/helpers/global_helpers.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | module Merb 20 | module ChefServerSlice 21 | 22 | module GlobalHelpers 23 | # helpers defined here available to all views. 24 | def resource_collection(collection) 25 | html = "
    " 26 | collection.each do |resource| 27 | html << "
  • #{resource.class}
  • " 28 | end 29 | html << "
" 30 | html 31 | end 32 | 33 | def node_escape(node) 34 | node.gsub(/\./, '_') 35 | end 36 | 37 | end 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /features/data/cookbooks/transfer_remote_files/recipes/change_remote_file_perms_trickery.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: change_remote_file_perms_trickery 3 | # Recipe:: default 4 | # 5 | # Copyright 2009, Opscode 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 | # The "trickery" comes from the fact that chef waits until all Resources are defined before actually 21 | 22 | r = remote_file "#{node[:tmpdir]}/transfer_a_file_from_a_cookbook.txt" do 23 | source "transfer_a_file_from_a_cookbook.txt" 24 | mode 0600 25 | action :nothing 26 | end 27 | # This creates the file out-of-band () 28 | r.run_action(:create) 29 | 30 | remote_file "#{node[:tmpdir]}/transfer_a_file_from_a_cookbook.txt" do 31 | source "transfer_a_file_from_a_cookbook.txt" 32 | mode 0644 33 | end 34 | -------------------------------------------------------------------------------- /features/api/roles/update_roles_api.feature: -------------------------------------------------------------------------------- 1 | @api @roles @roles_update 2 | Feature: Update a role 3 | In order to keep my role data up-to-date 4 | As a Developer 5 | I want to update my role via the API 6 | 7 | Scenario Outline: Update a role 8 | Given a 'registration' named 'bobo' exists 9 | And a 'role' named 'webserver' exists 10 | And sending the method '' to the 'role' with '' 11 | When I authenticate as 'bobo' 12 | When I 'PUT' the 'role' to the path '/roles/webserver' 13 | Then the inflated response should respond to '' with '' 14 | When I 'GET' the path '/roles/webserver' 15 | Then the inflated response should respond to '' with '' 16 | 17 | Examples: 18 | | method | updated_value | 19 | | description | gorilla | 20 | | recipes | [ "one", "two" ] | 21 | | default_attributes | { "a": "d" } | 22 | | override_attributes | { "c": "e" } | 23 | 24 | Scenario: Update a role without authenticating 25 | Given a 'role' named 'webserver' 26 | And sending the method 'description' to the 'role' with 'Is easy' 27 | When I 'PUT' the 'role' to the path '/roles/webserver' 28 | Then I should get a '401 "Unauthorized"' exception 29 | 30 | -------------------------------------------------------------------------------- /features/language/delayed_notifications.feature: -------------------------------------------------------------------------------- 1 | Feature: Delayed Notifications 2 | In order to not impact the system we are configuring unduly 3 | As a developer 4 | I want to be able to trigger an action on a resource only at the end of a run 5 | 6 | Scenario: Notify a resource from a single source 7 | Given a validated node 8 | And it includes the recipe 'delayed_notifications::notify_a_resource_from_a_single_source' 9 | When I run the chef-client 10 | Then the run should exit '0' 11 | And a file named 'notified_file.txt' should exist 12 | 13 | Scenario: Notify a resource from multiple sources 14 | Given a validated node 15 | And it includes the recipe 'delayed_notifications::notify_a_resource_from_multiple_sources' 16 | When I run the chef-client 17 | Then the run should exit '0' 18 | And a file named 'notified_file.txt' should contain 'bob dylan' only '1' time 19 | 20 | Scenario: Notify different resources for different actions 21 | Given a validated node 22 | And it includes the recipe 'delayed_notifications::notify_different_resources_for_different_actions' 23 | When I run the chef-client 24 | Then the run should exit '0' 25 | And a file named 'notified_file_2.txt' should exist 26 | And a file named 'notified_file_3.txt' should exist 27 | 28 | -------------------------------------------------------------------------------- /chef/lib/chef/mixin/deep_merge.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2009 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 | class Chef 19 | module Mixin 20 | class DeepMerge 21 | def self.merge(first, second) 22 | first = first.to_hash if first.kind_of?(Mash) 23 | second = second.to_hash if second.kind_of?(Mash) 24 | # Originally From: http://www.ruby-forum.com/topic/142809 25 | # Author: Stefan Rusterholz 26 | merger = proc do |key,v1,v2| 27 | v1.respond_to?(:keys) && v2.respond_to?(:keys) ? v1.merge(v2, &merger) : v2 28 | end 29 | 30 | Mash.new(first.merge(second, &merger)) 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /chef/spec/lib/chef/resource/cat.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | class Chef 20 | class Resource 21 | class Cat < Chef::Resource 22 | 23 | attr_accessor :action 24 | 25 | def initialize(name, collection=nil, node=nil) 26 | @resource_name = :cat 27 | super(name, collection, node) 28 | @action = "sell" 29 | end 30 | 31 | def pretty_kitty(arg=nil) 32 | set_if_args(@pretty_kitty, arg) do 33 | case arg 34 | when true, false 35 | @pretty_kitty = arg 36 | end 37 | end 38 | end 39 | end 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /chef/lib/chef/provider.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | class Chef 20 | class Provider 21 | 22 | attr_accessor :node, :new_resource, :current_resource 23 | 24 | def initialize(node, new_resource) 25 | @node = node 26 | @new_resource = new_resource 27 | @current_resource = nil 28 | end 29 | 30 | def load_current_resource 31 | raise Chef::Exceptions::Override, "You must override load_current_resource in #{self.to_s}" 32 | end 33 | 34 | def action_nothing 35 | Chef::Log.debug("Doing nothing for #{@new_resource.to_s}") 36 | true 37 | end 38 | 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /chef/lib/chef/mixin/from_file.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | class Chef 20 | module Mixin 21 | module FromFile 22 | 23 | # Loads a given ruby file, and runs instance_eval against it in the context of the current 24 | # object. 25 | # 26 | # Raises an IOError if the file cannot be found, or is not readable. 27 | def from_file(filename) 28 | if File.exists?(filename) && File.readable?(filename) 29 | self.instance_eval(IO.read(filename), filename, 1) 30 | else 31 | raise IOError, "Cannot open or read #{filename}!" 32 | end 33 | end 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /chef-server-slice/app/helpers/nodes_helper.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Author:: AJ Christensen () 4 | # Copyright:: Copyright (c) 2008 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 | module Merb 21 | module ChefServerSlice 22 | module NodesHelper 23 | def recipe_list(node) 24 | response = "" 25 | node.recipes.each do |recipe| 26 | response << "
  • #{recipe}
  • \n" 27 | end 28 | response 29 | end 30 | 31 | def attribute_list(node) 32 | response = "" 33 | node.each_attribute do |k,v| 34 | response << "
  • #{k}: #{v}
  • \n" 35 | end 36 | response 37 | end 38 | 39 | end 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /chef/spec/lib/chef/resource/zen_master.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | class Chef 20 | class Resource 21 | class ZenMaster < Chef::Resource 22 | attr_reader :peace 23 | 24 | def initialize(name, collection=nil, node=nil) 25 | @resource_name = :zen_master 26 | super(name, collection, node) 27 | end 28 | 29 | def peace(tf) 30 | @peace = tf 31 | end 32 | 33 | def something(arg=nil) 34 | set_if_args(@something, arg) do 35 | case arg 36 | when true, false 37 | @something = arg 38 | end 39 | end 40 | end 41 | end 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /chef/lib/chef/resource/gem_package.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | require 'chef/resource/package' 20 | 21 | class Chef 22 | class Resource 23 | class GemPackage < Chef::Resource::Package 24 | 25 | def initialize(name, collection=nil, node=nil) 26 | super(name, collection, node) 27 | @resource_name = :gem_package 28 | @provider = Chef::Provider::Package::Rubygems 29 | end 30 | 31 | # Sets a custom gem_binary to run for gem commands. 32 | def gem_binary(arg=nil) 33 | set_or_return( 34 | :gem_binary, 35 | arg, 36 | :kind_of => [ String ] 37 | ) 38 | end 39 | end 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /chef/lib/chef/provider/script.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | require 'tempfile' 20 | require 'chef/provider/execute' 21 | 22 | class Chef 23 | class Provider 24 | class Script < Chef::Provider::Execute 25 | 26 | def action_run 27 | tf = Tempfile.new("chef-script") 28 | tf.puts(@new_resource.code) 29 | tf.close 30 | 31 | fr = Chef::Resource::File.new(tf.path, nil, @node) 32 | fr.owner(@new_resource.user) 33 | fr.group(@new_resource.group) 34 | fr.run_action(:create) 35 | 36 | @new_resource.command("#{@new_resource.interpreter} #{tf.path}") 37 | super 38 | end 39 | 40 | end 41 | end 42 | end -------------------------------------------------------------------------------- /chef-server-slice/app/views/openid_register/index.html.haml: -------------------------------------------------------------------------------- 1 | .block#block-tables 2 | .content 3 | %h2.title Registrations 4 | .inner 5 | %table.table 6 | %tr 7 | %th.first Registration Name 8 | %th   9 | %th Control 10 | %th.last   11 | - @registered_nodes.sort{ |a,b| a.name.to_s <=> b.name.to_s }.each_with_index do |node, index| 12 | %tr{:class => "#{index % 2 == 1 ? 'odd' : 'even'}"} 13 | %td{:colspan => 2}= link_to(node.name, slice_url(:registration, { :id => node.name })) 14 | %td 15 | = link_to( (node.validated ? "Invalidate Registration" : "Validate Registration"), slice_url( :validate_registration, { :id => node.name} ), :method => "post", :confirm => "Are you sure you want to" + (node.validated ? " invalidate " : " validate ") + "this node's registration?") 16 | | 17 | = link_to((node.admin ? "Remove Admin Rights" : "Grant Admin Rights"), slice_url(:admin_registration, { :id => node.name}), :method => "post", :confirm => "Are you sure you want to" + (node.admin ? " remove administrator privileges from this node?" : " grant administrator privileges to this node?")) 18 | | 19 | = link_to("Delete", slice_url(:registration, { :id => node.name} ), :method => "delete", :confirm => "Are you sure you want to delete this registration") 20 | -------------------------------------------------------------------------------- /chef/spec/lib/chef/resource/one_two_three_four.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: John Hampton () 3 | # Copyright:: Copyright (c) 2009 CleanOffer, 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 Resource 21 | class OneTwoThreeFour < Chef::Resource 22 | attr_reader :i_can_count 23 | 24 | def initialize(name, collection=nil, node=nil) 25 | @resource_name = :one_two_three_four 26 | super(name, collection, node) 27 | end 28 | 29 | def i_can_count(tf) 30 | @i_can_count = tf 31 | end 32 | 33 | def something(arg=nil) 34 | set_if_args(@something, arg) do 35 | case arg 36 | when true, false 37 | @something = arg 38 | end 39 | end 40 | end 41 | end 42 | end 43 | end -------------------------------------------------------------------------------- /chef/spec/unit/resource/csh_spec.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "spec_helper")) 20 | 21 | describe Chef::Resource::Csh do 22 | 23 | before(:each) do 24 | @resource = Chef::Resource::Csh.new("fakey_fakerton") 25 | end 26 | 27 | it "should create a new Chef::Resource::Csh" do 28 | @resource.should be_a_kind_of(Chef::Resource) 29 | @resource.should be_a_kind_of(Chef::Resource::Csh) 30 | end 31 | 32 | it "should have a resource name of :csh" do 33 | @resource.resource_name.should eql(:csh) 34 | end 35 | 36 | it "should have an interpreter of csh" do 37 | @resource.interpreter.should eql("csh") 38 | end 39 | 40 | end -------------------------------------------------------------------------------- /chef/spec/unit/resource/bash_spec.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "spec_helper")) 20 | 21 | describe Chef::Resource::Bash do 22 | 23 | before(:each) do 24 | @resource = Chef::Resource::Bash.new("fakey_fakerton") 25 | end 26 | 27 | it "should create a new Chef::Resource::Bash" do 28 | @resource.should be_a_kind_of(Chef::Resource) 29 | @resource.should be_a_kind_of(Chef::Resource::Bash) 30 | end 31 | 32 | it "should have a resource name of :bash" do 33 | @resource.resource_name.should eql(:bash) 34 | end 35 | 36 | it "should have an interpreter of bash" do 37 | @resource.interpreter.should eql("bash") 38 | end 39 | 40 | end -------------------------------------------------------------------------------- /chef/spec/unit/resource/perl_spec.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "spec_helper")) 20 | 21 | describe Chef::Resource::Perl do 22 | 23 | before(:each) do 24 | @resource = Chef::Resource::Perl.new("fakey_fakerton") 25 | end 26 | 27 | it "should create a new Chef::Resource::Perl" do 28 | @resource.should be_a_kind_of(Chef::Resource) 29 | @resource.should be_a_kind_of(Chef::Resource::Perl) 30 | end 31 | 32 | it "should have a resource name of :perl" do 33 | @resource.resource_name.should eql(:perl) 34 | end 35 | 36 | it "should have an interpreter of perl" do 37 | @resource.interpreter.should eql("perl") 38 | end 39 | 40 | end -------------------------------------------------------------------------------- /chef/spec/unit/resource/ruby_spec.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "spec_helper")) 20 | 21 | describe Chef::Resource::Ruby do 22 | 23 | before(:each) do 24 | @resource = Chef::Resource::Ruby.new("fakey_fakerton") 25 | end 26 | 27 | it "should create a new Chef::Resource::Ruby" do 28 | @resource.should be_a_kind_of(Chef::Resource) 29 | @resource.should be_a_kind_of(Chef::Resource::Ruby) 30 | end 31 | 32 | it "should have a resource name of :ruby" do 33 | @resource.resource_name.should eql(:ruby) 34 | end 35 | 36 | it "should have an interpreter of ruby" do 37 | @resource.interpreter.should eql("ruby") 38 | end 39 | 40 | end -------------------------------------------------------------------------------- /chef-server-slice/app/views/openid_consumer/index.html.haml: -------------------------------------------------------------------------------- 1 | - unless Chef::Config[:authorized_openid_providers] 2 | - throw_content(:sidebar_block_notice) do 3 | %h4 Where do I get a Login? 4 | %p Chef uses OpenID for user logins. By default, Chef allows you to use any OpenID provider you like. You should configure the server to utilize only trusted OpenID servers and URIs. This box will disappear when you have altered the default security configuration. 5 | %p= link_to("How to secure your Chef Server on the Chef Wiki.", "http://wiki.opscode.com/display/chef/Securing+Chef+Server") 6 | 7 | .block#block-forms 8 | .content 9 | %h2.title Login 10 | .inner 11 | %form.form{ :method => "get", "accept-charset" => "UTF-8", :action => slice_url(:openid_consumer_login) } 12 | .group 13 | .text_field= text_field :openid_identifier 14 | .group 15 | .check_box= check_box :name => "immediate", :label => "Use immediate mode", :value => "0" 16 | .group 17 | .check_box= check_box :name => "use_sreg", :label => "Request registration data", :value => "0" 18 | .group 19 | .check_box= check_box :name => "use_pape", :label => "Request phishing-resistent auth policy", :value => "0" 20 | .group 21 | .check_box= check_box :name => "force_post", :label => "Force the transaction to POST", :value => "0" 22 | .group.navform 23 | .button= submit "Login →" 24 | -------------------------------------------------------------------------------- /chef/spec/unit/resource/python_spec.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "spec_helper")) 20 | 21 | describe Chef::Resource::Python do 22 | 23 | before(:each) do 24 | @resource = Chef::Resource::Python.new("fakey_fakerton") 25 | end 26 | 27 | it "should create a new Chef::Resource::Python" do 28 | @resource.should be_a_kind_of(Chef::Resource) 29 | @resource.should be_a_kind_of(Chef::Resource::Python) 30 | end 31 | 32 | it "should have a resource name of :python" do 33 | @resource.resource_name.should eql(:python) 34 | end 35 | 36 | it "should have an interpreter of python" do 37 | @resource.interpreter.should eql("python") 38 | end 39 | 40 | end -------------------------------------------------------------------------------- /chef/lib/chef/exceptions.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | class Chef 19 | class Exceptions 20 | class Application < RuntimeError; end 21 | class Cron < RuntimeError; end 22 | class Exec < RuntimeError; end 23 | class FileNotFound < RuntimeError; end 24 | class Package < RuntimeError; end 25 | class Service < RuntimeError; end 26 | class Route < RuntimeError; end 27 | class SearchIndex < RuntimeError; end 28 | class Override < RuntimeError; end 29 | class UnsupportedAction < RuntimeError; end 30 | class MissingLibrary < RuntimeError; end 31 | class User < RuntimeError; end 32 | class Group < RuntimeError; end 33 | class Link < RuntimeError; end 34 | class Mount < RuntimeError; end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /chef/spec/unit/resource/apt_package_spec.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "spec_helper")) 20 | 21 | describe Chef::Resource::AptPackage, "initialize" do 22 | 23 | before(:each) do 24 | @resource = Chef::Resource::AptPackage.new("foo") 25 | end 26 | 27 | it "should return a Chef::Resource::AptPackage" do 28 | @resource.should be_a_kind_of(Chef::Resource::AptPackage) 29 | end 30 | 31 | it "should set the resource_name to :apt_package" do 32 | @resource.resource_name.should eql(:apt_package) 33 | end 34 | 35 | it "should set the provider to Chef::Provider::Package::Apt" do 36 | @resource.provider.should eql(Chef::Provider::Package::Apt) 37 | end 38 | end -------------------------------------------------------------------------------- /features/steps/node_steps.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ### 20 | # Given 21 | ### 22 | Given /^a validated node$/ do 23 | client.validation_token = Chef::Config[:validation_token] = 'ceelo' 24 | client.register 25 | client.authenticate 26 | client.build_node 27 | client.node.recipes << "integration_setup" 28 | end 29 | 30 | Given /^it includes the recipe '(.+)'$/ do |recipe| 31 | self.recipe = recipe 32 | client.node.recipes << recipe 33 | client.save_node 34 | end 35 | 36 | Given /^it includes the role '(.+)'$/ do |role| 37 | self.recipe = "role[#{role}]" 38 | client.node.run_list << "role[#{role}]" 39 | client.save_node 40 | end 41 | 42 | ### 43 | # When 44 | ### 45 | When /^the node is converged$/ do 46 | client.run 47 | end 48 | 49 | -------------------------------------------------------------------------------- /chef/spec/unit/resource/dpkg_package_spec.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "spec_helper")) 20 | 21 | describe Chef::Resource::DpkgPackage, "initialize" do 22 | 23 | before(:each) do 24 | @resource = Chef::Resource::DpkgPackage.new("foo") 25 | end 26 | 27 | it "should return a Chef::Resource::DpkgPackage" do 28 | @resource.should be_a_kind_of(Chef::Resource::DpkgPackage) 29 | end 30 | 31 | it "should set the resource_name to :dpkg_package" do 32 | @resource.resource_name.should eql(:dpkg_package) 33 | end 34 | 35 | it "should set the provider to Chef::Provider::Package::Dpkg" do 36 | @resource.provider.should eql(Chef::Provider::Package::Dpkg) 37 | end 38 | end -------------------------------------------------------------------------------- /features/api/nodes/list_nodes_api.feature: -------------------------------------------------------------------------------- 1 | @api @nodes @nodes_list 2 | Feature: List nodes via the REST API 3 | In order to know what nodes exists programatically 4 | As a Developer 5 | I want to list all the nodes 6 | 7 | Scenario: List nodes when none have been created 8 | Given a 'registration' named 'bobo' exists 9 | And there are no nodes 10 | When I authenticate as 'bobo' 11 | And I 'GET' the path '/nodes' 12 | Then the inflated response should be an empty array 13 | 14 | Scenario: List nodes when one has been created 15 | Given a 'registration' named 'bobo' exists 16 | Given a 'node' named 'webserver' exists 17 | When I authenticate as 'bobo' 18 | And I 'GET' the path '/nodes' 19 | Then the inflated response should include '^http://.+/nodes/webserver$' 20 | 21 | Scenario: List nodes when two have been created 22 | Given a 'registration' named 'bobo' exists 23 | And a 'node' named 'webserver' exists 24 | And a 'node' named 'dbserver' exists 25 | When I authenticate as 'bobo' 26 | And I 'GET' the path '/nodes' 27 | Then the inflated response should be '2' items long 28 | And the inflated response should include '^http://.+/nodes/webserver$' 29 | And the inflated response should include '^http://.+/nodes/dbserver$' 30 | 31 | Scenario: List nodes when you are not authenticated 32 | When I 'GET' the path '/nodes' 33 | Then I should get a '401 "Unauthorized"' exception 34 | 35 | -------------------------------------------------------------------------------- /chef/spec/unit/resource/portage_package_spec.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "spec_helper")) 20 | 21 | describe Chef::Resource::PortagePackage, "initialize" do 22 | 23 | before(:each) do 24 | @resource = Chef::Resource::PortagePackage.new("foo") 25 | end 26 | 27 | it "should return a Chef::Resource::PortagePackage" do 28 | @resource.should be_a_kind_of(Chef::Resource::PortagePackage) 29 | end 30 | 31 | it "should set the resource_name to :portage_package" do 32 | @resource.resource_name.should eql(:portage_package) 33 | end 34 | 35 | it "should set the provider to Chef::Provider::Package::Portage" do 36 | @resource.provider.should eql(Chef::Provider::Package::Portage) 37 | end 38 | end -------------------------------------------------------------------------------- /chef/spec/unit/resource/macports_package_spec.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: David Balatero () 3 | # Copyright:: Copyright (c) 2009 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "spec_helper")) 20 | 21 | describe Chef::Resource::MacportsPackage, "initialize" do 22 | before(:each) do 23 | @resource = Chef::Resource::MacportsPackage.new("foo") 24 | end 25 | 26 | it "should return a Chef::Resource::MacportsPackage" do 27 | @resource.should be_a_kind_of(Chef::Resource::MacportsPackage) 28 | end 29 | 30 | it "should set the resource_name to :macports_package" do 31 | @resource.resource_name.should eql(:macports_package) 32 | end 33 | 34 | it "should set the provider to Chef::Provider::Package::Macports" do 35 | @resource.provider.should eql(Chef::Provider::Package::Macports) 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /chef-server-slice/public/stylesheets/jquery.treeTable.css: -------------------------------------------------------------------------------- 1 | /* jQuery TreeTable Core 2.0 stylesheet 2 | * 3 | * This file contains styles that are used to display the tree table. Each tree 4 | * table is assigned the +treeTable+ class. 5 | * ========================================================================= */ 6 | 7 | /* jquery.treeTable.collapsible 8 | * ------------------------------------------------------------------------- */ 9 | .treeTable tr td .expander { 10 | background-position: left center; 11 | background-repeat: no-repeat; 12 | cursor: pointer; 13 | padding: 0; 14 | zoom: 1; /* IE7 Hack */ 15 | } 16 | 17 | .treeTable tr.collapsed td .expander { 18 | background-image: url(../images/toggle-expand-dark.png); 19 | } 20 | 21 | .treeTable tr.expanded td .expander { 22 | background-image: url(../images/toggle-collapse-dark.png); 23 | } 24 | 25 | /* jquery.treeTable.sortable 26 | * ------------------------------------------------------------------------- */ 27 | .treeTable tr.selected, .treeTable tr.accept { 28 | background-color: #3875d7; 29 | color: #fff; 30 | } 31 | 32 | .treeTable tr.collapsed.selected td .expander, .treeTable tr.collapsed.accept td .expander { 33 | background-image: url(../images/toggle-expand-light.png); 34 | } 35 | 36 | .treeTable tr.expanded.selected td .expander, .treeTable tr.expanded.accept td .expander { 37 | background-image: url(../images/toggle-collapse-light.png); 38 | } 39 | 40 | .treeTable .ui-draggable-dragging { 41 | color: #000; 42 | z-index: 1; 43 | } -------------------------------------------------------------------------------- /chef/lib/chef/resource/script.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | require 'chef/resource/execute' 20 | 21 | class Chef 22 | class Resource 23 | class Script < Chef::Resource::Execute 24 | 25 | def initialize(name, collection=nil, node=nil) 26 | super(name, collection, node) 27 | @resource_name = :script 28 | @command = name 29 | @code = nil 30 | @interpreter = nil 31 | end 32 | 33 | def code(arg=nil) 34 | set_or_return( 35 | :code, 36 | arg, 37 | :kind_of => [ String ] 38 | ) 39 | end 40 | 41 | def interpreter(arg=nil) 42 | set_or_return( 43 | :interpreter, 44 | arg, 45 | :kind_of => [ String ] 46 | ) 47 | end 48 | 49 | end 50 | end 51 | end -------------------------------------------------------------------------------- /features/data/cookbooks/directory_provider/recipes/set_the_accessibility_of_a_created_directory.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: directory_provider 3 | # Recipe:: set_the_accesiibility_of_a_created_directory 4 | # 5 | # Copyright 2009, Opscode 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this directory 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 | directory "#{node[:tmpdir]}/octal0644" do 21 | mode 0644 22 | action :create 23 | end 24 | 25 | directory "#{node[:tmpdir]}/octal2644" do 26 | mode 02644 27 | action :create 28 | end 29 | 30 | directory "#{node[:tmpdir]}/decimal644" do 31 | mode 644 32 | action :create 33 | end 34 | 35 | directory "#{node[:tmpdir]}/decimal2644" do 36 | mode 2644 37 | action :create 38 | end 39 | 40 | directory "#{node[:tmpdir]}/string644" do 41 | mode "644" 42 | action :create 43 | end 44 | 45 | directory "#{node[:tmpdir]}/string0644" do 46 | mode "0644" 47 | action :create 48 | end 49 | 50 | directory "#{node[:tmpdir]}/string2644" do 51 | mode "2644" 52 | action :create 53 | end 54 | 55 | 56 | -------------------------------------------------------------------------------- /chef-server-slice/app/views/layout/login.html.haml: -------------------------------------------------------------------------------- 1 | !!! XML 2 | !!! 3 | %html 4 | %head 5 | %meta{ "http-equiv" => "content-type", :content => "text/html; charset=utf-8" } 6 | %title Chef Server 7 | = css_include_tag "base", "themes/djime-cerulean/style", "chef", "/facebox/facebox.css", "jquery-ui-1.7.1.custom", "jquery.treeTable" 8 | = js_include_tag "jquery-1.3.2.min", "jquery.jeditable.mini", "jquery.livequery", "jquery.localscroll", "jquery.scrollTo", "jquery.tools.min" 9 | = js_include_tag "/facebox/facebox.js" 10 | = js_include_tag "jquery-ui-1.7.1.custom.min" 11 | = js_include_tag "jquery.treeTable.min" 12 | = js_include_tag "JSONeditor" 13 | = js_include_tag "chef" 14 | 15 | %body 16 | #container 17 | #header 18 | %h1= link_to "Chef Server", slice_url(:top) 19 | #wrapper 20 | #main 21 | - unless message.empty? 22 | .block#block-messages 23 | .content 24 | %h2.title Messages 25 | .inner 26 | .flash 27 | - message.each do |type, msg| 28 | %div{:class => "message #{type}"} 29 | %p= msg 30 | = catch_content :for_layout 31 | #footer 32 | .block 33 | %p Copyright © 2009 Opscode 34 | #sidebar 35 | .block.notice#sidebar_block_notice= catch_content :sidebar_block_notice 36 | .block#sidebar_block= catch_content :sidebar_block 37 | .clear 38 | -------------------------------------------------------------------------------- /chef/tasks/rspec.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'rake' 3 | require 'spec/rake/spectask' 4 | 5 | CHEF_ROOT = File.join(File.dirname(__FILE__), "..") 6 | 7 | task :default => :spec 8 | 9 | desc "Run all specs in spec directory" 10 | Spec::Rake::SpecTask.new(:spec) do |t| 11 | t.spec_opts = ['--options', "\"#{CHEF_ROOT}/spec/spec.opts\""] 12 | t.spec_files = FileList['spec/**/*_spec.rb'] 13 | end 14 | 15 | namespace :spec do 16 | desc "Run all specs in spec directory with RCov" 17 | Spec::Rake::SpecTask.new(:rcov) do |t| 18 | t.spec_opts = ['--options', "\"#{CHEF_ROOT}/spec/spec.opts\""] 19 | t.spec_files = FileList['spec/**/*_spec.rb'] 20 | t.rcov = true 21 | t.rcov_opts = lambda do 22 | IO.readlines("#{CHEF_ROOT}/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten 23 | end 24 | end 25 | 26 | desc "Print Specdoc for all specs" 27 | Spec::Rake::SpecTask.new(:doc) do |t| 28 | t.spec_opts = ["--format", "specdoc", "--dry-run"] 29 | t.spec_files = FileList['spec/**/*_spec.rb'] 30 | end 31 | 32 | [:unit].each do |sub| 33 | desc "Run the specs under spec/#{sub}" 34 | Spec::Rake::SpecTask.new(sub) do |t| 35 | t.spec_opts = ['--options', "\"#{CHEF_ROOT}/spec/spec.opts\""] 36 | t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"] 37 | end 38 | end 39 | 40 | desc "Translate/upgrade specs using the built-in translator" 41 | task :translate do 42 | translator = ::Spec::Translator.new 43 | dir = CHEF_ROOT + '/spec' 44 | translator.translate(dir, dir) 45 | end 46 | end 47 | -------------------------------------------------------------------------------- /features/api/roles/list_roles_api.feature: -------------------------------------------------------------------------------- 1 | @api @roles @roles_list 2 | Feature: List roles via the REST API 3 | In order to know what roles exists programatically 4 | As a Developer 5 | I want to list all the roles 6 | 7 | Scenario: List roles when none have been created 8 | Given a 'registration' named 'bobo' exists 9 | And there are no roles 10 | When I authenticate as 'bobo' 11 | And I 'GET' the path '/roles' 12 | Then the inflated response should be an empty array 13 | 14 | Scenario: List roles when one has been created 15 | Given a 'registration' named 'bobo' exists 16 | Given a 'role' named 'webserver' exists 17 | When I authenticate as 'bobo' 18 | And I 'GET' the path '/roles' 19 | Then the inflated response should include '^http://.+/roles/webserver$' 20 | 21 | Scenario: List roles when two have been created 22 | Given a 'registration' named 'bobo' exists 23 | And a 'role' named 'webserver' exists 24 | And a 'role' named 'db' exists 25 | When I authenticate as 'bobo' 26 | And I 'GET' the path '/roles' 27 | Then the inflated response should be '3' items long 28 | And the inflated response should include '^http://.+/roles/role_test$' 29 | And the inflated response should include '^http://.+/roles/webserver$' 30 | And the inflated response should include '^http://.+/roles/db$' 31 | 32 | Scenario: List roles when you are not authenticated 33 | When I 'GET' the path '/roles' 34 | Then I should get a '401 "Unauthorized"' exception 35 | 36 | -------------------------------------------------------------------------------- /features/provider/directory/create_directories.feature: -------------------------------------------------------------------------------- 1 | Feature: Create Directories 2 | In order to save time 3 | As a Developer 4 | I want to create directories 5 | 6 | Scenario: Create a directory 7 | Given a validated node 8 | And it includes the recipe 'directory_provider::create' 9 | When I run the chef-client 10 | Then the run should exit '0' 11 | And a directory named 'isis' should exist 12 | 13 | Scenario: Set the owner of a created directory 14 | Given a validated node 15 | And it includes the recipe 'directory_provider::create' 16 | When I run the chef-client 17 | Then the run should exit '0' 18 | And the directory named 'isis' should be owned by 'nobody' 19 | 20 | Scenario: Set the accessibility of a created directory 21 | Given a validated node 22 | And it includes the recipe 'directory_provider::set_the_accessibility_of_a_created_directory' 23 | When I run the chef-client 24 | Then the run should exit '0' 25 | And the directory named 'octal0644' should have octal mode '0644' 26 | And the directory named 'octal2644' should have octal mode '2644' 27 | And the directory named 'decimal644' should have decimal mode '644' 28 | And the directory named 'decimal2644' should have decimal mode '2644' 29 | And the directory named 'string644' should have octal mode '644' 30 | And the directory named 'string0644' should have octal mode '0644' 31 | And the directory named 'string2644' should have octal mode '2644' 32 | 33 | 34 | -------------------------------------------------------------------------------- /chef/lib/chef.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | $:.unshift(File.dirname(__FILE__)) unless 20 | $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__))) 21 | 22 | require 'rubygems' 23 | require 'extlib' 24 | require 'chef/exceptions' 25 | require 'chef/log' 26 | require 'chef/config' 27 | Dir[File.join(File.dirname(__FILE__), 'chef/mixin/**/*.rb')].sort.each { |lib| require lib } 28 | 29 | class Chef 30 | VERSION = '0.7.5' 31 | end 32 | 33 | # Adds a Dir.glob to Ruby 1.8.5, for compat 34 | if RUBY_VERSION < "1.8.6" 35 | class Dir 36 | class << self 37 | alias_method :glob_, :glob 38 | def glob(*args) 39 | raise ArgumentError if args.empty? 40 | args.inject([]) { |r, p| r + glob_(p) } 41 | end 42 | alias_method :[], :glob 43 | end 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /chef/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Adam Jacob () 3 | # Copyright:: Copyright (c) 2008 Opscode, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | $:.unshift(File.join(File.dirname(__FILE__), "..", "lib")) 20 | $:.unshift(File.join(File.dirname(__FILE__), "..", "..", "chef-server", "lib")) 21 | 22 | require 'chef' 23 | require File.join(File.dirname(__FILE__), "/../lib/chef/util/fileedit") 24 | 25 | chef_lib_path = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')) 26 | Dir[ 27 | File.expand_path( 28 | File.join( 29 | chef_lib_path, 'chef', '**', '*.rb' 30 | ) 31 | ) 32 | ].sort.each do |lib| 33 | lib_short_path = lib.match("^#{chef_lib_path}#{File::SEPARATOR}(.+)$")[1] 34 | require lib_short_path 35 | end 36 | Dir[File.join(File.dirname(__FILE__), 'lib', '**', '*.rb')].sort.each { |lib| require lib } 37 | 38 | Chef::Config.log_level(:fatal) 39 | Chef::Log.level(Chef::Config.log_level) 40 | Chef::Config.solo(false) 41 | 42 | -------------------------------------------------------------------------------- /features/data/cookbooks/transfer_remote_files/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "maintainer_email": "youremail@example.com", 3 | "recipes": { 4 | "transfer_remote_files::transfer_a_file_from_a_cookbook": "", 5 | "transfer_remote_files::should_prefer_the_file_for_this_specific_host": "", 6 | "transfer_remote_files::transfer_a_file_from_a_specific_cookbook": "", 7 | "transfer_remote_files::transfer_a_non-existent_file_from_a_cookbook": "", 8 | "transfer_remote_files": "", 9 | "transfer_remote_files::change_remote_file_perms_trickery": "" 10 | }, 11 | "suggestions": { 12 | 13 | }, 14 | "license": "Apache v2.0", 15 | "conflicting": { 16 | 17 | }, 18 | "dependencies": { 19 | "transfer_remote_files_definition": [ 20 | 21 | ] 22 | }, 23 | "attributes": { 24 | 25 | }, 26 | "name": "transfer_remote_files", 27 | "providing": { 28 | "transfer_remote_files": [ 29 | 30 | ], 31 | "transfer_remote_files::transfer_a_file_from_a_cookbook": [ 32 | 33 | ], 34 | "transfer_remote_files::should_prefer_the_file_for_this_specific_host": [ 35 | 36 | ], 37 | "transfer_remote_files::transfer_a_file_from_a_specific_cookbook": [ 38 | 39 | ], 40 | "transfer_remote_files::transfer_a_non-existent_file_from_a_cookbook": [ 41 | 42 | ], 43 | "transfer_remote_files::change_remote_file_perms_trickery": [ 44 | 45 | ] 46 | }, 47 | "replacing": { 48 | 49 | }, 50 | "long_description": "", 51 | "description": "A fabulous new cookbook", 52 | "maintainer": "Your Name", 53 | "recommendations": { 54 | 55 | }, 56 | "platforms": { 57 | 58 | } 59 | } --------------------------------------------------------------------------------