├── Manifest.txt ├── .rdebugrc ├── vendor └── gems │ ├── git-style-binaries │ ├── .gitmodules │ ├── doc │ │ ├── EXAMPLES │ │ └── gsb-screencast.png │ ├── VERSION.yml │ ├── .document │ ├── .gitignore │ ├── test │ │ ├── fixtures │ │ │ ├── flickr │ │ │ ├── wordpress-list │ │ │ ├── flickr-download │ │ │ ├── wordpress-categories │ │ │ ├── wordpress-post │ │ │ └── wordpress │ │ ├── shoulda_macros │ │ │ └── matching_stdio.rb │ │ ├── git-style-binary │ │ │ └── command_test.rb │ │ ├── test_helper.rb │ │ └── git_style_binary_test.rb │ └── lib │ │ ├── ext │ │ └── core.rb │ │ └── git-style-binary │ │ ├── autorunner.rb │ │ ├── helpers │ │ └── pager.rb │ │ └── commands │ │ └── help.rb │ ├── dslify │ ├── .gitignore │ ├── VERSION.yml │ ├── test │ │ └── test_helper.rb │ ├── README.rdoc │ ├── dslify.gemspec │ ├── LICENSE │ └── Rakefile │ ├── searchable_paths │ ├── .gitignore │ ├── .document │ ├── test │ │ └── test_helper.rb │ ├── README.rdoc │ ├── LICENSE │ └── Rakefile │ └── trollop │ ├── Manifest.txt │ ├── release-script.txt │ ├── Rakefile │ └── README.txt ├── .rvmrc ├── lib ├── cloud_providers │ ├── default │ │ ├── helpers │ │ │ └── base_helper.rb │ │ └── base.rb │ └── ec2 │ │ └── helpers │ │ ├── elastic_block_device_mapping.rb │ │ ├── revoke.rb │ │ ├── elastic_ip.rb │ │ ├── ec2_helper.rb │ │ └── authorize.rb ├── poolparty │ ├── version.rb │ ├── pool_party_error.rb │ ├── base.rb │ └── chef_attribute.rb ├── core │ ├── array.rb │ ├── symbol.rb │ ├── object.rb │ ├── string.rb │ └── hash.rb ├── cloud_providers.rb └── poolparty.rb ├── test ├── fixtures │ ├── test_template.erb │ ├── templates │ │ └── apache_conf.erb │ ├── resources │ │ ├── random_proc_file.rb │ │ ├── fake_resource.rb │ │ ├── fake_subclassed_plugin.rb │ │ └── fake_plugin.rb │ ├── clouds │ │ ├── simple_cloud.rb │ │ ├── rds_missing_params.rb │ │ ├── rds_cloud.rb │ │ ├── ssh_cloud.rb │ │ └── vmware_cloud.rb │ ├── ec2 │ │ ├── rds-describe-db-instances-empty_response_body.xml │ │ ├── ec2-terminate-instances_response_body.xml │ │ ├── ec2-describe-security-groups_response_body.xml │ │ └── ec2-run-instances_response_body.xml │ ├── keys │ │ ├── pem_pub_key.pem │ │ ├── test_pub_key │ │ ├── test_key │ │ └── pem_key.pem │ ├── chef │ │ └── recipes │ │ │ └── sudo │ │ │ ├── templates │ │ │ └── default │ │ │ │ └── sudoers.erb │ │ │ ├── recipes │ │ │ └── default.rb │ │ │ └── attributes │ │ │ └── sudoers.rb │ └── bad_perms_test_key ├── lib │ ├── poolparty │ │ ├── pool_test.rb │ │ ├── pool_party_error_test.rb │ │ └── rds_test.rb │ └── core │ │ ├── symbol_test.rb │ │ ├── object_test.rb │ │ ├── array_test.rb │ │ ├── hash_test.rb │ │ └── string_test.rb └── test_helper.rb ├── examples ├── chef_cloud │ ├── chef_repo │ │ ├── cookbooks │ │ │ ├── chef │ │ │ │ ├── recipes │ │ │ │ │ └── default.rb │ │ │ │ └── templates │ │ │ │ │ └── default │ │ │ │ │ ├── client.rb.erb │ │ │ │ │ ├── server.rb.erb │ │ │ │ │ └── chef_server.conf.erb │ │ │ ├── README │ │ │ ├── bootstrap │ │ │ │ ├── templates │ │ │ │ │ └── default │ │ │ │ │ │ ├── sv-chef-client-log-run.erb │ │ │ │ │ │ ├── sv-chef-indexer-log-run.erb │ │ │ │ │ │ ├── sv-chef-server-log-run.erb │ │ │ │ │ │ ├── sv-chef-indexer-run.erb │ │ │ │ │ │ ├── sv-chef-server-run.erb │ │ │ │ │ │ ├── sv-chef-client-run.erb │ │ │ │ │ │ ├── client.rb.erb │ │ │ │ │ │ └── server.rb.erb │ │ │ │ ├── metadata.rb │ │ │ │ └── recipes │ │ │ │ │ └── default.rb │ │ │ ├── ganglia │ │ │ │ ├── README.rdoc │ │ │ │ ├── recipes │ │ │ │ │ ├── monitor_sshd.rb │ │ │ │ │ ├── monitor_watson.rb │ │ │ │ │ ├── web.rb │ │ │ │ │ └── gmetad.rb │ │ │ │ ├── templates │ │ │ │ │ └── default │ │ │ │ │ │ ├── jaunty.sources.list.erb │ │ │ │ │ │ └── bin │ │ │ │ │ │ ├── monitors │ │ │ │ │ │ ├── watson_channels.sh.erb │ │ │ │ │ │ └── sshd_ganglia.sh.erb │ │ │ │ │ │ ├── gmond.erb │ │ │ │ │ │ └── gmetad.erb │ │ │ │ ├── metadata.rb │ │ │ │ └── attributes │ │ │ │ │ └── default.rb │ │ │ ├── apache2 │ │ │ │ ├── templates │ │ │ │ │ └── default │ │ │ │ │ │ ├── port_apache.erb │ │ │ │ │ │ ├── mods │ │ │ │ │ │ ├── deflate.conf.erb │ │ │ │ │ │ ├── README │ │ │ │ │ │ ├── dir.conf.erb │ │ │ │ │ │ ├── fcgid.conf.erb │ │ │ │ │ │ ├── status.conf.erb │ │ │ │ │ │ ├── proxy.conf.erb │ │ │ │ │ │ ├── negotiation.conf.erb │ │ │ │ │ │ ├── alias.conf.erb │ │ │ │ │ │ └── setenvif.conf.erb │ │ │ │ │ │ ├── ports.conf.erb │ │ │ │ │ │ ├── charset.erb │ │ │ │ │ │ ├── apache2.god.erb │ │ │ │ │ │ ├── a2dismod.erb │ │ │ │ │ │ ├── a2dissite.erb │ │ │ │ │ │ ├── a2ensite.erb │ │ │ │ │ │ ├── a2enmod.erb │ │ │ │ │ │ ├── web_app.conf.erb │ │ │ │ │ │ └── security.erb │ │ │ │ ├── recipes │ │ │ │ │ ├── mod_cgi.rb │ │ │ │ │ ├── mod_dav.rb │ │ │ │ │ ├── mod_env.rb │ │ │ │ │ ├── mod_ldap.rb │ │ │ │ │ ├── mod_expires.rb │ │ │ │ │ ├── mod_headers.rb │ │ │ │ │ ├── mod_proxy_ajp.rb │ │ │ │ │ ├── mod_rewrite.rb │ │ │ │ │ ├── mod_auth_basic.rb │ │ │ │ │ ├── mod_auth_digest.rb │ │ │ │ │ ├── mod_authn_file.rb │ │ │ │ │ ├── mod_authnz_ldap.rb │ │ │ │ │ ├── mod_authz_host.rb │ │ │ │ │ ├── mod_authz_user.rb │ │ │ │ │ ├── mod_proxy_balancer.rb │ │ │ │ │ ├── mod_proxy_connect.rb │ │ │ │ │ ├── mod_proxy_http.rb │ │ │ │ │ ├── mod_authz_default.rb │ │ │ │ │ ├── mod_dir.rb │ │ │ │ │ ├── mod_mime.rb │ │ │ │ │ ├── mod_alias.rb │ │ │ │ │ ├── mod_authz_groupfile.rb │ │ │ │ │ ├── mod_proxy.rb │ │ │ │ │ ├── mod_status.rb │ │ │ │ │ ├── mod_deflate.rb │ │ │ │ │ ├── mod_setenvif.rb │ │ │ │ │ ├── mod_autoindex.rb │ │ │ │ │ ├── mod_dav_svn.rb │ │ │ │ │ ├── mod_negotiation.rb │ │ │ │ │ ├── mod_python.rb │ │ │ │ │ ├── mod_log_config.rb │ │ │ │ │ ├── mod_php5.rb │ │ │ │ │ ├── god_monitor.rb │ │ │ │ │ ├── mod_rails.rb │ │ │ │ │ ├── mod_ssl.rb │ │ │ │ │ └── mod_fcgid.rb │ │ │ │ ├── definitions │ │ │ │ │ ├── apache_conf.rb │ │ │ │ │ ├── apache_site.rb │ │ │ │ │ ├── web_app.rb │ │ │ │ │ └── apache_module.rb │ │ │ │ └── files │ │ │ │ │ └── default │ │ │ │ │ └── apache2_module_conf_generate.pl │ │ │ ├── rsyslog │ │ │ │ ├── templates │ │ │ │ │ ├── default │ │ │ │ │ │ └── remote.conf.erb │ │ │ │ │ └── ubuntu-9.10 │ │ │ │ │ │ └── remote.conf.erb │ │ │ │ ├── files │ │ │ │ │ ├── default │ │ │ │ │ │ └── rsyslog.default │ │ │ │ │ ├── ubuntu-9.10 │ │ │ │ │ │ └── rsyslog.default │ │ │ │ │ └── ubuntu-8.04 │ │ │ │ │ │ └── rsyslog.default │ │ │ │ ├── attributes │ │ │ │ │ └── rsyslog.rb │ │ │ │ ├── metadata.rb │ │ │ │ └── recipes │ │ │ │ │ ├── client.rb │ │ │ │ │ ├── server.rb │ │ │ │ │ └── default.rb │ │ │ ├── runit │ │ │ │ ├── files │ │ │ │ │ ├── ubuntu-6.10 │ │ │ │ │ │ └── runsvdir │ │ │ │ │ ├── ubuntu-7.04 │ │ │ │ │ │ └── runsvdir │ │ │ │ │ ├── ubuntu-7.10 │ │ │ │ │ │ └── runsvdir │ │ │ │ │ └── ubuntu-8.04 │ │ │ │ │ │ └── runsvdir │ │ │ │ ├── attributes │ │ │ │ │ └── sv_bin.rb │ │ │ │ ├── metadata.rb │ │ │ │ └── recipes │ │ │ │ │ └── default.rb │ │ │ ├── apt │ │ │ │ ├── files │ │ │ │ │ └── default │ │ │ │ │ │ ├── apt-cacher │ │ │ │ │ │ └── apt-proxy-v2.conf │ │ │ │ ├── metadata.rb │ │ │ │ ├── metadata.json │ │ │ │ └── recipes │ │ │ │ │ ├── default.rb │ │ │ │ │ ├── proxy.rb │ │ │ │ │ └── cacher.rb │ │ │ ├── ec2 │ │ │ │ ├── metadata.rb │ │ │ │ ├── recipes │ │ │ │ │ └── default.rb │ │ │ │ └── attributes │ │ │ │ │ ├── ec2_recipe_options.rb │ │ │ │ │ └── ec2_metadata.rb │ │ │ └── ntp │ │ │ │ ├── attributes │ │ │ │ └── ntp.rb │ │ │ │ ├── templates │ │ │ │ └── default │ │ │ │ │ └── ntp.conf.erb │ │ │ │ ├── metadata.rb │ │ │ │ └── recipes │ │ │ │ └── default.rb │ │ ├── .gitignore │ │ ├── site-cookbooks │ │ │ ├── hosts │ │ │ │ ├── attributes │ │ │ │ │ └── hosts.rb │ │ │ │ ├── recipes │ │ │ │ │ └── default.rb │ │ │ │ ├── metadata.rb │ │ │ │ └── templates │ │ │ │ │ └── default │ │ │ │ │ └── hosts.erb │ │ │ ├── README │ │ │ ├── ubuntu │ │ │ │ ├── metadata.rb │ │ │ │ ├── metadata.json │ │ │ │ ├── templates │ │ │ │ │ └── default │ │ │ │ │ │ └── sources.list.erb │ │ │ │ └── recipes │ │ │ │ │ └── default.rb │ │ │ └── sysadmin │ │ │ │ └── recipes │ │ │ │ └── default.rb │ │ ├── certificates │ │ │ └── README │ │ ├── README │ │ ├── roles │ │ │ ├── README │ │ │ └── chef-upgrade.rb │ │ ├── config │ │ │ ├── solo.rb.example │ │ │ ├── client.rb.example │ │ │ └── server.rb.example │ │ └── Rakefile │ └── user_data ├── knock.sh ├── chef_cloud.rb ├── simple.rb └── rds_cloud.rb ├── .gitmodules ├── config └── requirements.rb ├── Makefile ├── Gemfile ├── .gitignore ├── bin ├── cloud-reboot ├── cloud-start ├── cloud-compile ├── cloud-rsync ├── cloud-configure ├── cloud-bootstrap ├── cloud-cssh ├── cloud-run ├── cloud-terminate ├── cloud-ssh ├── cloud-expand ├── cloud-contract ├── cloud-list ├── cloud-console ├── cloud-vnc └── cloud-show ├── License.txt ├── poolparty.gemspec └── Gemfile.lock /Manifest.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.rdebugrc: -------------------------------------------------------------------------------- 1 | set autoeval on 2 | -------------------------------------------------------------------------------- /vendor/gems/git-style-binaries/.gitmodules: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.rvmrc: -------------------------------------------------------------------------------- 1 | rvm use ruby-1.9.2@poolparty --create 2 | -------------------------------------------------------------------------------- /lib/cloud_providers/default/helpers/base_helper.rb: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/test_template.erb: -------------------------------------------------------------------------------- 1 | Hello <%= friends %> -------------------------------------------------------------------------------- /vendor/gems/dslify/.gitignore: -------------------------------------------------------------------------------- 1 | pkg/* 2 | pkg/ 3 | tmp -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/chef/recipes/default.rb: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/.gitignore: -------------------------------------------------------------------------------- 1 | .rake_test_cache 2 | 3 | -------------------------------------------------------------------------------- /vendor/gems/git-style-binaries/doc/EXAMPLES: -------------------------------------------------------------------------------- 1 | see test/fixtures 2 | -------------------------------------------------------------------------------- /examples/chef_cloud/user_data: -------------------------------------------------------------------------------- 1 | #!/bin/sh -x 2 | echo "Yeah, go userdata script!" 3 | -------------------------------------------------------------------------------- /lib/poolparty/version.rb: -------------------------------------------------------------------------------- 1 | module PoolParty 2 | VERSION = "1.7.0.pre" 3 | end 4 | -------------------------------------------------------------------------------- /vendor/gems/dslify/VERSION.yml: -------------------------------------------------------------------------------- 1 | --- 2 | :major: 0 3 | :minor: 1 4 | :patch: 0 5 | -------------------------------------------------------------------------------- /test/fixtures/templates/apache_conf.erb: -------------------------------------------------------------------------------- 1 | # Apache conf file 2 | apache <%= cloud.name %> -------------------------------------------------------------------------------- /vendor/gems/searchable_paths/.gitignore: -------------------------------------------------------------------------------- 1 | *.sw? 2 | .DS_Store 3 | coverage 4 | rdoc 5 | pkg 6 | -------------------------------------------------------------------------------- /vendor/gems/git-style-binaries/VERSION.yml: -------------------------------------------------------------------------------- 1 | --- 2 | :patch: 10 3 | :major: 0 4 | :minor: 1 5 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/README: -------------------------------------------------------------------------------- 1 | This directory contains upstream or shared cookbooks. 2 | -------------------------------------------------------------------------------- /lib/cloud_providers/default/base.rb: -------------------------------------------------------------------------------- 1 | module CloudProviders 2 | class Base < CloudProvider 3 | end 4 | end -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/site-cookbooks/hosts/attributes/hosts.rb: -------------------------------------------------------------------------------- 1 | hosts Mash.new unless attribute?(:hosts) -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/certificates/README: -------------------------------------------------------------------------------- 1 | This directory contains certificates created by the Rakefile. 2 | -------------------------------------------------------------------------------- /vendor/gems/searchable_paths/.document: -------------------------------------------------------------------------------- 1 | README.rdoc 2 | lib/**/*.rb 3 | bin/* 4 | features/**/*.feature 5 | LICENSE 6 | -------------------------------------------------------------------------------- /vendor/gems/git-style-binaries/.document: -------------------------------------------------------------------------------- 1 | README.rdoc 2 | lib/**/*.rb 3 | bin/* 4 | features/**/*.feature 5 | LICENSE 6 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/site-cookbooks/hosts/recipes/default.rb: -------------------------------------------------------------------------------- 1 | template "/etc/hosts" do 2 | source "hosts.erb" 3 | end -------------------------------------------------------------------------------- /test/fixtures/resources/random_proc_file.rb: -------------------------------------------------------------------------------- 1 | a = [] 2 | 3 | @b = Proc.new do 4 | @str = "I have a bee" 5 | end 6 | 7 | @c = "cats" -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "vendor/gems/amazon-ec2"] 2 | path = vendor/gems/amazon-ec2 3 | url = git://github.com/grempe/amazon-ec2.git 4 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/bootstrap/templates/default/sv-chef-client-log-run.erb: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec svlogd -tt ./main 3 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/bootstrap/templates/default/sv-chef-indexer-log-run.erb: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec svlogd -tt ./main 3 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/bootstrap/templates/default/sv-chef-server-log-run.erb: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec svlogd -tt ./main 3 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/README: -------------------------------------------------------------------------------- 1 | Began as a clone of the Opscode base repo 2 | http://wiki.opscode.com/display/chef/Chef+Repository 3 | 4 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/ganglia/README.rdoc: -------------------------------------------------------------------------------- 1 | = DESCRIPTION: 2 | 3 | = REQUIREMENTS: 4 | 5 | = ATTRIBUTES: 6 | 7 | = USAGE: 8 | 9 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/roles/README: -------------------------------------------------------------------------------- 1 | Create roles here, in either .rb or .json files. Any roles created here win vs those created in the webui. 2 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/site-cookbooks/README: -------------------------------------------------------------------------------- 1 | This directory contains cookbooks that modify upstream ones, or that are specific to your site. 2 | -------------------------------------------------------------------------------- /vendor/gems/trollop/Manifest.txt: -------------------------------------------------------------------------------- 1 | FAQ.txt 2 | History.txt 3 | Manifest.txt 4 | README.txt 5 | Rakefile 6 | lib/trollop.rb 7 | test/test_trollop.rb 8 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/templates/default/port_apache.erb: -------------------------------------------------------------------------------- 1 | # Port <%= @port %> 2 | -A FWR -p tcp -m tcp --dport <%= @port %> -j ACCEPT -------------------------------------------------------------------------------- /vendor/gems/git-style-binaries/doc/gsb-screencast.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/auser/poolparty/HEAD/vendor/gems/git-style-binaries/doc/gsb-screencast.png -------------------------------------------------------------------------------- /config/requirements.rb: -------------------------------------------------------------------------------- 1 | require 'fileutils' 2 | include FileUtils 3 | 4 | require 'rubygems' 5 | require 'rake' 6 | 7 | $:.unshift(File.join(File.dirname(__FILE__), %w[.. lib])) 8 | -------------------------------------------------------------------------------- /vendor/gems/git-style-binaries/.gitignore: -------------------------------------------------------------------------------- 1 | *.sw? 2 | .DS_Store 3 | coverage 4 | rdoc 5 | pkg 6 | .autosession.vim 7 | .sessions 8 | .session 9 | tags 10 | README.html 11 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/templates/default/mods/deflate.conf.erb: -------------------------------------------------------------------------------- 1 | 2 | AddOutputFilterByType DEFLATE text/html text/plain text/xml 3 | 4 | -------------------------------------------------------------------------------- /vendor/gems/git-style-binaries/test/fixtures/flickr: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | $:.unshift(File.dirname(__FILE__) + "/../../lib") 3 | VERSION="0.0.2" # just to test it 4 | require 'git-style-binary/command' 5 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/site-cookbooks/hosts/metadata.rb: -------------------------------------------------------------------------------- 1 | maintainer "37signals" 2 | maintainer_email "sysadmins@37signals.com" 3 | description "Configures hosts" 4 | version "0.1" 5 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/templates/default/mods/README: -------------------------------------------------------------------------------- 1 | These configs are taken from a Debian apache2.2-common 2.2.11-3 install. They 2 | work on CentOS 5.3 with a few conditions using erb. 3 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/rsyslog/templates/default/remote.conf.erb: -------------------------------------------------------------------------------- 1 | <% case @protocol -%> 2 | <% when "tcp" -%> 3 | *.* @@<%= @server %> 4 | <% when "udp" -%> 5 | *.* @<%= @server %> 6 | <% end -%> 7 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/rsyslog/templates/ubuntu-9.10/remote.conf.erb: -------------------------------------------------------------------------------- 1 | <% case @protocol -%> 2 | <% when "tcp" -%> 3 | *.* @@<%= @server %> 4 | <% when "udp" -%> 5 | *.* @<%= @server %> 6 | <% end -%> 7 | -------------------------------------------------------------------------------- /vendor/gems/dslify/test/test_helper.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'test/unit' 3 | require 'shoulda' 4 | require "context" 5 | 6 | $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) 7 | require 'dslify' -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/templates/default/mods/dir.conf.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm 4 | 5 | 6 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/runit/files/ubuntu-6.10/runsvdir: -------------------------------------------------------------------------------- 1 | start on runlevel-2 2 | start on runlevel-3 3 | start on runlevel-4 4 | start on runlevel-5 5 | stop on shutdown 6 | respawn /usr/sbin/runsvdir-start 7 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/runit/files/ubuntu-7.04/runsvdir: -------------------------------------------------------------------------------- 1 | start on runlevel 2 2 | start on runlevel 3 3 | start on runlevel 4 4 | start on runlevel 5 5 | stop on shutdown 6 | respawn 7 | exec /usr/sbin/runsvdir-start 8 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/runit/files/ubuntu-7.10/runsvdir: -------------------------------------------------------------------------------- 1 | start on runlevel 2 2 | start on runlevel 3 3 | start on runlevel 4 4 | start on runlevel 5 5 | stop on shutdown 6 | respawn 7 | exec /usr/sbin/runsvdir-start 8 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/runit/files/ubuntu-8.04/runsvdir: -------------------------------------------------------------------------------- 1 | start on runlevel 2 2 | start on runlevel 3 3 | start on runlevel 4 4 | start on runlevel 5 5 | stop on shutdown 6 | respawn 7 | exec /usr/sbin/runsvdir-start 8 | -------------------------------------------------------------------------------- /lib/cloud_providers/ec2/helpers/elastic_block_device_mapping.rb: -------------------------------------------------------------------------------- 1 | module CloudProviders 2 | class ElasticBlockDeviceMapping < Ec2Helper 3 | def initialize(name, init_opts={}, &block) 4 | super 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /test/fixtures/clouds/simple_cloud.rb: -------------------------------------------------------------------------------- 1 | # Poolparty spec 2 | 3 | pool "poolparty" do 4 | 5 | cloud :fake_cloud do 6 | keypair File.dirname(__FILE__)+"/../keys/test_key" 7 | using :ec2 do 8 | end 9 | end 10 | 11 | end -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/templates/default/ports.conf.erb: -------------------------------------------------------------------------------- 1 | #This file generated via template by Chef. 2 | <% @apache_listen_ports.each do |port| -%> 3 | Listen <%= port %> 4 | NameVirtualHost *:<%= port %> 5 | 6 | <% end -%> 7 | -------------------------------------------------------------------------------- /test/fixtures/clouds/rds_missing_params.rb: -------------------------------------------------------------------------------- 1 | # test RDS pool 2 | 3 | pool :poolparty do 4 | cloud :fake_cloud do 5 | keypair File.dirname(__FILE__)+"/../keys/test_key" 6 | using :ec2 7 | 8 | rds :db1 do 9 | end 10 | end 11 | end -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/config/solo.rb.example: -------------------------------------------------------------------------------- 1 | # 2 | # Chef Solo Config File 3 | # 4 | 5 | log_level :info 6 | log_location STDOUT 7 | file_cache_path "/srv/chef/cookbooks" 8 | ssl_verify_mode :verify_none 9 | Chef::Log::Formatter.show_time = false 10 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | RUBY = `which ruby` 2 | RUBYGEMS = `which gem` 3 | GEMENV = `gem env` 4 | 5 | all: run_tests 6 | 7 | check_install: 8 | $(RUBY) -v 9 | $(RUBYGEMS) -v 10 | 11 | show_env: 12 | echo $(GEMENV) 13 | 14 | test: run_tests 15 | 16 | run_tests: 17 | rake test -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/site-cookbooks/ubuntu/metadata.rb: -------------------------------------------------------------------------------- 1 | maintainer "Opscode, Inc." 2 | maintainer_email "cookbooks@opscode.com" 3 | license "Apache 2.0" 4 | description "Sets up sources for ubuntu" 5 | version "0.7" 6 | depends "apt" 7 | supports "ubuntu" 8 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/bootstrap/templates/default/sv-chef-indexer-run.erb: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | PATH=/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin<% if @node[:languages][:ruby][:gems_dir] %>:<%= @node[:languages][:ruby][:gems_dir] %>/bin<% end -%> 3 | exec 2>&1 4 | exec /usr/bin/env chef-indexer 5 | -------------------------------------------------------------------------------- /test/fixtures/clouds/rds_cloud.rb: -------------------------------------------------------------------------------- 1 | # test RDS pool 2 | 3 | pool :poolparty do 4 | cloud :fake_cloud do 5 | keypair File.dirname(__FILE__)+"/../keys/test_key" 6 | using :ec2 7 | 8 | rds :db1 do 9 | username "admin" 10 | password "secret" 11 | storage 5 12 | end 13 | end 14 | end -------------------------------------------------------------------------------- /test/lib/poolparty/pool_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class PoolTest < Test::Unit::TestCase 4 | def setup 5 | stub_keypair_searchable_paths 6 | end 7 | 8 | def test_set_up_pool_object 9 | reset! 10 | pool "hi" do 11 | end 12 | assert_equal @@pool.name, "hi" 13 | end 14 | end -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/templates/default/charset.erb: -------------------------------------------------------------------------------- 1 | # Read the documentation before enabling AddDefaultCharset. 2 | # In general, it is only a good idea if you know that all your files 3 | # have this encoding. It will override any encoding given in the files 4 | # in meta http-equiv or xml encoding tags. 5 | 6 | #AddDefaultCharset UTF-8 7 | -------------------------------------------------------------------------------- /vendor/gems/git-style-binaries/lib/ext/core.rb: -------------------------------------------------------------------------------- 1 | class Object 2 | def returning(value) 3 | yield(value) 4 | value 5 | end unless Object.respond_to?(:returning) 6 | end 7 | 8 | class Symbol 9 | def to_proc 10 | Proc.new { |*args| args.shift.__send__(self, *args) } 11 | end 12 | end 13 | 14 | class IO 15 | attr_accessor :use_color 16 | end 17 | -------------------------------------------------------------------------------- /test/fixtures/resources/fake_resource.rb: -------------------------------------------------------------------------------- 1 | class FakeResource < PoolParty::Resource 2 | 3 | default_options( 4 | :name => nil 5 | ) 6 | def self.has_method_name 7 | "tester" 8 | end 9 | 10 | def print_to_chef 11 | <<-EOE 12 | fake "<%= name %>" do 13 | content "<%= content %>" 14 | end 15 | EOE 16 | end 17 | 18 | end -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/rsyslog/files/default/rsyslog.default: -------------------------------------------------------------------------------- 1 | # Generated by Chef 2 | # 3 | # Use v3 native mode, rather than compatibility mode by specifying -c3 4 | # here. Compatibility mode for older versions is not recommended as 5 | # custom configuration may get messy. 6 | # 7 | # See rsyslogd(8) for more details 8 | 9 | RSYSLOGD_OPTIONS="-c3" 10 | -------------------------------------------------------------------------------- /test/fixtures/clouds/ssh_cloud.rb: -------------------------------------------------------------------------------- 1 | pool :tssh do 2 | cloud :tgarden do 3 | instances 2 4 | keypair File.join(FIXTURES_PATH, 'keys/test_key') 5 | using :ssh do 6 | user 'fairchild' #default is root 7 | hosts %w(beet squash) 8 | end 9 | has_file '/etc/poolparty/welcome', :content=>"Welcome to the #{self.name} cloud" 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apt/files/default/apt-cacher: -------------------------------------------------------------------------------- 1 | # apt-cacher startup configuration file 2 | 3 | # IMPORTANT: check the apt-cacher.conf file before using apt-cacher as daemon. 4 | 5 | # set to 1 to start the daemon at boot time 6 | AUTOSTART=1 7 | 8 | # extra settings to override the ones in apt-cacher.conf 9 | # EXTRAOPT=" daemon_port=3142 limit=30 " 10 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/bootstrap/templates/default/sv-chef-server-run.erb: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | PATH=/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin<% if @node[:languages][:ruby][:gems_dir] %>:<%= @node[:languages][:ruby][:gems_dir] %>/bin<% end -%> 3 | exec 2>&1 4 | exec /usr/bin/env chef-server -N -c2 -P <%= @node[:bootstrap][:chef][:run_path] %>/server.%s.pid 5 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/ec2/metadata.rb: -------------------------------------------------------------------------------- 1 | maintainer "Opscode, Inc." 2 | maintainer_email "cookbooks@opscode.com" 3 | license "Apache 2.0" 4 | description "Manage EC2 metadata as attributes" 5 | version "0.9" 6 | 7 | attribute "ec2_metadata", 8 | :display_name => "EC2 Metadata", 9 | :description => "Retrieve EC2 instance metadata" 10 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/ganglia/recipes/monitor_sshd.rb: -------------------------------------------------------------------------------- 1 | template "/etc/ganglia/bin/monitors/sshd_ganglia.sh" do 2 | source "bin/monitors/sshd_ganglia.sh.erb" 3 | mode "0755" 4 | end 5 | 6 | cron "monitor sshd" do 7 | minute "*/5" 8 | hour "*" 9 | day "*" 10 | month "*" 11 | weekday "*" 12 | command "bash -c /etc/ganglia/bin/monitors/sshd_ganglia.sh" 13 | end 14 | 15 | -------------------------------------------------------------------------------- /vendor/gems/searchable_paths/test/test_helper.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'test/unit' 3 | require "fileutils" 4 | 5 | $LOAD_PATH.unshift(File.dirname(__FILE__)) 6 | $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) 7 | require 'searchable_paths' 8 | 9 | class Test::Unit::TestCase 10 | end 11 | 12 | class String 13 | def /(o) 14 | File.join(self, o.to_s) 15 | end 16 | end -------------------------------------------------------------------------------- /test/fixtures/clouds/vmware_cloud.rb: -------------------------------------------------------------------------------- 1 | pool "local" do 2 | 3 | cloud "local_app" do 4 | keypair "id_rsa" 5 | using :vmware do 6 | image_id "/Users/alerner/Documents/vm/Ubuntu32bitVM.vmwarevm/Ubuntu32bitVM.vmx" 7 | public_ip "192.168.248.133" 8 | end 9 | 10 | has_file "/etc/motd", :content => "BURN! Pocket Aces" 11 | 12 | apache 13 | 14 | end 15 | 16 | end -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/ganglia/recipes/monitor_watson.rb: -------------------------------------------------------------------------------- 1 | template "/etc/ganglia/bin/monitors/watson_channels.sh" do 2 | source "bin/monitors/watson_channels.sh.erb" 3 | mode "0755" 4 | end 5 | 6 | cron "watson-channels" do 7 | minute "*/1" 8 | hour "*" 9 | day "*" 10 | month "*" 11 | weekday "*" 12 | command "bash -c /etc/ganglia/bin/monitors/watson_channels.sh" 13 | end 14 | 15 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/bootstrap/metadata.rb: -------------------------------------------------------------------------------- 1 | maintainer "Opscode, Inc." 2 | maintainer_email "cookbooks@opscode.com" 3 | license "Apache 2.0" 4 | description "Configures RubyGems-installed Chef" 5 | long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc')) 6 | version "0.1" 7 | 8 | %w{ runit couchdb stompserver apache2 }.each do |cb| 9 | depends cb 10 | end 11 | -------------------------------------------------------------------------------- /lib/core/array.rb: -------------------------------------------------------------------------------- 1 | =begin rdoc 2 | Array extensions 3 | =end 4 | 5 | class Array 6 | 7 | # Example nodes.select_with_hash(:status=>'running') 8 | def select_with_hash(conditions={}) 9 | return self if conditions.empty? 10 | select do |node| 11 | conditions.any? do |k,v| 12 | ( node.has_key?(k) && node[k]==v ) or ( node.respond_to?(k) && node.send(k)==v ) 13 | end 14 | end 15 | end 16 | 17 | end -------------------------------------------------------------------------------- /test/fixtures/ec2/rds-describe-db-instances-empty_response_body.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 5e547870-fa2d-11de-8e05-53428aa3290f 8 | 9 | 10 | -------------------------------------------------------------------------------- /vendor/gems/git-style-binaries/test/shoulda_macros/matching_stdio.rb: -------------------------------------------------------------------------------- 1 | class Test::Unit::TestCase 2 | def output_should_match(regexp) 3 | assert_match regexp, @stdout + @stderr 4 | end 5 | alias_method :output_matches, :output_should_match 6 | 7 | def stdout_should_match(regexp) 8 | assert_match regexp, @stdout 9 | end 10 | def stderr_should_match(regexp) 11 | assert_match regexp, @stderr 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "http://rubygems.org" 2 | gemspec 3 | 4 | gem 'amazon-ec2', '~>0.9.17' 5 | gem 'xml-simple' 6 | gem 'json' 7 | gem 'git-style-binaries' 8 | 9 | group :test do 10 | gem 'fakeweb' 11 | gem 'webmock' 12 | gem 'shoulda' 13 | gem 'rcov' 14 | gem 'mocha' 15 | gem 'right_http_connection' 16 | gem "jnunemaker-matchy", "~> 0.4.0" 17 | gem 'vagrant' 18 | end 19 | 20 | group :development do 21 | gem "rdoc" 22 | end 23 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/templates/default/mods/fcgid.conf.erb: -------------------------------------------------------------------------------- 1 | 2 | AddHandler fcgid-script .fcgi 3 | IPCConnectTimeout 20 4 | 5 | 6 | <% if @node[:platform] == "centos" || @node[:platform] == "redhat" || @node[:platform] == "fedora" -%> 7 | # Sane place to put sockets and shared memory file 8 | SocketPath run/mod_fcgid 9 | SharememPath run/mod_fcgid/fcgid_shm 10 | <% end -%> 11 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apt/metadata.rb: -------------------------------------------------------------------------------- 1 | maintainer "Opscode, Inc." 2 | maintainer_email "cookbooks@opscode.com" 3 | license "Apache 2.0" 4 | description "Configures apt and apt services" 5 | version "0.7" 6 | recipe "apt::cacher", "Set up an APT cache" 7 | recipe "apt::proxy", "Set up an APT proxy" 8 | 9 | %w{ ubuntu debian }.each do |os| 10 | supports os 11 | end 12 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/ntp/attributes/ntp.rb: -------------------------------------------------------------------------------- 1 | ntp Mash.new unless attribute?("ntp") 2 | 3 | case platform 4 | when "ubuntu","debian" 5 | ntp[:service] = "ntp" 6 | when "redhat","centos","fedora" 7 | ntp[:service] = "ntpd" 8 | end unless ntp.has_key?(:service) 9 | 10 | ntp[:is_server] = false unless ntp.has_key?(:is_server) 11 | ntp[:servers] = ["0.us.pool.ntp.org", "1.us.pool.ntp.org"] unless ntp.has_key?(:servers) 12 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/ganglia/templates/default/jaunty.sources.list.erb: -------------------------------------------------------------------------------- 1 | deb http://archive.ubuntu.com/ubuntu/ jaunty main restricted 2 | deb http://archive.ubuntu.com/ubuntu/ jaunty universe 3 | deb http://archive.ubuntu.com/ubuntu/ jaunty multiverse 4 | deb-src http://archive.ubuntu.com/ubuntu/ jaunty main restricted 5 | deb-src http://archive.ubuntu.com/ubuntu/ jaunty universe 6 | deb-src http://archive.ubuntu.com/ubuntu/ jaunty multiverse 7 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/rsyslog/files/ubuntu-9.10/rsyslog.default: -------------------------------------------------------------------------------- 1 | # Generated by Chef 2 | # 3 | # Options for rsyslogd 4 | # -m 0 disables 'MARK' messages (deprecated, only used in compat mode < 3) 5 | # -r enables logging from remote machines (deprecated, only used in compat mode < 3) 6 | # -x disables DNS lookups on messages received with -r 7 | # -c compatibility mode 8 | # See rsyslogd(8) for more details 9 | RSYSLOGD_OPTIONS="-c4" 10 | -------------------------------------------------------------------------------- /test/fixtures/resources/fake_subclassed_plugin.rb: -------------------------------------------------------------------------------- 1 | module PoolParty 2 | module Resources 3 | 4 | class FakeSubclassedPlugin < Resource 5 | 6 | def self.has_method_name 7 | "subclassed" 8 | end 9 | 10 | def after_loaded 11 | has_file "/etc/my_configs/special_config" do 12 | requires get_directory("/etc/my_configs") 13 | end 14 | end 15 | 16 | end 17 | 18 | end 19 | end -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/ganglia/metadata.rb: -------------------------------------------------------------------------------- 1 | maintainer "Nate Murray" 2 | maintainer_email "" 3 | license "Apache 2.0" 4 | description "Installs/Configures ganglia" 5 | long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc')) 6 | version "0.1" 7 | 8 | recipe "ganglia::default" 9 | recipe "ganglia::gmetad" 10 | recipe "ganglia::monitor_sshd" 11 | recipe "ganglia::monitor_watson" 12 | recipe "ganglia::web" 13 | -------------------------------------------------------------------------------- /test/fixtures/keys/pem_pub_key.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PUBLIC KEY----- 2 | MIIBCAKCAQEAywLYTlQ+keNiZI2FeBik6q34xStF3fF2+XPk3e21B0YQfbQIxYJG 3 | 8gbSro90Tu1hnEBZfYm+AC8HXsR9Kx9LpfTSa3aGFRREwdsi8xuaoeHWNxOhMykU 4 | 4UcxahT0Ft5+738kLmtVhw8bjjkqcpxCSgrpcJbad2B2ft1KBE02kiU2y7yS92sU 5 | SWBzVkkJTmiWBDvn5pT9y6IpVCKseWbumGQ6nozEfXe4ihUsKAH42XPxSXMXXe64 6 | JuONQlxZPrqyF7L/lt6ZeyKQ7yXVcxr6P4W3rPqlBhq5yXNI3vV67KUNCh+wHH6R 7 | LagaguS0VTdBYwo3dvkmuL6TJqnzPzrv1wIBIw== 8 | -----END RSA PUBLIC KEY----- -------------------------------------------------------------------------------- /test/fixtures/keys/test_pub_key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PUBLIC KEY----- 2 | MIIBCAKCAQEAywLYTlQ+keNiZI2FeBik6q34xStF3fF2+XPk3e21B0YQfbQIxYJG 3 | 8gbSro90Tu1hnEBZfYm+AC8HXsR9Kx9LpfTSa3aGFRREwdsi8xuaoeHWNxOhMykU 4 | 4UcxahT0Ft5+738kLmtVhw8bjjkqcpxCSgrpcJbad2B2ft1KBE02kiU2y7yS92sU 5 | SWBzVkkJTmiWBDvn5pT9y6IpVCKseWbumGQ6nozEfXe4ihUsKAH42XPxSXMXXe64 6 | JuONQlxZPrqyF7L/lt6ZeyKQ7yXVcxr6P4W3rPqlBhq5yXNI3vV67KUNCh+wHH6R 7 | LagaguS0VTdBYwo3dvkmuL6TJqnzPzrv1wIBIw== 8 | -----END RSA PUBLIC KEY----- -------------------------------------------------------------------------------- /vendor/gems/git-style-binaries/test/fixtures/wordpress-list: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | $:.unshift(File.dirname(__FILE__) + "/../../lib") 3 | require 'git-style-binary/command' 4 | 5 | GitStyleBinary.command do 6 | short_desc "list blog postings" 7 | banner <<-EOS 8 | SYNOPSIS 9 | #{command.full_name} #{all_options_string} 10 | 11 | Lists the posts on the blog 12 | 13 | EOS 14 | run do |command| 15 | puts "listing blog posts" 16 | end 17 | end 18 | 19 | -------------------------------------------------------------------------------- /vendor/gems/trollop/release-script.txt: -------------------------------------------------------------------------------- 1 | Just a few simple steps to make a new release. 2 | 3 | vi lib/trollop.rb # and bump version number 4 | vi History.txt # and describe changes 5 | git-rank-contributors -o -h >> www/index.html 6 | vi www/index.html # and integrate contributors 7 | rake upload_webpage 8 | rake upload_docs 9 | rake release VERSION= 10 | git commit -a -m "bump to..." 11 | git tag release- 12 | git push 13 | git push --tags 14 | -------------------------------------------------------------------------------- /vendor/gems/git-style-binaries/lib/git-style-binary/autorunner.rb: -------------------------------------------------------------------------------- 1 | require 'git-style-binary/parser' 2 | 3 | module GitStyleBinary 4 | class AutoRunner 5 | 6 | def self.run(argv=ARGV) 7 | r = new 8 | r.run 9 | end 10 | 11 | def run 12 | unless GitStyleBinary.run? 13 | if !GitStyleBinary.current_command 14 | GitStyleBinary.load_primary 15 | end 16 | GitStyleBinary.current_command.run 17 | end 18 | end 19 | 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | examples-private/ 2 | .vagrant 3 | vendor/cache 4 | /trash/ 5 | rdoc/* 6 | .com.apple.timemachine.supported 7 | .DS_Store 8 | *tmp* 9 | pkg/*.tgz 10 | pkg/*.gem 11 | pkg/poolparty*/* 12 | .git/ 13 | log/* 14 | test_manifest.pp 15 | **/*/erl_crash.dump 16 | log 17 | *.beam 18 | ri/ 19 | .autosession.vim 20 | tags 21 | .session 22 | clouds.rb 23 | test/test_dir/ 24 | examples/thrift/erlang/deps/thrift/ebin/*.beam 25 | examples/thrift/erlang/ebin/*.beam 26 | *.swp 27 | *~ 28 | \#*\# 29 | -------------------------------------------------------------------------------- /vendor/gems/git-style-binaries/test/fixtures/flickr-download: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | $:.unshift(File.dirname(__FILE__) + "/../../lib") 3 | require 'git-style-binary/command' 4 | 5 | GitStyleBinary.command do 6 | short_desc "download a flickr image" 7 | banner <<-EOS 8 | SYNOPSIS 9 | #{command.full_name} #{all_options_string} url 10 | 11 | Downloads an image from flickr 12 | 13 | EOS 14 | run do |command| 15 | puts "would download: #{command.argv.inspect}" 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/ganglia/templates/default/bin/monitors/watson_channels.sh.erb: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 2009-10-01 3 | 4 | # Also check if this is the right location of gmetric 5 | GMETRIC=/usr/bin/gmetric 6 | AUTH_LOG=/var/log/auth 7 | 8 | dEFAULT_COUNT=0 9 | COUNT=$(echo "status" | nc localhost 8081 | grep free |awk '{print $2}') 10 | [ "x" = "x$COUNT" ] && COUNT=${DEFAULT_COUNT} 11 | 12 | $GMETRIC --name "watson-free-channels" --value $COUNT --type uint8 --units '' 13 | exit 0 14 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/site-cookbooks/sysadmin/recipes/default.rb: -------------------------------------------------------------------------------- 1 | case node[:platform] 2 | when "debian", "ubuntu" 3 | # package "policykit" 4 | # package "emacs22-nox" 5 | require_recipe "apt" 6 | else 7 | # package "emacs-nox" 8 | end 9 | 10 | package "vim" 11 | package "tree" 12 | package "nmap" 13 | package "ngrep" 14 | package "irb" 15 | package "curl" 16 | package "man-db" 17 | package "strace" 18 | package "host" 19 | package "lsof" 20 | package "gdb" 21 | package "socat" 22 | package "procmail" 23 | -------------------------------------------------------------------------------- /bin/cloud-reboot: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | $:.unshift(File.dirname(__FILE__) + "/../lib") 3 | require "poolparty" 4 | 5 | require 'git-style-binary/command' 6 | 7 | GitStyleBinary.command do 8 | banner <<-EOS 9 | Usage: #{$0} #{all_options_string} 10 | 11 | Cycle through nodes in the cloud and wait for the autoscaler to reboot 12 | EOS 13 | 14 | short_desc "Cycle the instances" 15 | 16 | run do |command| 17 | 18 | @loaded_clouds.each do |cld| 19 | cld.reboot! 20 | end 21 | 22 | end 23 | end -------------------------------------------------------------------------------- /lib/cloud_providers.rb: -------------------------------------------------------------------------------- 1 | =begin rdoc 2 | CloudProvider is the base class for cloud computing services such as Ec2, Eucalyptus - where your servers run. 3 | =end 4 | module CloudProviders 5 | 6 | # List of all defined cloud_providers 7 | def self.all 8 | @all ||= [] 9 | end 10 | 11 | end 12 | 13 | %w(connections remote_instance cloud_provider).each do |lib| 14 | require File.dirname(__FILE__)+"/cloud_providers/#{lib}" 15 | end 16 | 17 | %w(ec2).each do |lib| 18 | require "cloud_providers/#{lib}/#{lib}" 19 | end -------------------------------------------------------------------------------- /bin/cloud-start: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | $:.unshift(File.dirname(__FILE__) + "/../lib") 3 | require "poolparty" 4 | 5 | require 'git-style-binary/command' 6 | 7 | GitStyleBinary.command do 8 | banner <<-EOS 9 | Usage: #{$0} #{all_options_string} 10 | 11 | starts a single instance in your cloud. 12 | EOS 13 | 14 | short_desc "starts a single instance in your cloud" 15 | 16 | run do |command| 17 | 18 | @loaded_clouds.each do |cld| 19 | 20 | cld.run 21 | 22 | end 23 | 24 | end 25 | end -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/bootstrap/templates/default/sv-chef-client-run.erb: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | PATH=/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin<% if @node[:languages][:ruby][:gems_dir] %>:<%= @node[:languages][:ruby][:gems_dir] %>/bin<% end -%> 3 | exec 2>&1 4 | exec /usr/bin/env chef-client -i <%= @node[:bootstrap][:chef][:client_interval] %> -s <%= @node[:bootstrap][:chef][:client_splay] %> <% if @node[:bootstrap][:chef][:client_log] != "STDOUT" then -%>-L <%= @node[:bootstrap][:chef][:client_log] %><% end -%> 5 | -------------------------------------------------------------------------------- /vendor/gems/git-style-binaries/test/fixtures/wordpress-categories: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | $:.unshift(File.dirname(__FILE__) + "/../../lib") 3 | require 'git-style-binary/command' 4 | 5 | GitStyleBinary.command do 6 | short_desc "do something with categories" 7 | banner <<-EOS 8 | SYNOPSIS 9 | #{command.full_name} #{all_options_string} 10 | 11 | Does something with categories 12 | 13 | EOS 14 | run do |command| 15 | puts "does something with categories" 16 | puts @categories.join(" ") 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /vendor/gems/git-style-binaries/test/git-style-binary/command_test.rb: -------------------------------------------------------------------------------- 1 | require File.dirname(__FILE__) + "/../test_helper.rb" 2 | require 'git-style-binary/command' 3 | 4 | class CommandTest < Test::Unit::TestCase 5 | context "cmd" do 6 | setup do 7 | @c = GitStyleBinary::Command.new 8 | end 9 | 10 | should "be able to easily work with constraints" do 11 | assert_equal @c.constraints, [] 12 | @c.constraints << "foo" 13 | assert_equal @c.constraints, ["foo"] 14 | end 15 | 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/templates/default/mods/status.conf.erb: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # Allow server status reports generated by mod_status, 4 | # with the URL of http://servername/server-status 5 | # Uncomment and change the ".example.com" to allow 6 | # access from other hosts. 7 | # 8 | 9 | SetHandler server-status 10 | Order deny,allow 11 | Deny from all 12 | Allow from localhost ip6-localhost 13 | # Allow from .example.com 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /test/lib/core/symbol_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class SymbolTest < Test::Unit::TestCase 4 | context "Symbol" do 5 | should "be able to compare to strings" do 6 | assert_equal [:a, :c, :b].sort, [:a, :b, :c] 7 | assert_nothing_raised do 8 | :a <=> :b 9 | end 10 | end 11 | 12 | should "have path separaters" do 13 | assert_equal :a / :b, "a/b" 14 | end 15 | 16 | should "classify the symbol" do 17 | assert_equal :C, :c.classify 18 | end 19 | 20 | end 21 | 22 | end -------------------------------------------------------------------------------- /test/fixtures/resources/fake_plugin.rb: -------------------------------------------------------------------------------- 1 | module PoolParty 2 | module Resources 3 | 4 | class FakePlugin < Resource 5 | 6 | def self.has_method_name 7 | "fake_plugin" 8 | end 9 | 10 | def name 11 | "fake_plugin" 12 | end 13 | 14 | def after_loaded 15 | has_file "/etc/my_configs/special_config" do 16 | requires get_directory("/etc/my_configs") 17 | end 18 | has_directory("/etc/my_configs") 19 | end 20 | 21 | end 22 | 23 | end 24 | end -------------------------------------------------------------------------------- /test/lib/poolparty/pool_party_error_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class PoolPartyErrorTest < Test::Unit::TestCase 4 | include PoolParty 5 | context "Error" do 6 | should "be able to create a PoolPartyError" do 7 | assert_nothing_raised do 8 | PoolPartyError.create "TestError", "New error" 9 | end 10 | end 11 | 12 | should "raise when called with the test error" do 13 | assert_raise TestError do 14 | raise PoolPartyError.create("TestError", "New error") 15 | end 16 | end 17 | 18 | end 19 | 20 | end -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/ganglia/templates/default/bin/monitors/sshd_ganglia.sh.erb: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Nate Murray 3 | # Date 2009-07-13 4 | # 5 | # Record number of invalid users or failed passwords in sshd 6 | 7 | # Also check if this is the right location of gmetric 8 | GMETRIC=/usr/bin/gmetric 9 | AUTH_LOG=/var/log/auth 10 | 11 | COUNT=$(cat $AUTH_LOG | grep -iE "(Invalid user|Failed password)" | grep "`date '+%b %e'`" | wc -l) 12 | $GMETRIC --name "failed-or-invalid-login-attempts" --value $COUNT --type uint8 --units '' 13 | exit 0 14 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/rsyslog/files/ubuntu-8.04/rsyslog.default: -------------------------------------------------------------------------------- 1 | # Options to rsyslogd 2 | # -m 0 disables 'MARK' messages. 3 | # -r enables logging from remote machines 4 | # -x disables DNS lookups on messages recieved with -r 5 | # See rsyslogd(8) for more details 6 | RSYSLOGD_OPTIONS="-m 0" 7 | 8 | # Options to rklogd 9 | # -2 prints all kernel oops messages twice; once for klogd to decode, and 10 | # once for processing with 'ksymoops' 11 | # -x disables all klogd processing of oops messages entirely 12 | # See rklogd(8) for more details 13 | RKLOGD_OPTIONS="-x" 14 | -------------------------------------------------------------------------------- /test/fixtures/ec2/ec2-terminate-instances_response_body.xml: -------------------------------------------------------------------------------- 1 | 2 | d16d104e-f450-4d5c-8354-70a8cad2dacd 3 | 4 | 5 | i-3B3506A0 6 | 7 | 32 8 | shutting-down 9 | 10 | 11 | 16 12 | running 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /test/fixtures/chef/recipes/sudo/templates/default/sudoers.erb: -------------------------------------------------------------------------------- 1 | # 2 | # /etc/sudoers 3 | # 4 | # Generated by Chef for <%= @node[:fqdn] %> 5 | # 6 | 7 | Defaults !lecture,tty_tickets,!fqdn 8 | 9 | # User privilege specification 10 | root ALL=(ALL) ALL 11 | 12 | <% @sudoers_users.each do |user| -%> 13 | <%= user %> ALL=(ALL) ALL 14 | <% end -%> 15 | 16 | # Members of the sysadmin group may gain root privileges 17 | %sysadmin ALL=(ALL) ALL 18 | 19 | <% @sudoers_groups.each do |group| -%> 20 | # Members of the group '<%= group %>' may gain root privileges 21 | %<%= group %> ALL=(ALL) ALL 22 | <% end -%> -------------------------------------------------------------------------------- /examples/knock.sh: -------------------------------------------------------------------------------- 1 | ok() { 2 | exec 3>&1 3 | eval ` 4 | exec 4>&1 >&3 3>&- 5 | { 6 | eval "$@" 2>&1 >/dev/null 7 | echo "EC=$?;" >&4 8 | } | sed 's/^/# /' 9 | ` 10 | [ "$EC" = 0 ] && echo "ok - $@" || echo "not ok - $@: $EC" 11 | return $EC 12 | } 13 | 14 | 15 | # example usage: 16 | 17 | # ok true 18 | # ok ! false 19 | # 20 | # ok "(ok true | grep -q '^ok')" 21 | # ok "(ok false | grep -q '^not ok')" 22 | # 23 | # # self-test 24 | # ok ok true 25 | # ok ! ok "false" 26 | # 27 | # ok "(ok 'echo foo>/dev/stderr' 2>&1 | grep -q '# foo') # stderr gets commented" -------------------------------------------------------------------------------- /examples/chef_cloud.rb: -------------------------------------------------------------------------------- 1 | 2 | pool "poolparty" do 3 | 4 | cloud "chef" do 5 | instances 1 6 | using :ec2 7 | chef :solo do 8 | repo File.dirname(__FILE__)+"/chef_cloud/chef_repo" 9 | recipe "apache2" 10 | recipe "rsyslog::server" 11 | recipe "collectd" 12 | attributes :apache2 => {:listen_ports => ["80", "8080"]} 13 | end 14 | user_data open(File.dirname(__FILE__)+"/chef_cloud/user_data").read 15 | security_group do 16 | authorize :from_port => "22", :to_port => "22" 17 | authorize :from_port => "80", :to_port => "80" 18 | end 19 | 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/site-cookbooks/hosts/templates/default/hosts.erb: -------------------------------------------------------------------------------- 1 | 127.0.0.1 localhost <%= @node[:hosts][:localhost_aliases].join(" ") if @node[:hosts][:localhost_aliases] %> 2 | 127.0.1.1 <%= @node['fqdn'] %> <%= @node['hostname'] %> 3 | 4 | <% if @node[:hosts][:entries] %> 5 | <% @node[:hosts][:entries].each do |h| %> 6 | <%= h.join(" ") %> 7 | <% end %> 8 | <% end %> 9 | 10 | 11 | 12 | # The following lines are desirable for IPv6 capable hosts 13 | ::1 ip6-localhost ip6-loopback 14 | fe00::0 ip6-localnet 15 | ff00::0 ip6-mcastprefix 16 | ff02::1 ip6-allnodes 17 | ff02::2 ip6-allrouters 18 | ff02::3 ip6-allhosts 19 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/templates/default/apache2.god.erb: -------------------------------------------------------------------------------- 1 | God.watch do |w| 2 | w.name = "apache2" 3 | w.interval = 30.seconds # default 4 | w.start = "<%= @params[:start] %>" 5 | w.stop = "/etc/init.d/httpd stop" 6 | w.restart = "<%= @params[:restart] %>" 7 | w.start_grace = 10.seconds 8 | w.restart_grace = 10.seconds 9 | w.pid_file = "/var/run/httpd.pid" 10 | w.behavior(:clean_pid_file) 11 | 12 | w.start_if do |start| 13 | start.condition(:process_running) do |c| 14 | c.interval = 5.seconds 15 | c.running = false 16 | c.notify = 'admin' 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /bin/cloud-compile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | $:.unshift(File.dirname(__FILE__) + "/../lib") 3 | require "poolparty" 4 | 5 | require 'git-style-binary/command' 6 | 7 | GitStyleBinary.command do 8 | banner <<-EOS 9 | Usage: #{$0} #{all_options_string} 10 | 11 | Configure a cloud instance 12 | EOS 13 | 14 | short_desc "Configure a cloud instance" 15 | 16 | opt :inst_num, "The number of the instance to run bootstrap on", :type => :int 17 | 18 | run do |command| 19 | 20 | @loaded_clouds.each do |cld| 21 | ENV["POOLPARTY_NO_VALIDATION"] = "true" 22 | 23 | cld.compile! 24 | 25 | end 26 | 27 | end 28 | end -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/ganglia/recipes/web.rb: -------------------------------------------------------------------------------- 1 | # Cookbook Name:: ganglia 2 | # Recipe:: web 3 | 4 | # hmm, maybe unify with below 5 | execute "create ganglia web interface" do 6 | command "cp -r /opt/local/src/ganglia-3.1.2/web #{node[:ganglia][:gmond_web_root]}" 7 | action :run 8 | creates node[:ganglia][:gmond_web_root] 9 | end 10 | 11 | # setenforce 0 12 | execute "selinux: allow httpd can network for ganglia web interface" do 13 | command "setsebool -P httpd_can_network_connect 1" 14 | action :run 15 | only_if "/usr/sbin/getenforce | grep Enforcing" 16 | not_if "getsebool httpd_can_network_connect | grep on" 17 | end 18 | -------------------------------------------------------------------------------- /test/lib/core/object_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class ObjectTest < Test::Unit::TestCase 4 | context "object" do 5 | setup do 6 | reset! 7 | end 8 | context "global methods" do 9 | setup do 10 | @o = Object.new 11 | end 12 | 13 | should "have the pools method" do 14 | assert @o.respond_to?(:pool) 15 | end 16 | 17 | should "make a pool when calling pool" do 18 | assert_nil @@pool 19 | @@pool = pool :fun_pool do 20 | end 21 | assert_not_nil @@pool 22 | end 23 | 24 | end 25 | 26 | 27 | end 28 | 29 | end -------------------------------------------------------------------------------- /lib/poolparty/pool_party_error.rb: -------------------------------------------------------------------------------- 1 | =begin rdoc 2 | PoolPartyError 3 | 4 | Create an StandardError on the fly 5 | =end 6 | module PoolParty 7 | class PoolPartyError 8 | 9 | # Create an error with the class_name and error message 10 | # If the StandardError is not yet defined, define it, subclassing 11 | # StandardError and return the new class 12 | # Note: the class is set on Object 13 | def self.create(class_name="StandardError", msg="Error") 14 | Object.const_set(class_name, Class.new(StandardError)) unless Object.const_defined?(class_name) 15 | class_name.constantize.send(:new, msg) 16 | end 17 | 18 | end 19 | end -------------------------------------------------------------------------------- /vendor/gems/searchable_paths/README.rdoc: -------------------------------------------------------------------------------- 1 | = searchable_paths 2 | 3 | Searchable paths 4 | 5 | == Note on Patches/Pull Requests 6 | 7 | * Fork the project. 8 | * Make your feature addition or bug fix. 9 | * Add tests for it. This is important so I don't break it in a 10 | future version unintentionally. 11 | * Commit, do not mess with rakefile, version, or history. 12 | (if you want to have your own version, that is fine but 13 | bump version in a commit by itself I can ignore when I pull) 14 | * Send me a pull request. Bonus points for topic branches. 15 | 16 | == Copyright 17 | 18 | Copyright (c) 2009 Nate Murray, Ari Lerner. See LICENSE for details. 19 | -------------------------------------------------------------------------------- /bin/cloud-rsync: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | $:.unshift(File.dirname(__FILE__) + "/../lib") 3 | require "poolparty" 4 | 5 | require 'git-style-binary/command' 6 | 7 | GitStyleBinary.command do 8 | banner <<-EOS 9 | Usage: #{$0} #{all_options_string} 10 | 11 | ssh into an instance of the cloud 12 | EOS 13 | 14 | short_desc "ssh into an instance of the cloud" 15 | opt :to, "To this directory", :default => "~" 16 | 17 | run do |command| 18 | cloud = @loaded_clouds.first 19 | dir = command.argv.pop 20 | 21 | if !cloud.nodes.empty? 22 | cloud.rsync(dir, command[:to]) 23 | else 24 | puts "No running instances can be found" 25 | end 26 | 27 | end 28 | end -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/roles/chef-upgrade.rb: -------------------------------------------------------------------------------- 1 | name "chef-upgrade" 2 | description "Use this role to upgrade Chef clients and server with the Opscode Chef cookbook. Requires that nodes are using chef::client or chef::server recipes." 3 | 4 | # Update the version number to upgrade Chef to a newer version. 5 | # You may need to add an override attribute under 'chef' for 'server_path' 6 | # depending on your installation, eg: 7 | # "server_path" => "/usr/lib/ruby/gems/1.8/gems/chef-server-0.7.10" 8 | # On the line after server_version. Don't forget the comma ;). 9 | override_attributes( 10 | "chef" => { 11 | "client_version"=>"0.7.10", 12 | "server_version"=>"0.7.10" 13 | } 14 | ) 15 | -------------------------------------------------------------------------------- /bin/cloud-configure: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | $:.unshift(File.dirname(__FILE__) + "/../lib") 3 | require "poolparty" 4 | 5 | require 'git-style-binary/command' 6 | 7 | GitStyleBinary.command do 8 | banner <<-EOS 9 | Usage: #{$0} #{all_options_string} 10 | 11 | Configure a cloud instance 12 | EOS 13 | 14 | short_desc "Configure a cloud instance" 15 | 16 | opt :inst_num, "The number of the instance to run bootstrap on", :type => :int 17 | opt :generate_graph, "Generate the dependency tree graph", :type => :string, :default => nil 18 | 19 | run do |command| 20 | 21 | @loaded_clouds.each do |cld| 22 | 23 | cld.configure! 24 | 25 | end 26 | 27 | end 28 | end -------------------------------------------------------------------------------- /bin/cloud-bootstrap: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | $:.unshift(File.dirname(__FILE__) + "/../lib") 3 | require "poolparty" 4 | 5 | require 'git-style-binary/command' 6 | 7 | GitStyleBinary.command do 8 | banner <<-EOS 9 | Usage: #{$0} #{all_options_string} 10 | 11 | Bootstrap a cloud instance 12 | EOS 13 | 14 | short_desc "Bootstrap a cloud instance" 15 | 16 | opt :inst_num, "The number of the instance to run bootstrap on", :type => :int 17 | opt :force, "Force rebootstrapping (useful for upgrading)", :default => false 18 | 19 | run do |command| 20 | 21 | @loaded_clouds.each do |cld| 22 | 23 | cld.compile! 24 | cld.bootstrap! 25 | 26 | end 27 | 28 | end 29 | end -------------------------------------------------------------------------------- /bin/cloud-cssh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | $:.unshift(File.dirname(__FILE__) + "/../lib") 3 | require "poolparty" 4 | 5 | require 'git-style-binary/command' 6 | 7 | GitStyleBinary.command do 8 | banner <<-EOS 9 | Usage: #{$0} #{all_options_string} 10 | 11 | cssh into the cloud 12 | EOS 13 | 14 | short_desc "cssh into the cloud" 15 | 16 | opt :user, "the user name", :type => :string, :default => nil 17 | opt :use_keypair, "whether or not to use the default keypair", :type => :integer, :default => 0 18 | 19 | run do |command| 20 | cloud = @loaded_clouds.first 21 | 22 | user = command[:user] 23 | keyp = command[:use_keypair] 24 | 25 | cloud.cssh( user, keyp != 0 ) 26 | 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/ntp/templates/default/ntp.conf.erb: -------------------------------------------------------------------------------- 1 | driftfile /var/lib/ntp/ntp.drift 2 | statsdir /var/log/ntpstats/ 3 | 4 | statistics loopstats peerstats clockstats 5 | filegen loopstats file loopstats type day enable 6 | filegen peerstats file peerstats type day enable 7 | filegen clockstats file clockstats type day enable 8 | 9 | <% if @node[:ntp][:is_server] -%> 10 | server 0.us.pool.ntp.org 11 | server 1.us.pool.ntp.org 12 | server 2.us.pool.ntp.org 13 | server 3.us.pool.ntp.org 14 | <% else -%> 15 | <% @node[:ntp][:servers].each do |ntpserver| -%> 16 | server <%= ntpserver %> 17 | <% end -%> 18 | <% end -%> 19 | restrict default kod notrap nomodify nopeer noquery 20 | 21 | restrict 127.0.0.1 nomodify 22 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/templates/default/mods/proxy.conf.erb: -------------------------------------------------------------------------------- 1 | 2 | #turning ProxyRequests on and allowing proxying from all may allow 3 | #spammers to use your proxy to send email. 4 | 5 | ProxyRequests Off 6 | 7 | 8 | AddDefaultCharset off 9 | Order deny,allow 10 | Deny from all 11 | #Allow from .example.com 12 | 13 | 14 | # Enable/disable the handling of HTTP/1.1 "Via:" headers. 15 | # ("Full" adds the server version; "Block" removes all outgoing Via: headers) 16 | # Set to one of: Off | On | Full | Block 17 | 18 | ProxyVia On 19 | 20 | -------------------------------------------------------------------------------- /lib/poolparty/base.rb: -------------------------------------------------------------------------------- 1 | =begin rdoc 2 | Base class for all PoolParty objects 3 | =end 4 | module PoolParty 5 | 6 | class Base 7 | include Dslify 8 | attr_reader :name 9 | def initialize(name, o={}, &block) 10 | @name = name 11 | @init_opts = o 12 | set_vars_from_options(o) 13 | instance_eval &block if block 14 | after_initialized 15 | end 16 | def after_initialized 17 | end 18 | def run 19 | warn "#{self.class} does not implement run. Something is wrong" 20 | end 21 | def method_missing(m,*a,&block) 22 | if parent.respond_to?(m) 23 | parent.send(m,*a,&block) 24 | else 25 | super 26 | end 27 | end 28 | 29 | private 30 | end 31 | 32 | end -------------------------------------------------------------------------------- /lib/core/symbol.rb: -------------------------------------------------------------------------------- 1 | class Symbol 2 | # def >(num);"#{self} > #{num}";end 3 | # def <(num);"#{self} < #{num}";end 4 | # def >=(num);"#{self} >= #{num}";end 5 | # def <=(num);"#{self} <= #{num}";end 6 | # def ==(num);"#{self} > #{num}";end 7 | 8 | def sanitize 9 | self.to_s.sanitize 10 | end 11 | def <=>(b) 12 | "#{self}" <=> "#{b}" 13 | end 14 | ## 15 | # @param o The path component to join with the string. 16 | # 17 | # @return The original path concatenated with o. 18 | # 19 | # @example 20 | # :merb/"core_ext" #=> "merb/core_ext" 21 | def /(o) 22 | File.join(self.to_s, o.to_s) 23 | end 24 | 25 | # Classify the symbol 26 | def classify 27 | to_s.classify.to_sym 28 | end 29 | end -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/bootstrap/recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: bootstrap 3 | # Recipe:: client 4 | # 5 | # Copyright 2009, Opscode, Inc. 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 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/ec2/recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: ec2 3 | # Recipe:: default 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/site-cookbooks/ubuntu/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "Sets up sources for ubuntu", 3 | "replacing": { 4 | 5 | }, 6 | "recipes": { 7 | "ubuntu": "" 8 | }, 9 | "platforms": { 10 | "ubuntu": [ 11 | 12 | ] 13 | }, 14 | "maintainer": "Opscode, Inc.", 15 | "version": "0.7.0", 16 | "recommendations": { 17 | 18 | }, 19 | "name": "ubuntu", 20 | "maintainer_email": "cookbooks@opscode.com", 21 | "attributes": { 22 | 23 | }, 24 | "suggestions": { 25 | 26 | }, 27 | "license": "Apache 2.0", 28 | "conflicting": { 29 | 30 | }, 31 | "dependencies": { 32 | "apt": [ 33 | 34 | ] 35 | }, 36 | "providing": { 37 | "ubuntu": [ 38 | 39 | ] 40 | }, 41 | "long_description": "" 42 | } -------------------------------------------------------------------------------- /lib/cloud_providers/ec2/helpers/revoke.rb: -------------------------------------------------------------------------------- 1 | module CloudProviders 2 | 3 | class Revoke < Ec2Helper 4 | default_options({ 5 | :protocol => "tcp", 6 | :from_port => "22", 7 | :to_port => "22", 8 | :cidr_ip => "0.0.0.0/0"}) 9 | def run 10 | puts "Revoking: #{name} for #{protocol} to #{from_port}:#{to_port} #{network}" 11 | options = { :group_name => name, 12 | :ip_protocol => protocol, 13 | :from_port => from_port, 14 | :to_port => to_port, 15 | :cidr_ip => network} 16 | 17 | ec2.revoke_security_group_ingress(options) rescue nil 18 | end 19 | 20 | alias :network :cidr_ip 21 | 22 | end 23 | 24 | end 25 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/templates/default/a2dismod.erb: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | SYSCONFDIR='<%= @node[:apache][:dir] %>' 4 | 5 | if [ -z $1 ]; then 6 | echo "Which module would you like to disable?" 7 | echo -n "Your choices are: " 8 | ls $SYSCONFDIR/mods-enabled/*.load | \ 9 | sed -e "s,$SYSCONFDIR/mods-enabled/,,g" | sed -e 's/\.load$//g;' | xargs echo 10 | echo -n "Module name? " 11 | read MODNAME 12 | else 13 | MODNAME=$1 14 | fi 15 | 16 | if ! [ -e $SYSCONFDIR/mods-enabled/$MODNAME.load ]; then 17 | echo "This module is already disabled, or does not exist!" 18 | exit 1 19 | fi 20 | 21 | rm -f $SYSCONFDIR/mods-enabled/$MODNAME.* 22 | echo "Module $MODNAME disabled; reload apache to fully disable." -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_cgi.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: cgi 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | apache_module "cgi" 21 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_dav.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: dav 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | apache_module "dav" 21 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_env.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: env 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | apache_module "env" 21 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_ldap.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: ldap 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | apache_module "ldap" 21 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_expires.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: expires 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | apache_module "expires" 21 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_headers.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: headers 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | apache_module "headers" 21 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_proxy_ajp.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: proxy 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | apache_module "proxy_ajp" 21 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_rewrite.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: rewrite 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | apache_module "rewrite" 21 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/ganglia/attributes/default.rb: -------------------------------------------------------------------------------- 1 | set[:ganglia][:ganglia_this_nodes_private_ip] = ipaddress 2 | 3 | # set[:ganglia][:ganglia_gmetad_data_sources] = "foo" 4 | # set[:ganglia][:ganglia_pool_name] = "name" 5 | # set[:ganglia][:ganglia_cloud_name] = "foo" 6 | # set[:ganglia][:ganglia_first_node_in_clusters_ip] = "ip" 7 | # set[:ganglia][:gmond_user] = "root" 8 | # set[:ganglia][:gmetad_user] = "root" 9 | # set[:ganglia][:gmond_web_root] = "/var/www/ganglia" 10 | # set[:ganglia][:ganglia_gmetad_data_sources] = %Q{data_source "a name goes here todo" 127.0.0.1} # space separated ip/hostnames 11 | 12 | # # hopefully we can delete the attributes below now that the recipes are split up 13 | # set[:ganglia][:enable_web_interface] = false 14 | # set[:ganglia][:enable_gmetad] = false 15 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_auth_basic.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: auth_basic 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | apache_module "auth_basic" 21 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_auth_digest.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: auth_digest 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | apache_module "auth_digest" 21 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_authn_file.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: authn_file 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | apache_module "authn_file" 21 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_authnz_ldap.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: authnz_ldap 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | apache_module "authnz_ldap" 21 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_authz_host.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: authz_host 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | apache_module "authz_host" 21 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_authz_user.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: authz_user 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | apache_module "authz_user" 21 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_proxy_balancer.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: proxy 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | apache_module "proxy_balancer" 21 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_proxy_connect.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: proxy 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | apache_module "proxy_connect" 21 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_proxy_http.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: proxy_http 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | apache_module "proxy_http" 21 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/templates/default/mods/negotiation.conf.erb: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # LanguagePriority allows you to give precedence to some languages 4 | # in case of a tie during content negotiation. 5 | # 6 | # Just list the languages in decreasing order of preference. We have 7 | # more or less alphabetized them here. You probably want to change this. 8 | # 9 | LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv tr zh-CN zh-TW 10 | 11 | # 12 | # ForceLanguagePriority allows you to serve a result page rather than 13 | # MULTIPLE CHOICES (Prefer) [in case of a tie] or NOT ACCEPTABLE (Fallback) 14 | # [in case no accepted languages matched the available variants] 15 | # 16 | ForceLanguagePriority Prefer Fallback 17 | 18 | 19 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_authz_default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: authz_default 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | apache_module "authz_default" 21 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_dir.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: dir 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | apache_module "dir" do 21 | conf true 22 | end 23 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_mime.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: mime 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | apache_module "mime" do 21 | conf true 22 | end 23 | -------------------------------------------------------------------------------- /test/lib/core/array_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class ArrayTest < Test::Unit::TestCase 4 | def setup 5 | @arr = %w(a b c d) 6 | @hash_arr = [ 7 | {:name => "peter", :occupation => "computer scientist"}, 8 | {:name => "al", :occupation => "computer scientist"}, 9 | {:name => "matt", :occupation => "doctor"}, 10 | {:name => "jenna", :occupation => "lawyer"} 11 | ] 12 | end 13 | 14 | def test_be_able_to_select_with_hash 15 | assert_equal @hash_arr.select_with_hash(:name => "matt").first[:occupation], "doctor" 16 | assert_equal @hash_arr.select_with_hash(:occupation => "computer scientist").first[:name], "peter" 17 | assert @hash_arr.select_with_hash(:occupation => "matt").empty? 18 | end 19 | 20 | end -------------------------------------------------------------------------------- /vendor/gems/dslify/README.rdoc: -------------------------------------------------------------------------------- 1 | = dslify 2 | 3 | Dslify, born out of a need for improvement on Dslify 4 | 5 | Add dsl accessors to any class. 6 | 7 | Usage: 8 | class MyClass 9 | include Dslify 10 | 11 | dsl_methods :award, :people 12 | end 13 | 14 | mc = MyClass.new 15 | mc.award "Tony Award" 16 | mc.people ["Bob", "Frank", "Ben"] 17 | 18 | You can set defaults as well: 19 | class MyClass 20 | default_options :award => "Tony Award" 21 | end 22 | 23 | Finally, if your tree of available accessors runs higher and longer than 24 | just 1 file, for instance, if you use Parenting, you can set forwarders to 25 | forward the query up the chain 26 | 27 | class MyClass 28 | forwards_to :parent 29 | end 30 | 31 | == Copyright 32 | 33 | Copyright (c) 2009 Ari Lerner. See LICENSE for details. 34 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_alias.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: alias 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | apache_module "alias" do 21 | conf true 22 | end 23 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_authz_groupfile.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: authz_groupfile 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | apache_module "authz_groupfile" 21 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_proxy.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: proxy 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | apache_module "proxy" do 21 | conf true 22 | end 23 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_status.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: status 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | apache_module "status" do 21 | conf true 22 | end 23 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_deflate.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: deflate 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | apache_module "deflate" do 21 | conf true 22 | end 23 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_setenvif.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: setenvif 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | apache_module "setenvif" do 21 | conf true 22 | end 23 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/config/client.rb.example: -------------------------------------------------------------------------------- 1 | # 2 | # Example Chef Client Config File 3 | # 4 | # We recommend using Opscode's chef cookbook for managing chef itself, 5 | # instead of using this file. It is provided as an example. 6 | 7 | log_level :info 8 | log_location STDOUT 9 | ssl_verify_mode :verify_none 10 | registration_url "https://chef.localdomain" 11 | openid_url "https://chef.localdomain" 12 | template_url "https://chef.localdomain" 13 | remotefile_url "https://chef.localdomain" 14 | search_url "https://chef.localdomain" 15 | role_url "https://chef.localdomain" 16 | 17 | file_store_path "/srv/chef/file_store" 18 | file_cache_path "/srv/chef/cache" 19 | 20 | pid_file "/var/run/chef/chef-client.pid" 21 | 22 | Chef::Log::Formatter.show_time = true 23 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_autoindex.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: autoindex 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | apache_module "autoindex" do 21 | conf true 22 | end 23 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_dav_svn.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: dav_svn 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | package "libapache2-svn" 21 | 22 | apache_module "dav_svn" 23 | -------------------------------------------------------------------------------- /bin/cloud-run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | $:.unshift(File.dirname(__FILE__) + "/../lib") 3 | 4 | require "poolparty" 5 | require 'git-style-binary/command' 6 | 7 | GitStyleBinary.command do 8 | banner <<-EOS 9 | Usage: #{$0} #{all_options_string} 10 | 11 | Run a command on all running instances 12 | EOS 13 | 14 | opt :instance_id, "Run only on a specific instance", :type => String, :default => nil 15 | opt :command, "Command to run", :type => String, :default => nil 16 | 17 | short_desc "Run a command on all running instances" 18 | 19 | run do |command| 20 | puts "Running command #{command[:command]} on all nodes" 21 | @loaded_clouds.each do |cld| 22 | 23 | output = cld.nodes.map do |n| 24 | n.ssh(command[:command]) 25 | end 26 | 27 | #p output 28 | 29 | end 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_negotiation.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: negotiation 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | apache_module "negotiation" do 21 | conf true 22 | end 23 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_python.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: python 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | package "libapache2-mod-python" 21 | 22 | apache_module "python" 23 | -------------------------------------------------------------------------------- /bin/cloud-terminate: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | $:.unshift(File.dirname(__FILE__) + "/../lib") 3 | require "poolparty" 4 | 5 | require 'git-style-binary/command' 6 | 7 | GitStyleBinary.command do 8 | banner <<-EOS 9 | Usage: #{$0} #{all_options_string} COMMAND [ARGS] 10 | 11 | terminate the cloud 12 | EOS 13 | 14 | short_desc "terminate the cloud" 15 | 16 | opt :yes, "Answer yes to the are you sure question", :type => :boolean, :default => false 17 | 18 | run do |command| 19 | @loaded_clouds.each do |cld| 20 | msg = [ 21 | "Shutting down #{cld.name} cloud", 22 | "Are you sure? (Y/N)" 23 | ] 24 | 25 | o = command[:yes] || true 26 | if o 27 | puts "Shutting down cloud" 28 | cld.teardown 29 | else 30 | 31 | end 32 | 33 | end 34 | end 35 | end -------------------------------------------------------------------------------- /test/fixtures/ec2/ec2-describe-security-groups_response_body.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 1234567890 6 | poolparty-fake_cloud 7 | poolparty-fake_cloud 8 | 9 | 10 | tcp 11 | 80 12 | 80 13 | 14 | 15 | 16 | 0.0.0.0/0 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /bin/cloud-ssh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | $:.unshift(File.dirname(__FILE__) + "/../lib") 3 | require "poolparty" 4 | 5 | require 'git-style-binary/command' 6 | 7 | GitStyleBinary.command do 8 | banner <<-EOS 9 | Usage: #{$0} #{all_options_string} 10 | 11 | ssh into an instance of the cloud 12 | EOS 13 | 14 | short_desc "ssh into an instance of the cloud" 15 | 16 | opt :instance_number, "Ssh into the instance number", :type => :integer, :default => 0 17 | 18 | run do |command| 19 | cloud = @loaded_clouds.first 20 | 21 | if !cloud.nodes.empty? 22 | inst = cloud.nodes[command[:instance_number]] 23 | inst ? inst.ssh : puts("Error: The instance number (#{command[:instance_number]}) is too high for the current number of instances") 24 | else 25 | puts "No running instances can be found" 26 | end 27 | 28 | end 29 | end -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/site-cookbooks/ubuntu/templates/default/sources.list.erb: -------------------------------------------------------------------------------- 1 | # 2 | # Ubuntu <%= @code_name %> - Generated by Chef 3 | # 4 | deb http://apt.opscode.com/ <%= @code_name %> universe 5 | 6 | deb http://us.archive.ubuntu.com/ubuntu <%= @code_name %> main restricted universe multiverse 7 | deb-src http://us.archive.ubuntu.com/ubuntu <%= @code_name %> main restricted universe multiverse 8 | 9 | deb http://us.archive.ubuntu.com/ubuntu <%= @code_name %>-updates main restricted universe multiverse 10 | deb-src http://us.archive.ubuntu.com/ubuntu <%= @code_name %>-updates main restricted universe multiverse 11 | 12 | # 13 | # Security updates 14 | # 15 | deb http://security.ubuntu.com/ubuntu <%= @code_name %>-security main restricted universe multiverse 16 | deb-src http://security.ubuntu.com/ubuntu <%= @code_name %>-security main restricted universe multiverse 17 | -------------------------------------------------------------------------------- /vendor/gems/git-style-binaries/test/test_helper.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'test/unit' 3 | require 'shoulda' 4 | begin require 'redgreen'; rescue LoadError; end 5 | require 'open3' 6 | 7 | $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) 8 | $LOAD_PATH.unshift(File.dirname(__FILE__)) 9 | Dir[File.join(File.dirname(__FILE__), "shoulda_macros", "*.rb")].each {|f| require f} 10 | ENV['NO_COLOR'] = "true" 11 | 12 | require 'git-style-binary' 13 | GitStyleBinary.run = true 14 | 15 | class Test::Unit::TestCase 16 | def FIXTURES_PATH 17 | File.join(File.dirname(__FILE__), "fixtures") 18 | end 19 | end 20 | 21 | module RunsBinaryFixtures 22 | # run the specified cmd returning the string values of [stdout,stderr] 23 | def bin(cmd) 24 | stdin, stdout, stderr = Open3.popen3("#{FIXTURES_PATH}/#{cmd}") 25 | [stdout.read, stderr.read] 26 | end 27 | end 28 | 29 | -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- 1 | $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) 2 | $LOAD_PATH.unshift(File.dirname(__FILE__)) 3 | 4 | ENV['RACK_ENV'] ||= 'test' 5 | 6 | # Test dependencies 7 | %w(fakeweb right_http_connection matchy shoulda).each do |dep| 8 | $LOAD_PATH.unshift(File.join(File.dirname(__FILE__),'..', 'vendor/gems', dep, 'lib')) 9 | # require "#{dep}" 10 | end 11 | 12 | require 'poolparty' 13 | 14 | require "rubygems" 15 | require "test/unit" 16 | # TODO: Rip out shoulda 17 | require "shoulda" 18 | require 'mocha' # ARG! don't want to introduce additional test dependencies, but FakeWeb can only handle one fake post per URL!!! 19 | require 'webmock/test_unit' 20 | require 'pathname' 21 | 22 | require 'git-style-binary/command' 23 | 24 | require "test_methods" 25 | 26 | GitStyleBinary.run = true 27 | 28 | FIXTURES_PATH = Pathname.new(File.expand_path('../fixtures', __FILE__)) -------------------------------------------------------------------------------- /bin/cloud-expand: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | $:.unshift(File.dirname(__FILE__) + "/../lib") 3 | require "poolparty" 4 | 5 | require 'git-style-binary/command' 6 | 7 | GitStyleBinary.command do 8 | banner <<-EOS 9 | Usage: #{$0} #{all_options_string} 10 | 11 | expands the cloud by a single instance 12 | EOS 13 | 14 | short_desc "expands the cloud by a single instance" 15 | 16 | run do |command| 17 | @loaded_clouds.each do |cld| 18 | 19 | msg = [ 20 | "Expanding cloud #{cld.name} (#{cld.keypair})", 21 | "#{cld.nodes.size} running instances (#{cld.minimum_instances} - #{cld.maximum_instances})" 22 | ] 23 | 24 | print_msg(msg) 25 | 26 | inst = cld.expand_by(1) 27 | 28 | msg = [ 29 | "Your cloud has expanded by node: #{inst.public_ip}" 30 | ] 31 | 32 | print_msg(msg) 33 | 34 | end 35 | 36 | end 37 | end -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_log_config.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: log_config 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | if platform?("centos", "redhat", "fedora", "suse") 21 | apache_module "log_config" 22 | else 23 | include_recipe "apache2" 24 | end 25 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apt/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "Configures apt and apt services", 3 | "replacing": { 4 | 5 | }, 6 | "recipes": { 7 | "apt::proxy": "Set up an APT proxy", 8 | "apt": "", 9 | "apt::cacher": "Set up an APT cache" 10 | }, 11 | "platforms": { 12 | "ubuntu": [ 13 | 14 | ], 15 | "debian": [ 16 | 17 | ] 18 | }, 19 | "maintainer": "Opscode, Inc.", 20 | "version": "0.7.0", 21 | "recommendations": { 22 | 23 | }, 24 | "name": "apt", 25 | "maintainer_email": "cookbooks@opscode.com", 26 | "attributes": { 27 | 28 | }, 29 | "suggestions": { 30 | 31 | }, 32 | "license": "Apache 2.0", 33 | "conflicting": { 34 | 35 | }, 36 | "dependencies": { 37 | 38 | }, 39 | "providing": { 40 | "apt::proxy": [ 41 | 42 | ], 43 | "apt": [ 44 | 45 | ], 46 | "apt::cacher": [ 47 | 48 | ] 49 | }, 50 | "long_description": "" 51 | } -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/runit/attributes/sv_bin.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: runit 3 | # Attribute File:: sv_bin 4 | # 5 | # Copyright 2008, OpsCode, Inc. 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 | runit Mash.new 21 | 22 | case platform 23 | when "ubuntu","debian" 24 | runit[:sv_bin] = "/usr/bin/sv" 25 | runit[:service_dir] = "/etc/service" 26 | runit[:sv_dir] = "/etc/sv" 27 | end 28 | -------------------------------------------------------------------------------- /lib/poolparty/chef_attribute.rb: -------------------------------------------------------------------------------- 1 | module PoolParty 2 | class ChefAttribute < Base 3 | attr_reader :init_opts 4 | def initialize(opts={}, &block) 5 | @init_block = block 6 | @init_opts = opts 7 | instance_eval &block if block 8 | @base_name = self.name 9 | end 10 | 11 | def merge!(h={}) 12 | init_opts.merge!(h) 13 | end 14 | 15 | def to_dna(recipes, filepath, opts=init_opts) 16 | if recipes && !recipes.empty? 17 | (opts[:recipes] ||= []) << recipes 18 | opts[:recipes].flatten! 19 | end 20 | 21 | opts.delete(:name) if opts[:name] && opts[:name].empty? 22 | File.open(filepath, "w") do |f| 23 | f << JSON.pretty_generate(opts) 24 | end 25 | end 26 | 27 | def method_missing(m,*a,&block) 28 | if @init_opts.has_key?(m) 29 | @init_opts[m] 30 | else 31 | @init_opts.merge!(m => a) 32 | end 33 | end 34 | 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/templates/default/a2dissite.erb: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | SYSCONFDIR='<%= @node[:apache][:dir] %>' 4 | 5 | if [ -z $1 ]; then 6 | echo "Which site would you like to disable?" 7 | echo -n "Your choices are: " 8 | ls $@node[:apache][:dir]/sites-enabled/* | \ 9 | sed -e "s,$SYSCONFDIR/sites-enabled/,,g" | xargs echo 10 | echo -n "Site name? " 11 | read SITENAME 12 | else 13 | SITENAME=$1 14 | fi 15 | 16 | if [ $SITENAME = "default" ]; then 17 | PRIORITY="000" 18 | fi 19 | 20 | if ! [ -e $SYSCONFDIR/sites-enabled/$SITENAME -o \ 21 | -e $SYSCONFDIR/sites-enabled/"$PRIORITY"-"$SITENAME" ]; then 22 | echo "This site is already disabled, or does not exist!" 23 | exit 1 24 | fi 25 | 26 | if ! rm $SYSCONFDIR/sites-enabled/$SITENAME 2>/dev/null; then 27 | rm -f $SYSCONFDIR/sites-enabled/"$PRIORITY"-"$SITENAME" 28 | fi 29 | echo "Site $SITENAME disabled; reload apache to disable." -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/templates/default/mods/alias.conf.erb: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # Aliases: Add here as many aliases as you need (with no limit). The format is 4 | # Alias fakename realname 5 | # 6 | # Note that if you include a trailing / on fakename then the server will 7 | # require it to be present in the URL. So "/icons" isn't aliased in this 8 | # example, only "/icons/". If the fakename is slash-terminated, then the 9 | # realname must also be slash terminated, and if the fakename omits the 10 | # trailing slash, the realname must also omit it. 11 | # 12 | # We include the /icons/ alias for FancyIndexed directory listings. If 13 | # you do not use FancyIndexing, you may comment this out. 14 | # 15 | Alias /icons/ "<%= @node[:apache][:icondir] %>" 16 | 17 | "> 18 | Options Indexes MultiViews 19 | AllowOverride None 20 | Order allow,deny 21 | Allow from all 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/runit/metadata.rb: -------------------------------------------------------------------------------- 1 | maintainer "Opscode, Inc." 2 | maintainer_email "cookbooks@opscode.com" 3 | license "Apache 2.0" 4 | description "Installs runit and provides runit_service definition" 5 | version "0.7" 6 | 7 | %w{ ubuntu debian }.each do |os| 8 | supports os 9 | end 10 | 11 | attribute "runit", 12 | :display_name => "Runit", 13 | :description => "Hash of runit attributes", 14 | :type => "hash" 15 | 16 | attribute "runit/sv_bin", 17 | :display_name => "Runit sv bin", 18 | :description => "Location of the sv binary", 19 | :default => "/usr/bin/sv" 20 | 21 | attribute "runit/service_dir", 22 | :display_name => "Runit service directory", 23 | :description => "Symlinks to services managed under runit", 24 | :default => "/etc/service" 25 | 26 | attribute "runit/sv_dir", 27 | :display_name => "Runit sv directory", 28 | :description => "Location of services managed by runit", 29 | :default => "/etc/sv" 30 | 31 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/definitions/apache_conf.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Definition:: apache_conf 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | define :apache_conf do 21 | template "#{node[:apache][:dir]}/mods-available/#{params[:name]}.conf" do 22 | source "mods/#{params[:name]}.conf.erb" 23 | notifies :restart, resources(:service => "apache2") 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/ntp/metadata.rb: -------------------------------------------------------------------------------- 1 | maintainer "Opscode, Inc." 2 | maintainer_email "cookbooks@opscode.com" 3 | license "Apache 2.0" 4 | description "Installs and configures ntp as a client or server" 5 | version "0.7" 6 | 7 | %w{ ubuntu debian redhat centos fedora }.each do |os| 8 | supports os 9 | end 10 | 11 | attribute "ntp", 12 | :display_name => "NTP", 13 | :description => "Hash of NTP attributes", 14 | :type => "hash" 15 | 16 | attribute "ntp/service", 17 | :display_name => "NTP Service", 18 | :description => "Name of the NTP service", 19 | :default => "ntp" 20 | 21 | attribute "ntp/is_server", 22 | :display_name => "NTP Is Server?", 23 | :description => "Set to true if this is an NTP server", 24 | :default => "false" 25 | 26 | attribute "ntp/servers", 27 | :display_name => "NTP Servers", 28 | :description => "Array of servers we should talk to", 29 | :type => "array", 30 | :default => ["0.us.pool.ntp.org", "1.us.pool.ntp.org"] 31 | 32 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apt/recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apt 3 | # Recipe:: default 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 "apt-get-update" do 21 | command "apt-get update" 22 | end 23 | 24 | %w{/var/cache/local /var/cache/local/preseeding}.each do |dirname| 25 | directory dirname do 26 | owner "root" 27 | group "root" 28 | mode 0644 29 | action :create 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/rsyslog/attributes/rsyslog.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: rsyslog 3 | # Attributes:: rsyslog 4 | # 5 | # Copyright 2009, Opscode, Inc. 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 | rsyslog Mash.new unless attribute?("rsyslog") 21 | 22 | rsyslog[:log_dir] = "/srv/rsyslog" unless rsyslog.has_key?(:log_dir) 23 | rsyslog[:server] = false unless rsyslog.has_key?(:server) 24 | rsyslog[:protocol] = "tcp" unless rsyslog.has_key?(:protocol) 25 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/ganglia/templates/default/bin/gmond.erb: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin 4 | DAEMON=/usr/sbin/gmond 5 | NAME=gmond 6 | DESC="Ganglia Monitor Daemon" 7 | 8 | test -x $DAEMON || exit 0 9 | set -e 10 | 11 | case "$1" in 12 | start) 13 | echo -n "Starting $DESC: " 14 | start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \ 15 | --exec $DAEMON 16 | echo "$NAME." 17 | ;; 18 | stop) 19 | echo -n "Stopping $DESC: " 20 | start-stop-daemon --stop --quiet --oknodo \ 21 | --exec $DAEMON 2>&1 > /dev/null 22 | echo "$NAME." 23 | ;; 24 | reload) 25 | ;; 26 | restart|force-reload) 27 | $0 stop 28 | $0 start 29 | ;; 30 | *) 31 | N=/etc/init.d/$NAME 32 | # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 33 | echo "Usage: $N {start|stop|restart|force-reload}" >&2 34 | exit 1 35 | ;; 36 | esac 37 | 38 | exit 0 39 | -------------------------------------------------------------------------------- /test/fixtures/chef/recipes/sudo/recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: sudo 3 | # Recipe:: default 4 | # 5 | # Copyright 2008, OpsCode, Inc. 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 | package "sudo" do 21 | action :upgrade 22 | end 23 | 24 | template "/etc/sudoers" do 25 | source "sudoers.erb" 26 | mode 0440 27 | owner "root" 28 | group "root" 29 | variables( 30 | :sudoers_groups => node[:authorization][:sudo][:groups], 31 | :sudoers_users => node[:authorization][:sudo][:users] 32 | ) 33 | end -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/ganglia/templates/default/bin/gmetad.erb: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin 4 | DAEMON=/usr/sbin/gmetad 5 | NAME=gmetad 6 | DESC="Ganglia Monitor Meta-Daemon" 7 | 8 | test -x $DAEMON || exit 0 9 | set -e 10 | 11 | case "$1" in 12 | start) 13 | echo -n "Starting $DESC: " 14 | start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \ 15 | --exec $DAEMON 16 | echo "$NAME." 17 | ;; 18 | stop) 19 | echo -n "Stopping $DESC: " 20 | start-stop-daemon --stop --quiet --oknodo \ 21 | --exec $DAEMON 2>&1 > /dev/null 22 | echo "$NAME." 23 | ;; 24 | reload) 25 | ;; 26 | restart|force-reload) 27 | $0 stop 28 | $0 start 29 | ;; 30 | *) 31 | N=/etc/init.d/$NAME 32 | # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 33 | echo "Usage: $N {start|stop|restart|force-reload}" >&2 34 | exit 1 35 | ;; 36 | esac 37 | 38 | exit 0 39 | -------------------------------------------------------------------------------- /lib/cloud_providers/ec2/helpers/elastic_ip.rb: -------------------------------------------------------------------------------- 1 | module CloudProviders 2 | 3 | class ElasticIp < Ec2Helper 4 | 5 | default_options(:instance_id => nil, :public_ip => nil) 6 | 7 | def initialize(raw_response={}) 8 | @raw_response = raw_response 9 | self.instance_id = raw_response["instanceId"] 10 | self.public_ip = raw_response["publicIp"] 11 | end 12 | 13 | def assign_to(node) 14 | puts "-----> Assigning #{public_ip} to node: #{node.instance_id}" 15 | end 16 | 17 | def self.unused_elastic_ips(ec2_instance) 18 | @unused_elastic_ips ||= elastic_ips(ec2_instance).select {|ip| ip.instance_id.nil? } 19 | end 20 | 21 | def self.elastic_ips(ec2_instance) 22 | begin 23 | @elastic_ips ||= ec2_instance.ec2.describe_addresses.addressesSet.item.map do |i| 24 | new(i) 25 | end 26 | rescue Exception => e 27 | [] 28 | end 29 | end 30 | 31 | def self.reset! 32 | @elastic_ips = @unused_elastic_ips = nil 33 | end 34 | 35 | end 36 | 37 | end -------------------------------------------------------------------------------- /vendor/gems/git-style-binaries/test/fixtures/wordpress-post: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | $:.unshift(File.dirname(__FILE__) + "/../../lib") 3 | require 'git-style-binary/command' 4 | 5 | GitStyleBinary.command do 6 | short_desc "create a blog post" 7 | banner <<-EOS 8 | SYNOPSIS 9 | #{command.full_name} #{all_options_string} {content|STDIN} 10 | 11 | EOS 12 | opt :blog, "short name of the blog to use", :default => 'default' 13 | opt :category, "tag/category. specify multiple times for multiple categories", :type => String, :multi => true 14 | opt :title, "title for the post", :required => true, :type => String 15 | opt :type, "type of the content [html|xhtml|text]", :default => 'html', :type => String 16 | 17 | run do |command| 18 | command.die :type, "type must be one of [html|xhtml|text]" unless command.opts[:type] =~ /^(x?html|text)$/i 19 | 20 | puts "Subcommand name: #{command.name.inspect}" 21 | puts "Options: #{command.opts.inspect}" 22 | puts "Remaining arguments: #{command.argv.inspect}" 23 | end 24 | end 25 | 26 | 27 | -------------------------------------------------------------------------------- /vendor/gems/dslify/dslify.gemspec: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | 3 | Gem::Specification.new do |s| 4 | s.name = %q{dslify} 5 | s.version = "0.1.0" 6 | 7 | s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= 8 | s.authors = ["Ari Lerner"] 9 | s.date = %q{2009-05-14} 10 | s.email = %q{arilerner@mac.com} 11 | s.extra_rdoc_files = ["README.rdoc", "LICENSE"] 12 | s.files = ["README.rdoc", "VERSION.yml", "lib/dslify.rb", "test/dslify_test.rb", "test/test_helper.rb", "LICENSE"] 13 | s.has_rdoc = true 14 | s.homepage = %q{http://github.com/auser/dslify} 15 | s.rdoc_options = ["--inline-source", "--charset=UTF-8"] 16 | s.require_paths = ["lib"] 17 | s.rubygems_version = %q{1.3.2} 18 | s.summary = %q{TODO} 19 | 20 | if s.respond_to? :specification_version then 21 | current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION 22 | s.specification_version = 3 23 | 24 | if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then 25 | else 26 | end 27 | else 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /lib/cloud_providers/ec2/helpers/ec2_helper.rb: -------------------------------------------------------------------------------- 1 | module CloudProviders 2 | class Ec2Helper < CloudProvider 3 | 4 | def initialize(name=cloud.proper_name, init_opts={}, &block) 5 | @name = name 6 | if name.is_a?(Hash) 7 | @name = name[:name] 8 | @init_opts = name if init_opts.empty? 9 | else 10 | @init_opts = init_opts 11 | end 12 | set_vars_from_options(init_opts) 13 | instance_eval &block if block 14 | after_initialized 15 | end 16 | 17 | def elb 18 | cloud.elb 19 | end 20 | 21 | def ec2 22 | cloud.ec2 23 | end 24 | 25 | def as 26 | cloud.as 27 | end 28 | 29 | def rds 30 | cloud.awsrds 31 | end 32 | 33 | def pool 34 | cloud.parent 35 | end 36 | 37 | def self.property(*names) 38 | names.each do |name| 39 | define_method name do |*args| 40 | instance_variable_set("@#{name}", args.first) unless args.empty? 41 | instance_variable_get("@#{name}") 42 | end 43 | end 44 | end 45 | 46 | end 47 | end 48 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/files/default/apache2_module_conf_generate.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | =begin 4 | 5 | Generates Ubuntu style module.load files. 6 | 7 | ./apache2_module_conf_generate.pl /usr/lib64/httpd/modules /etc/httpd/mods-available 8 | 9 | ARGV[0] is the apache modules directory, ARGV[1] is where you want 'em. 10 | 11 | =cut 12 | 13 | use File::Find; 14 | 15 | use strict; 16 | use warnings; 17 | 18 | die "Must have '/path/to/modules' and '/path/to/modules.load'" 19 | unless $ARGV[0] && $ARGV[1]; 20 | 21 | find( 22 | { 23 | wanted => sub { 24 | return 1 if $File::Find::name !~ /\.so$/; 25 | my $modfile = $_; 26 | $modfile =~ /(lib|mod_)(.+)\.so$/; 27 | my $modname = $2; 28 | my $filename = "$ARGV[1]/$modname.load"; 29 | unless ( -f $filename ) { 30 | open( FILE, ">", $filename ) or die "Cannot open $filename"; 31 | print FILE "LoadModule " . $modname . "_module $File::Find::name\n"; 32 | close(FILE); 33 | } 34 | }, 35 | follow => 1, 36 | }, 37 | $ARGV[0] 38 | ); 39 | 40 | exit 0; 41 | 42 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_php5.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: php5 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | case node[:platform] 21 | when "debian", "ubuntu" 22 | package "libapache2-mod-php5" do 23 | action :install 24 | end 25 | when "centos", "redhat", "fedora" 26 | package "php" do 27 | action :install 28 | notifies :run, resources(:execute => "generate-module-list"), :immediately 29 | end 30 | end 31 | 32 | apache_module "php5" 33 | -------------------------------------------------------------------------------- /test/fixtures/chef/recipes/sudo/attributes/sudoers.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: sudo 3 | # Attribute File:: sudoers 4 | # 5 | # Copyright 2008, OpsCode, Inc. 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 | authorization Mash.new unless attribute?("authorization") 21 | 22 | authorization[:sudo] = Mash.new unless authorization.has_key?(:sudo) 23 | 24 | unless authorization[:sudo].has_key?(:groups) 25 | authorization[:sudo][:groups] = Array.new 26 | end 27 | 28 | unless authorization[:sudo].has_key?(:users) 29 | authorization[:sudo][:users] = Array.new 30 | end 31 | -------------------------------------------------------------------------------- /License.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 Ari Lerner 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /test/lib/poolparty/rds_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class RdsTest < Test::Unit::TestCase 4 | def setup 5 | stub_ec2_calls 6 | stub_response(AWS::EC2::Base, :describe_security_groups, 'ec2-describe-security-groups') 7 | stub_response(AWS::EC2::Base, :run_instances, 'ec2-run-instances') 8 | stub_response(AWS::RDS::Base, :describe_db_instances, 'rds-describe-db-instances-empty') 9 | reset! 10 | end 11 | 12 | def test_basic 13 | scenario "rds_cloud" 14 | end 15 | 16 | def test_required_properties 17 | assert_raises(RuntimeError) { scenario "rds_missing_params" } 18 | end 19 | 20 | private 21 | 22 | def scenario(filename) 23 | clear! 24 | 25 | @filepath = File.join(FIXTURES_PATH, "clouds/#{filename}.rb") 26 | require @filepath 27 | @cloud = pool.clouds[pool.clouds.keys.first] 28 | 29 | @cloud.run 30 | end 31 | 32 | def stub_response(klass, method, fixture_filename) 33 | klass.any_instance.stubs(method).returns AWS::Response.parse(:xml => open(File.join(FIXTURES_PATH, "ec2/#{fixture_filename}_response_body.xml")).read) 34 | end 35 | end -------------------------------------------------------------------------------- /vendor/gems/git-style-binaries/test/git_style_binary_test.rb: -------------------------------------------------------------------------------- 1 | require File.dirname(__FILE__) + "/test_helper.rb" 2 | 3 | class GitStyleBinariesTest < Test::Unit::TestCase 4 | context "parsing basenames" do 5 | should "accurately parse basenames" do 6 | assert_equal "wordpress", GitStyleBinary.basename("bin/wordpress") 7 | assert_equal "wordpress", GitStyleBinary.basename("bin/wordpress-post") 8 | assert_equal "wordpress", GitStyleBinary.basename("wordpress-post") 9 | end 10 | 11 | should "get the current command name" do 12 | # doesn't really apply any more b/c it calls 'current' which is never the 13 | # current when your running rake_test_loader.rb 14 | # 15 | # assert_equal "wordpress", GitStyleBinary.current_command_name("bin/wordpress", ["--help"]) 16 | # assert_equal "post", GitStyleBinary.current_command_name("bin/wordpress-post", ["--help"]) 17 | # assert_equal "post", GitStyleBinary.current_command_name("bin/wordpress post", ["--help"]) 18 | #assert_equal "post", GitStyleBinary.current_command_name("bin/wordpress post", []) 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /vendor/gems/dslify/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 Ari Lerner 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/gems/git-style-binaries/lib/git-style-binary/helpers/pager.rb: -------------------------------------------------------------------------------- 1 | module GitStyleBinary 2 | module Helpers 3 | module Pager 4 | 5 | # by Nathan Weizenbaum - http://nex-3.com/posts/73-git-style-automatic-paging-in-ruby 6 | def run_pager 7 | return if RUBY_PLATFORM =~ /win32/ 8 | return unless STDOUT.tty? 9 | STDOUT.use_color = true 10 | 11 | read, write = IO.pipe 12 | 13 | unless Kernel.fork # Child process 14 | STDOUT.reopen(write) 15 | STDERR.reopen(write) if STDERR.tty? 16 | read.close 17 | write.close 18 | return 19 | end 20 | 21 | # Parent process, become pager 22 | STDIN.reopen(read) 23 | read.close 24 | write.close 25 | 26 | ENV['LESS'] = 'FSRX' # Don't page if the input is short enough 27 | 28 | Kernel.select [STDIN] # Wait until we have input before we start the pager 29 | pager = ENV['PAGER'] || 'less -erXF' 30 | exec pager rescue exec "/bin/sh", "-c", pager 31 | end 32 | 33 | module_function :run_pager 34 | 35 | end 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apt/recipes/proxy.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apt 3 | # Recipe:: proxy 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | package "apt-proxy" do 20 | action :install 21 | end 22 | 23 | service "apt-proxy" do 24 | supports :restart => true, :status => false 25 | action [ :enable, :start ] 26 | end 27 | 28 | remote_file "/etc/apt-proxy/apt-proxy-v2.conf" do 29 | source "apt-proxy-v2.conf" 30 | owner "root" 31 | group "root" 32 | mode 0644 33 | notifies :restart, resources(:service => "apt-proxy") 34 | end 35 | -------------------------------------------------------------------------------- /vendor/gems/searchable_paths/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 Ari Lerner 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/gems/git-style-binaries/lib/git-style-binary/commands/help.rb: -------------------------------------------------------------------------------- 1 | module GitStyleBinary 2 | module Commands 3 | class Help 4 | # not loving this syntax, but works for now 5 | GitStyleBinary.command do 6 | short_desc "get help for a specific command" 7 | run do |command| 8 | 9 | # this is slightly ugly b/c it has to muck around in the internals to 10 | # get information about commands other than itself. This isn't a 11 | # typical case 12 | def educate_about_command(name) 13 | load_all_commands 14 | if GitStyleBinary.known_commands.has_key?(name) 15 | cmd = GitStyleBinary.known_commands[name] 16 | cmd.process_parser! 17 | cmd.parser.educate 18 | else 19 | puts "Unknown command '#{name}'" 20 | end 21 | end 22 | 23 | if command.argv.size > 0 24 | command.argv.first == "help" ? educate : educate_about_command(command.argv.first) 25 | else 26 | educate 27 | end 28 | end 29 | end 30 | end 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/rsyslog/metadata.rb: -------------------------------------------------------------------------------- 1 | maintainer "Opscode, Inc." 2 | maintainer_email "cookbooks@opscode.com" 3 | license "Apache 2.0" 4 | description "Installs and configures rsyslog" 5 | long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc')) 6 | version "0.7" 7 | recipe "rsyslog::client", "Sets up a client to log to a remote rsyslog server" 8 | recipe "rsyslog::server", "Sets up an rsyslog server" 9 | 10 | attribute "rsyslog", 11 | :display_name => "Rsyslog", 12 | :description => "Hash of Rsyslog attributes", 13 | :type => "hash" 14 | 15 | attribute "rsyslog/log_dir", 16 | :display_name => "Rsyslog Log Directory", 17 | :description => "Filesystem location of logs from clients", 18 | :default => "/srv/rsyslog" 19 | 20 | attribute "rsyslog/server", 21 | :display_name => "Rsyslog Server?", 22 | :description => "Is this node an rsyslog server?", 23 | :default => "false" 24 | 25 | attribute "rsyslog/protocol", 26 | :display_name => "Rsyslog Protocol", 27 | :description => "Set which network protocol to use for rsyslog", 28 | :default => "tcp" 29 | 30 | -------------------------------------------------------------------------------- /examples/simple.rb: -------------------------------------------------------------------------------- 1 | # the following three lines are only necessary if you want to irb -r thisfile 2 | $:.unshift("#{File.dirname(__FILE__)}/../lib") 3 | require "rubygems" 4 | require "poolparty" 5 | 6 | pool "poolparty" do 7 | 8 | cloud "simple" do 9 | instances 1..3 10 | using :ec2 11 | # autoscale do 12 | # trigger :lower_threshold => 0.3, :upper_threshold => 1.0, :measure => :cpu 13 | # end 14 | image_id "ami-ccf615a5" #alestic jaunty 15 | availability_zones ['us-east-1b'] 16 | #TODO: accept array of hashes defining security group rules 17 | # security_gropup [ 18 | # {:port=>22, :protocol=>'tcp' }, 19 | # {:port=>80, :protocol=>'tcp' :source=>'10.0.0.0/8', :group=>'monitor'}, 20 | # {:port=>3000..3006, :protocol=>'tcp' :group=>'monitor' }, 21 | # {:port=>53, :protocol=>'udp' } 22 | # ] 23 | security_group "dummy-test-security-group" do 24 | %w(22 80 443 8642).each {|port| authorize :from_port => port, :to_port => port} 25 | end 26 | # load_balancer do 27 | # listener :external_port => 8080, :internal_port => 8080, :protocol => 'tcp' 28 | # end 29 | end 30 | 31 | end -------------------------------------------------------------------------------- /poolparty.gemspec: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | $:.push File.expand_path("../lib", __FILE__) 3 | require "poolparty/version" 4 | 5 | Gem::Specification.new do |s| 6 | s.name = "poolparty" 7 | s.version = PoolParty::VERSION 8 | 9 | s.authors = ["Ari Lerner", "Michael Fairchild", "Nate Murray"] 10 | s.email = %q{arilerner@mac.com} 11 | s.homepage = %q{http://poolpartyrb.com} 12 | s.summary = %q{Simple DSL to describe and realize cloud deployment architectures.} 13 | s.description = %q{PoolParty: The easy, open-source, cross-cloud management solution} 14 | 15 | s.extra_rdoc_files = [ "README.rdoc" ] 16 | s.rdoc_options = ["--quiet", "--title", "PoolParty documentation", "--line-numbers", "--main", "README.rdoc"] 17 | 18 | s.files = `git ls-files`.split("\n") 19 | s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") 20 | s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } 21 | s.require_paths = ["lib"] 22 | 23 | s.add_runtime_dependency("amazon-ec2", "~> 0.9.17") 24 | s.add_runtime_dependency("xml-simple", ">= 0") 25 | s.add_runtime_dependency("json", ">= 0") 26 | end 27 | 28 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/site-cookbooks/ubuntu/recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: ubuntu 3 | # Recipe:: default 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | template "/etc/apt/sources.list" do 21 | mode 0644 22 | variables :code_name => node[:lsb][:codename] 23 | source "sources.list.erb" 24 | end 25 | 26 | execute 'opscode apt key' do 27 | command "cd /etc/apt/ && curl --output opscode.com.gpg.key http://apt.opscode.com/packages@opscode.com.gpg.key && sudo apt-key add opscode.com.gpg.key && apt-get update" 28 | creates "/etc/apt/opscode.com.gpg.key" 29 | end 30 | 31 | #include_recipe "apt" 32 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/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 | require 'rubygems' 22 | require 'chef' 23 | require 'json' 24 | 25 | # Make sure you have loaded constants first 26 | require File.join(File.dirname(__FILE__), 'config', 'rake') 27 | 28 | # And choosen a VCS 29 | if File.directory?(File.join(TOPDIR, ".svn")) 30 | $vcs = :svn 31 | elsif File.directory?(File.join(TOPDIR, ".git")) 32 | $vcs = :git 33 | end 34 | 35 | load 'chef/tasks/chef_repo.rake' 36 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/templates/default/a2ensite.erb: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | SYSCONFDIR='<%= @node[:apache][:dir] %>' 4 | 5 | if [ -z $1 ]; then 6 | echo "Which site would you like to enable?" 7 | echo -n "Your choices are: " 8 | ls $SYSCONFDIR/sites-available/* | \ 9 | sed -e "s,$SYSCONFDIR/sites-available/,,g" | xargs echo 10 | echo -n "Site name? " 11 | read SITENAME 12 | else 13 | SITENAME=$1 14 | fi 15 | 16 | if [ $SITENAME = "default" ]; then 17 | PRIORITY="000" 18 | fi 19 | 20 | if [ -e $SYSCONFDIR/sites-enabled/$SITENAME -o \ 21 | -e $SYSCONFDIR/sites-enabled/"$PRIORITY"-"$SITENAME" ]; then 22 | echo "This site is already enabled!" 23 | exit 0 24 | fi 25 | 26 | if ! [ -e $SYSCONFDIR/sites-available/$SITENAME ]; then 27 | echo "This site does not exist!" 28 | exit 1 29 | fi 30 | 31 | if [ $SITENAME = "default" ]; then 32 | ln -sf $SYSCONFDIR/sites-available/$SITENAME \ 33 | $SYSCONFDIR/sites-enabled/"$PRIORITY"-"$SITENAME" 34 | else 35 | ln -sf $SYSCONFDIR/sites-available/$SITENAME $SYSCONFDIR/sites-enabled/$SITENAME 36 | fi 37 | 38 | echo "Site $SITENAME installed; reload apache to enable." -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/ganglia/recipes/gmetad.rb: -------------------------------------------------------------------------------- 1 | # Cookbook Name:: ganglia 2 | # Recipe:: gmetad 3 | 4 | template "/etc/init.d/gmetad" do 5 | mode "0755" 6 | source "bin/gmetad.erb" 7 | end 8 | 9 | service "gmetad" do 10 | action :nothing 11 | end 12 | 13 | template "/etc/ganglia/gmetad.conf" do 14 | source "gmetad.conf.erb" 15 | mode "0755" 16 | notifies :restart, resources(:service => "gmetad") 17 | end 18 | 19 | directory "/var/lib/ganglia/rrds" do 20 | action :create 21 | recursive true 22 | owner node[:ganglia][:gmetad_user] 23 | group node[:ganglia][:gmetad_user] 24 | end 25 | 26 | script "install ganglia" do 27 | interpreter "sh -x" 28 | 29 | configure = "./configure --with-gmetad --disable-python --with-librrd=/usr/local/rrdtool-1.3.1" 30 | 31 | code <<-EOH 32 | mkdir -p /opt/local/src 33 | cd /opt/local/src 34 | wget http://superb-west.dl.sourceforge.net/sourceforge/ganglia/ganglia-3.1.2.tar.gz -O ganglia.tar.gz 35 | tar -xvvf ganglia.tar.gz 36 | cd ganglia-3.1.2/ 37 | #{configure} 38 | make && make install 39 | EOH 40 | creates "/usr/sbin/gmetad" 41 | notifies(:restart, resources(:service => "apache2")) rescue nil 42 | notifies :restart, resources(:service => "gmetad") 43 | end 44 | 45 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/ntp/recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: ntp 3 | # Recipe:: default 4 | # Author:: Joshua Timberman () 5 | # 6 | # Copyright 2009, Opscode, Inc 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 | case node[:platform] 21 | when "ubuntu","debian" 22 | package "ntpdate" do 23 | action :install 24 | end 25 | end 26 | 27 | package "ntp" do 28 | action :install 29 | end 30 | 31 | service node[:ntp][:service] do 32 | action :start 33 | end 34 | 35 | template "/etc/ntp.conf" do 36 | source "ntp.conf.erb" 37 | owner "root" 38 | group "root" 39 | mode 0644 40 | notifies :restart, resources(:service => node[:ntp][:service]) 41 | end 42 | -------------------------------------------------------------------------------- /test/fixtures/ec2/ec2-run-instances_response_body.xml: -------------------------------------------------------------------------------- 1 | 2 | c1128a8d-59e6-4aad-8923-12b07ff873ec 3 | r-51D70925 4 | admin 5 | 6 | 7 | admin-default 8 | 9 | 10 | 11 | 12 | i-485C07DE 13 | emi-39CA160F 14 | 15 | 0 16 | pending 17 | 18 | 0.0.0.0 19 | 0.0.0.0 20 | eucalyptus_sample 21 | 0 22 | 23 | m1.small 24 | 2009-07-22T00:09:29.293Z 25 | 26 | garden 27 | 28 | eki-AE9D17DD 29 | eri-171A1927 30 | 31 | false 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /bin/cloud-contract: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | $:.unshift(File.dirname(__FILE__) + "/../lib") 3 | require "poolparty" 4 | 5 | require 'git-style-binary/command' 6 | 7 | GitStyleBinary.command do 8 | banner <<-EOS 9 | Usage: #{$0} #{all_options_string} 10 | 11 | contracts the cloud by a single instance 12 | EOS 13 | 14 | short_desc "contracts the cloud by a single instance" 15 | 16 | run do |command| 17 | @loaded_clouds.each do |cld| 18 | 19 | node_to_terminate = cld.nodes.last 20 | # node_to_terminate.cloud = cld 21 | 22 | puts cld.nodes.size 23 | if cld.nodes.size - 1 < cld.minimum_instances 24 | puts "Contracting instances by 1 in cloud #{cld.name} will lower the number of instances below specified minimum (#{cld.minimum_instances})" 25 | next 26 | end 27 | msg = [ 28 | "Contracting cloud #{cld.name} (#{cld.keypair}) by 1", 29 | "#{cld.nodes.size} running instances (#{cld.minimum_instances} - #{cld.maximum_instances})", 30 | " node: #{node_to_terminate.public_ip}" 31 | ] 32 | 33 | puts msg.join("\n") 34 | 35 | node_to_terminate.terminate! 36 | 37 | puts "#{node_to_terminate.public_ip} has been terminated" 38 | end 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /lib/core/object.rb: -------------------------------------------------------------------------------- 1 | class Object 2 | 3 | def pool(name=nil, &block) 4 | @@pool ||= PoolParty::Pool.new(name, &block) 5 | end 6 | 7 | def reset! 8 | @@pool = nil 9 | end 10 | 11 | def print_msg(msg_arr) 12 | msg_arr.each do |line| 13 | puts line 14 | end 15 | end 16 | 17 | # return true if nil?, empty? or size==0 18 | def blank? 19 | return true if nil? 20 | return true if self.respond_to?('empty?') && self.empty? 21 | return true if self.respond_to?('size') && self.size==0 22 | return false 23 | end 24 | 25 | # === Description 26 | # 27 | # Change +attr+ to +val+ within the scope of block 28 | # and then sets it back again 29 | # 30 | def change_attr attr, val, &block 31 | old_val = instance_variable_get attr 32 | begin 33 | instance_variable_set attr, val 34 | yield 35 | ensure 36 | instance_variable_set attr, old_val 37 | end 38 | end 39 | 40 | def progress_bar_until(msg=nil, &block) 41 | print "#{msg}" if msg 42 | loop do 43 | if block.call 44 | break 45 | else 46 | $stdout.print "." 47 | $stdout.flush 48 | sleep 1 49 | end 50 | end 51 | print " OK" if msg 52 | puts "" if msg 53 | end 54 | 55 | 56 | end 57 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/templates/default/mods/setenvif.conf.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | # 4 | # The following directives modify normal HTTP response behavior to 5 | # handle known problems with browser implementations. 6 | # 7 | BrowserMatch "Mozilla/2" nokeepalive 8 | BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0 9 | BrowserMatch "RealPlayer 4\.0" force-response-1.0 10 | BrowserMatch "Java/1\.0" force-response-1.0 11 | BrowserMatch "JDK/1\.0" force-response-1.0 12 | 13 | # 14 | # The following directive disables redirects on non-GET requests for 15 | # a directory that does not include the trailing slash. This fixes a 16 | # problem with Microsoft WebFolders which does not appropriately handle 17 | # redirects for folders with DAV methods. 18 | # Same deal with Apple's DAV filesystem and Gnome VFS support for DAV. 19 | # 20 | BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully 21 | BrowserMatch "MS FrontPage" redirect-carefully 22 | BrowserMatch "^WebDrive" redirect-carefully 23 | BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully 24 | BrowserMatch "^gnome-vfs/1.0" redirect-carefully 25 | BrowserMatch "^XML Spy" redirect-carefully 26 | BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully 27 | 28 | 29 | -------------------------------------------------------------------------------- /vendor/gems/git-style-binaries/test/fixtures/wordpress: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | $:.unshift(File.dirname(__FILE__) + "/../../lib") 3 | 4 | require 'git-style-binary/command' 5 | GitStyleBinary.primary do 6 | version "0.0.1 (c) 2009 Nate Murray - local" 7 | opt :test_primary, "test an option on the primary", :type => String 8 | 9 | action do 10 | @categories = ["sports", "news"] 11 | end 12 | 13 | before_run do |cmd| 14 | puts "before_run command #{cmd}" 15 | end 16 | 17 | after_run do |cmd| 18 | puts "after_run command #{cmd}" 19 | end 20 | 21 | run do |command| 22 | puts "Primary Options: #{command.opts.inspect}" 23 | end 24 | end 25 | 26 | # OR 27 | 28 | # require 'git-style-binary/primary' 29 | # command = GitStyleBinary::primary("wordpress") do 30 | # version "#{$0} 0.0.1 (c) 2009 Nate Murray" 31 | # banner <<-EOS 32 | # usage: #{$0} #{all_options.collect(:&to_s).join(" ")} COMMAND [ARGS] 33 | # 34 | # The wordpress subcommands commands are: 35 | # {subcommand_names.pretty_print} 36 | # 37 | # See 'wordpress help COMMAND' for more information on a specific command. 38 | # EOS 39 | # opt :verbose, "verbose", :default => false 40 | # opt :dry, "dry run", :default => false 41 | # opt :test_global, "a basic global string option", :type => String 42 | # end 43 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/config/server.rb.example: -------------------------------------------------------------------------------- 1 | # 2 | # Example Chef Server Config File 3 | # 4 | # We recommend using Opscode's chef cookbook for managing chef itself, 5 | # instead of using this file. It is provided as an example. 6 | 7 | log_level :info 8 | log_location "/var/log/chef/server.log" 9 | ssl_verify_mode :verify_none 10 | registration_url "https://localhost" 11 | openid_url "https://localhost" 12 | template_url "https://localhost" 13 | remotefile_url "https://localhost" 14 | search_url "https://localhost" 15 | role_url "https://localhost" 16 | 17 | #validation_token "change_this_token" 18 | 19 | cookbook_path [ "/srv/chef/site-cookbooks", "/srv/chef/cookbooks" ] 20 | 21 | file_store_path "/srv/chef/file_store" 22 | file_cache_path "/srv/chef/cache" 23 | node_path "/srv/chef/nodes" 24 | openid_store_path "/srv/chef/openid/store" 25 | openid_cstore_path "/srv/chef/openid/cstore" 26 | search_index_path "/srv/chef/search_index" 27 | 28 | # uncomment and modify to allow specific openid providers 29 | #openid_providers [ "https://localhost", "https://chef" ] 30 | # uncomment and modify to lock down openid identifiers, ie 'some_user.myopenid.com' 31 | #authorized_openid_identifiers [ "" ] 32 | 33 | Chef::Log::Formatter.show_time = true 34 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/templates/default/a2enmod.erb: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | SYSCONFDIR='<%= @node[:apache][:dir] %>' 4 | 5 | if [ -z $1 ]; then 6 | echo "Which module would you like to enable?" 7 | echo -n "Your choices are: " 8 | ls $SYSCONFDIR/mods-available/*.load | \ 9 | sed -e "s,$SYSCONFDIR/mods-available/,,g" | sed -e 's/\.load$//g;' | xargs echo 10 | echo -n "Module name? " 11 | read MODNAME 12 | else 13 | MODNAME=$1 14 | fi 15 | 16 | #figure out if we're on a prefork or threaded mpm 17 | if [ -x /usr/sbin/apache2 ]; then 18 | PREFORK=`/usr/sbin/apache2 -l | grep prefork || true` 19 | fi 20 | 21 | if [ -e $SYSCONFDIR/mods-enabled/$MODNAME.load && -e $SYSCONFDIR/mods-enabled/$MODNAME.conf ]; then 22 | echo "This module is already enabled!" 23 | exit 0 24 | fi 25 | 26 | if ! [ -e $SYSCONFDIR/mods-available/$MODNAME.load ]; then 27 | echo "This module does not exist!" 28 | exit 1 29 | fi 30 | 31 | for i in conf load; do 32 | if [ -e $SYSCONFDIR/mods-available/$MODNAME.$i -a ! -e $SYSCONFDIR/mods-enabled/$MODNAME.$i ]; then 33 | ln -sf $SYSCONFDIR/mods-available/$MODNAME.$i $SYSCONFDIR/mods-enabled/$MODNAME.$i; 34 | fi 35 | done 36 | 37 | echo "Module $MODNAME installed; reload apache to enable." -------------------------------------------------------------------------------- /test/lib/core/hash_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class HashTest < Test::Unit::TestCase 4 | context "Hash" do 5 | setup do 6 | @hsh = {:a => "a", :b => "b", :c => "c"} 7 | end 8 | 9 | should "have choose to select hashes" do 10 | assert_equal @hsh.choose {|k,v| k == :a}, {:a => "a"} 11 | assert_equal @hsh.choose {|k,v| k == :z}, {} 12 | assert_equal @hsh.choose {|k,v|[:b,:a].include?(k)}.keys.sort{|a,b|"#{a}"<=>"#{b}"}, [:a,:b] 13 | end 14 | 15 | should "be able to call methods on the hash of their keys" do 16 | assert_equal @hsh.a, "a" 17 | assert_equal @hsh.b, "b" 18 | assert_equal @hsh.c, "c" 19 | end 20 | 21 | should "compute the differences in the hashes" do 22 | assert_equal ({:a => "a"}).diff({:a => "a"}), {} 23 | assert_equal ({:a => "a"}).diff({:a => "b"}), {:a => "b"} 24 | assert_equal ({:a => "a", :b => "b"}).diff({:a => "b"}, :a), {:a => "b"} 25 | assert_equal ({:a => "a", :b => "b"}).diff({:b => "b"}, :b), {} 26 | assert_equal ({:a => "a", :b => "b"}).diff({:b => "c"}, :b), {:b => "c"} 27 | assert_equal ({:a => "a", :b => "b"}).diff({:b => "c"}), {:b => "c", :a => nil} 28 | assert_equal ({:a => "a", :b => "b"}).diff({:b => "c"}, :a), {:a => nil} 29 | end 30 | 31 | end 32 | 33 | end -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apt/recipes/cacher.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apt 3 | # Recipe:: cacher 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | package "apt-cacher" do 20 | action :install 21 | end 22 | 23 | service "apt-cacher" do 24 | supports :restart => true, :status => false 25 | action [ :enable, :start ] 26 | end 27 | 28 | remote_file "/etc/apt-cacher/apt-cacher.conf" do 29 | source "apt-cacher.conf" 30 | owner "root" 31 | group "root" 32 | mode 0644 33 | notifies :restart, resources(:service => "apt-cacher") 34 | end 35 | 36 | remote_file "/etc/default/apt-cacher" do 37 | source "apt-cacher" 38 | owner "root" 39 | group "root" 40 | mode 0644 41 | notifies :restart, resources(:service => "apt-cacher") 42 | end 43 | -------------------------------------------------------------------------------- /bin/cloud-list: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | $:.unshift(File.dirname(__FILE__) + "/../lib") 3 | 4 | require "poolparty" 5 | require 'git-style-binary/command' 6 | 7 | GitStyleBinary.command do 8 | banner <<-EOS 9 | Usage: #{$0} #{all_options_string} 10 | 11 | List the clouds and their nodes 12 | e.g. show a list of the current instances on the cloud 13 | EOS 14 | 15 | opt :instance_id, "Describe a specific instance", :type => String, :default => nil 16 | 17 | short_desc "show a list of the current instances on the clouds" 18 | 19 | run do |command| 20 | puts "#{pool.name}" 21 | puts "===" 22 | @loaded_clouds.each do |cld| 23 | if command[:instance_id] 24 | require 'pp' 25 | pp result = cld.nodes(:instance_id=>command[:instance_id]) 26 | else 27 | msg = ["* #{cld.name} cloud, #{cld.image_id}, #{cld.instance_type}"] 28 | 29 | hsh = {} 30 | 31 | cld.all_nodes.each do |n| 32 | (hsh[n.status] ||= []) << n 33 | end 34 | 35 | hsh.each do |k,v| 36 | msg << " - #{k} nodes" 37 | v.each do |a| 38 | msg << " - #{a.instance_id}\t#{a.status}\t#{a.public_ip}\t#{a.private_ip}\t#{a.zone}" 39 | end 40 | msg << "" 41 | end 42 | puts msg 43 | end 44 | 45 | end 46 | end 47 | end -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/god_monitor.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: god_monitor 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | apache_service = service "apache2" do 21 | action :nothing 22 | end 23 | 24 | start_command = apache_service.start_command 25 | stop_command = apache_service.stop_command 26 | restart_command = apache_service.restart_command 27 | 28 | god_monitor "apache2" do 29 | config "apache2.god.erb" 30 | start (start_command)?start_command : "/etc/init.d/#{apache_service.service_name} start" 31 | restart (restart_command)?restart_command : "/etc/init.d/#{apache_service.service_name} restart" 32 | stop (stop_command)?stop_command : "/etc/init.d/#{apache_service.service_name} stop" 33 | end 34 | -------------------------------------------------------------------------------- /lib/cloud_providers/ec2/helpers/authorize.rb: -------------------------------------------------------------------------------- 1 | module CloudProviders 2 | class Authorize < Ec2Helper 3 | default_options({ 4 | :protocol => "tcp", 5 | :from_port => "22", 6 | :to_port => "22", 7 | :network => "0.0.0.0/0", 8 | :group_name => nil, 9 | :owner_id => nil}) 10 | 11 | def run 12 | options = 13 | if group_name 14 | puts "Authorizing #{name} for group named: #{group_name} of owner id: #{owner_id}" 15 | {:group_name => name, :source_security_group_name=> group_name, :source_security_group_owner_id => owner_id} 16 | else 17 | puts "Authorizing: #{name} for #{protocol} to #{from_port}:#{to_port} #{network}" 18 | to_hash 19 | end 20 | begin 21 | ec2.authorize_security_group_ingress(options) 22 | rescue AWS::InvalidPermissionDuplicate => e 23 | nil 24 | end 25 | 26 | end 27 | 28 | def to_hash 29 | if group_name 30 | {:group_name => group_name} 31 | else 32 | { 33 | :group_name => name, 34 | :ip_protocol => protocol, 35 | :from_port => from_port, 36 | :to_port => to_port, 37 | :cidr_ip => network 38 | } 39 | end 40 | end 41 | 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /bin/cloud-console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | $:.unshift(File.dirname(__FILE__) + "/../lib") 3 | require "poolparty" 4 | require 'git-style-binary/command' 5 | 6 | GitStyleBinary.command do 7 | banner <<-EOS 8 | Usage: #{$0} #{all_options_string} 9 | 10 | Open an irb session with the clouds.rb loaded 11 | EOS 12 | 13 | short_desc "Open an irb session with clouds.rb loaded" 14 | 15 | opt :inst_num, "The number of the instance to run bootstrap on", :type => :int 16 | 17 | run do |command| 18 | 19 | puts "Loading PoolParty console..." 20 | #exec "#{irb} #{libs} --simple-prompt" 21 | require 'irb/completion' 22 | require command[:clouds_dot_rb] 23 | require "#{File.dirname(__FILE__) + '/../lib/poolparty.rb'}" 24 | require 'irb' 25 | pool.auto_execute = false 26 | 27 | IRB.setup(nil) 28 | IRB.conf[:IRB_NAME]="cloud" 29 | IRB.conf[:PROMPT_MODE]=:CLOUD 30 | IRB.conf[:PROMPT][:CLOUD]={ 31 | :PROMPT_I => "%N> ", 32 | :PROMPT_S => "%l> ", 33 | :PROMPT_C => "* ", 34 | :PROMPT_N => ">> ", 35 | :RETURN => "=>%s\n" } 36 | irb=IRB::Irb.new 37 | IRB.conf[:IRB_RC].call(irb.context) if IRB.conf[:IRB_RC] 38 | IRB.conf[:MAIN_CONTEXT] = irb.context 39 | trap("SIGINT") do 40 | irb.signal_handle 41 | end 42 | catch(:IRB_EXIT) do 43 | irb.eval_input 44 | end 45 | end 46 | end 47 | -------------------------------------------------------------------------------- /bin/cloud-vnc: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | $:.unshift(File.dirname(__FILE__) + "/../lib") 3 | require "poolparty" 4 | 5 | require 'git-style-binary/command' 6 | 7 | GitStyleBinary.command do 8 | banner <<-EOS 9 | Usage: #{$0} #{all_options_string} 10 | 11 | start a vnc server and create an ssh tunnel 12 | EOS 13 | 14 | short_desc "ssh into an instance of the cloud" 15 | 16 | opt :instance_number, "Start VNC server on this instance number", :type => :integer, :default => 0 17 | opt :local_port, "The local port to tunnel to", :type => :integer, :default => 5900 18 | opt :display, "The remote display number to start the VNC Server on", :type => :integer, :default => 0 19 | 20 | run do |command| 21 | cloud = @loaded_clouds.first 22 | 23 | if !cloud.nodes.empty? 24 | inst = cloud.nodes[command[:instance_number]] 25 | if inst 26 | inst.ssh(["x11vnc -localhost -nopw -display :#{command[:display]}"], 27 | {'-X' => nil, 28 | '-C' => nil, 29 | ' -o' => 'UserKnownHostsFile=/dev/null', 30 | '-L' => "#{command[:local_port]}:localhost:5900"}) 31 | else 32 | puts("Error: The instance number (#{command[:instance_number]}) is too high for the current number of instances") 33 | end 34 | else 35 | puts "No running instances can be found" 36 | end 37 | 38 | end 39 | end -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apt/files/default/apt-proxy-v2.conf: -------------------------------------------------------------------------------- 1 | [DEFAULT] 2 | ;; All times are in seconds, but you can add a suffix 3 | ;; for minutes(m), hours(h) or days(d) 4 | 5 | ;; commented out address so apt-proxy will listen on all IPs 6 | ;; address = 127.0.0.1 7 | port = 9999 8 | cache_dir = /var/cache/apt-proxy 9 | 10 | ;; Control files (Packages/Sources/Contents) refresh rate 11 | min_refresh_delay = 1s 12 | complete_clientless_downloads = 1 13 | 14 | ;; Debugging settings. 15 | debug = all:4 db:0 16 | 17 | time = 30 18 | passive_ftp = on 19 | 20 | ;;-------------------------------------------------------------- 21 | ;; Cache housekeeping 22 | 23 | cleanup_freq = 1d 24 | max_age = 120d 25 | max_versions = 3 26 | 27 | ;;--------------------------------------------------------------- 28 | ;; Backend servers 29 | ;; 30 | ;; Place each server in its own [section] 31 | 32 | [ubuntu] 33 | ; Ubuntu archive 34 | backends = 35 | http://us.archive.ubuntu.com/ubuntu 36 | 37 | [ubuntu-security] 38 | ; Ubuntu security updates 39 | backends = http://security.ubuntu.com/ubuntu 40 | 41 | [debian] 42 | ;; Backend servers, in order of preference 43 | backends = 44 | http://debian.osuosl.org/debian/ 45 | 46 | [security] 47 | ;; Debian security archive 48 | backends = 49 | http://security.debian.org/debian-security 50 | http://ftp2.de.debian.org/debian-security 51 | -------------------------------------------------------------------------------- /lib/core/string.rb: -------------------------------------------------------------------------------- 1 | class String 2 | # Turn a downcased string and capitalize it 3 | # so that it can be a class 4 | # doc_river #=> DocRiver 5 | def camelcase 6 | gsub(/(^|_|-)(.)/) { $2.upcase } 7 | end 8 | 9 | # "FooBar".snake_case #=> "foo_bar" 10 | def snake_case 11 | gsub(/\B[A-Z]+/, '_\&').downcase 12 | end 13 | 14 | # "FooBar".dasherize #=> "foo-bar" 15 | def dasherize 16 | gsub(/\B[A-Z]+/, '-\&').downcase 17 | end 18 | 19 | # Turn a string from lowercased with a . 20 | # to a classified classname 21 | # rice_and_beans #=> "RiceAndBeans" 22 | # handles subclassed and namespaced classes as well 23 | # for instance 24 | # rice::and::beans #=> Rice::And::Beans 25 | def classify 26 | self.sub(/.*\./, '').split("::").map {|ele| ele.camelcase }.join("::") 27 | end 28 | # Constantize tries to find a declared constant with the name specified 29 | # in the string. It raises a NameError when the name is not in CamelCase 30 | # or is not initialized. 31 | # 32 | # Examples 33 | # "Module".constantize #=> Module 34 | # "Class".constantize #=> Class 35 | def constantize(mod=Object) 36 | camelcased_word = classify 37 | begin 38 | mod.module_eval(camelcased_word, __FILE__, __LINE__) 39 | rescue NameError 40 | nil 41 | end 42 | end 43 | 44 | def /(o) 45 | File.join(self, o.to_s) 46 | end 47 | 48 | end -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/chef/templates/default/client.rb.erb: -------------------------------------------------------------------------------- 1 | # 2 | # Chef Client Config File 3 | # 4 | # Dynamically generated by Chef - local modifications will be replaced 5 | # 6 | 7 | log_level :info 8 | log_location <%= @client_log %> 9 | ssl_verify_mode :verify_none 10 | <% if @node[:chef][:url_type] == "https" -%> 11 | registration_url "https://<%= @node[:chef][:server_fqdn] %>" 12 | openid_url "https://<%= @node[:chef][:server_fqdn] %>:444" 13 | template_url "https://<%= @node[:chef][:server_fqdn] %>" 14 | remotefile_url "https://<%= @node[:chef][:server_fqdn] %>" 15 | search_url "https://<%= @node[:chef][:server_fqdn] %>" 16 | role_url "https://<%= @node[:chef][:server_fqdn] %>" 17 | <% else -%> 18 | registration_url "http://<%= @node[:chef][:server_fqdn] %>:4000" 19 | openid_url "http://<%= @node[:chef][:server_fqdn] %>:4001" 20 | template_url "http://<%= @node[:chef][:server_fqdn] %>:4000" 21 | remotefile_url "http://<%= @node[:chef][:server_fqdn] %>:4000" 22 | search_url "http://<%= @node[:chef][:server_fqdn] %>:4000" 23 | role_url "http://<%= @node[:chef][:server_fqdn] %>:4000" 24 | <% end -%> 25 | 26 | file_cache_path "<%= @node[:chef][:cache_path] %>" 27 | 28 | pid_file "<%= @node[:chef][:run_path] %>/chef-client.pid" 29 | 30 | Chef::Log::Formatter.show_time = <%= @show_time %> 31 | -------------------------------------------------------------------------------- /vendor/gems/trollop/Rakefile: -------------------------------------------------------------------------------- 1 | # -*- ruby -*- 2 | 3 | require 'rubygems' 4 | require 'hoe' 5 | 6 | $:.unshift "lib" 7 | require 'trollop' 8 | 9 | class Hoe 10 | def extra_dev_deps; @extra_dev_deps.reject { |x| x[0] == "hoe" } end 11 | end 12 | 13 | Hoe.new('trollop', Trollop::VERSION) do |p| 14 | p.rubyforge_name = 'trollop' 15 | p.author = "William Morgan" 16 | p.summary = "Trollop is a commandline option parser for Ruby that just gets out of your way. One line of code per option is all you need to write. For that, you get a nice automatically-generated help page, robust option parsing, command subcompletion, and sensible defaults for everything you don't specify." 17 | p.description = p.paragraphs_of('README.txt', 4..5, 9..18).join("\n\n").gsub(/== SYNOPSIS/, "Synopsis") 18 | p.url = "http://trollop.rubyforge.org" 19 | p.changes = p.paragraphs_of('History.txt', 0..0).join("\n\n") 20 | p.email = "wmorgan-trollop@masanjin.net" 21 | end 22 | 23 | WWW_FILES = FileList["www/*"] + %w(README.txt FAQ.txt) 24 | task :upload_webpage => WWW_FILES do |t| 25 | sh "rsync -Paz -essh #{t.prerequisites * ' '} wmorgan@rubyforge.org:/var/www/gforge-projects/trollop/" 26 | end 27 | 28 | task :rdoc do |t| 29 | sh "rdoc lib README.txt History.txt -m README.txt" 30 | end 31 | 32 | task :upload_docs => :rdoc do |t| 33 | sh "rsync -az -essh doc/* wmorgan@rubyforge.org:/var/www/gforge-projects/trollop/trollop/" 34 | end 35 | 36 | # vim: syntax=ruby 37 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_rails.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: passenger 3 | # Recipe:: default 4 | # 5 | # Author:: Joshua Timberman () 6 | # Author:: Joshua Sierles () 7 | # Author:: Michael Hale () 8 | # 9 | # Copyright:: 2009, Opscode, Inc 10 | # Copyright:: 2009, 37signals 11 | # Coprighty:: 2009, Michael Hale 12 | # 13 | # Licensed under the Apache License, Version 2.0 (the "License"); 14 | # you may not use this file except in compliance with the License. 15 | # You may obtain a copy of the License at 16 | # 17 | # http://www.apache.org/licenses/LICENSE-2.0 18 | # 19 | # Unless required by applicable law or agreed to in writing, software 20 | # distributed under the License is distributed on an "AS IS" BASIS, 21 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | # See the License for the specific language governing permissions and 23 | # limitations under the License. 24 | 25 | include_recipe "passenger" 26 | 27 | template "#{node[:apache][:dir]}/mods-available/passenger.load" do 28 | cookbook "passenger" 29 | source "passenger.load.erb" 30 | owner "root" 31 | group "root" 32 | mode 0755 33 | end 34 | 35 | template "#{node[:apache][:dir]}/mods-available/passenger.conf" do 36 | cookbook "passenger" 37 | source "passenger.conf.erb" 38 | owner "root" 39 | group "root" 40 | mode 0755 41 | end 42 | 43 | apache_module "passenger" -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_ssl.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: ssl 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | if platform?("centos", "redhat", "fedora") 21 | package "mod_ssl" do 22 | action :install 23 | notifies :run, resources(:execute => "generate-module-list"), :immediately 24 | end 25 | 26 | file "#{node[:apache][:dir]}/conf.d/ssl.conf" do 27 | action :delete 28 | backup false 29 | end 30 | end 31 | 32 | ports = node[:apache][:listen_ports].include?("443") ? node[:apache][:listen_ports] : [node[:apache][:listen_ports], "443"].flatten 33 | 34 | template "#{node[:apache][:dir]}/ports.conf" do 35 | source "ports.conf.erb" 36 | variables :apache_listen_ports => ports 37 | notifies :restart, resources(:service => "apache2") 38 | end 39 | 40 | apache_module "ssl" do 41 | conf true 42 | end 43 | -------------------------------------------------------------------------------- /vendor/gems/trollop/README.txt: -------------------------------------------------------------------------------- 1 | == trollop 2 | 3 | by William Morgan (wmorgan-trollop at the masanjin dot nets or http://cs.stanford.edu/~ruby) 4 | 5 | Main page: http://trollop.rubyforge.org 6 | 7 | Release announcements and comments: http://all-thing.net/search/label/trollop 8 | 9 | Documentation quickstart: See Trollop::options (for some reason rdoc isn't 10 | linking that; it's in the top right of the screen if you're browsing online) 11 | and then Trollop::Parser#opt. Also see the examples at http://trollop.rubyforge.org/. 12 | 13 | == DESCRIPTION 14 | 15 | Trollop is a commandline option parser for Ruby that just gets out of your 16 | way. One line of code per option is all you need to write. For that, you get 17 | a nice automatically-generated help page, robust option parsing, command 18 | subcompletion, and sensible defaults for everything you don't specify. 19 | 20 | == FEATURES/PROBLEMS 21 | 22 | - Dirt-simple usage. 23 | - Sensible defaults. No tweaking necessary, much tweaking possible. 24 | - Support for long options, short options, short option bundling, 25 | and automatic type validation and conversion. 26 | - Support for subcommands. 27 | - Automatic help message generation, wrapped to current screen width. 28 | - Lots of unit tests. 29 | 30 | == REQUIREMENTS 31 | 32 | * A burning desire to write less code. 33 | 34 | == INSTALL 35 | 36 | * gem install trollop 37 | 38 | == LICENSE 39 | 40 | Copyright (c) 2008 William Morgan. Trollop is distributed under the same terms as Ruby. 41 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/templates/default/web_app.conf.erb: -------------------------------------------------------------------------------- 1 | 2 | ServerName <%= @params[:server_name] %> 3 | ServerAlias <% @params[:server_aliases].each do |a| %><%= "#{a}" %> <% end %> 4 | DocumentRoot <%= @params[:docroot] %> 5 | RewriteEngine On 6 | 7 | > 8 | Options FollowSymLinks 9 | AllowOverride None 10 | Order allow,deny 11 | Allow from all 12 | 13 | 14 | 15 | Options FollowSymLinks 16 | AllowOverride None 17 | 18 | 19 | 20 | SetHandler server-status 21 | 22 | Order Deny,Allow 23 | Deny from all 24 | Allow from 127.0.0.1 25 | 26 | 27 | LogLevel info 28 | ErrorLog <%= @node[:apache][:log_dir] %>/<%= @params[:name] %>-error.log 29 | CustomLog <%= @node[:apache][:log_dir] %>/<%= @params[:name] %>-access.log combined 30 | 31 | RewriteEngine On 32 | RewriteLog <%= @node[:apache][:log_dir] %>/<%= @application_name %>-rewrite.log 33 | RewriteLogLevel 0 34 | 35 | # Canonical host, <%= @params[:server_name] %> 36 | RewriteCond %{HTTP_HOST} !^<%= @params[:server_name] %> [NC] 37 | RewriteCond %{HTTP_HOST} !^$ 38 | RewriteRule ^/(.*)$ http://<%= @params[:server_name] %>/$1 [L,R=301] 39 | 40 | RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f 41 | RewriteCond %{SCRIPT_FILENAME} !maintenance.html 42 | RewriteRule ^.*$ /system/maintenance.html [L] 43 | -------------------------------------------------------------------------------- /test/lib/core/string_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class StringTest < Test::Unit::TestCase 4 | context "string" do 5 | 6 | should "camelcase properly" do 7 | assert_equal "DocRiver", "doc_river".camelcase 8 | assert_equal "AWholeLottaHotdogs", "a_whole_lotta_hotdogs".camelcase 9 | assert_equal "One", "one".camelcase 10 | end 11 | 12 | should "snake_case properly" do 13 | assert_equal "one", "one".snake_case 14 | assert_equal "plenty_of_moons", "PlentyOfMoons".snake_case 15 | assert_equal "girls_make_boys_make_girls", "GirlsMakeBoysMakeGirls".snake_case 16 | end 17 | 18 | should "dasherize properly" do 19 | assert_equal "mini-coopers-rock", "MiniCoopersRock".dasherize 20 | assert_equal "only-the-best", "OnlyTheBest".dasherize 21 | assert_equal "one", "one".dasherize 22 | end 23 | 24 | should "classify properly" do 25 | assert_equal "ABird", "a_bird".classify 26 | assert_equal "Macguyver", "macguyver".classify 27 | assert_equal "RiceAndBeans", "rice_and_beans".classify 28 | assert_equal "Rice::And::Beans", "rice::and::beans".classify 29 | assert_equal "Pepper", "dr.pepper".classify 30 | assert_equal "Dr::Pepper", "dr::pepper".classify 31 | end 32 | 33 | should "have the / for filepaths" do 34 | assert_equal "/root/home/stuff", "/root"/"home"/"stuff" 35 | assert_equal "/root/box", "/root" / "box" 36 | end 37 | 38 | end 39 | 40 | end -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/rsyslog/recipes/client.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: rsyslog 3 | # Recipe:: client 4 | # 5 | # Copyright 2009, Opscode, Inc. 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 "rsyslog" 21 | 22 | rsyslog_server = node[:rsyslog][:server] ? node[:rsyslog][:server] : search(:node, "rsyslog_server:true").map { |n| n["fqdn"] }.first 23 | 24 | # unless node[:rsyslog][:server] 25 | template "/etc/rsyslog.d/remote.conf" do 26 | source "remote.conf.erb" 27 | backup false 28 | variables :server => rsyslog_server, :protocol => node[:rsyslog][:protocol] 29 | owner "root" 30 | group "root" 31 | mode 0644 32 | notifies :restart, resources(:service => "rsyslog"), :delayed 33 | end 34 | 35 | file "/etc/rsyslog.d/server.conf" do 36 | action :delete 37 | notifies :reload, resources(:service => "rsyslog"), :delayed 38 | only_if do File.exists?("/etc/rsyslog.d/server.conf") end 39 | end 40 | # end 41 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/ec2/attributes/ec2_recipe_options.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: ec2 3 | # Attribute File:: ec2_recipe_options.rb 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | ec2opts Mash.new unless attribute?("ec2opts") 21 | ec2opts[:lvm] = Mash.new unless ec2opts.has_key?(:lvm) 22 | ec2opts[:lvm][:use_ephemeral] = true unless ec2opts[:lvm].has_key?(:use_ephemeral) 23 | ec2opts[:lvm][:ephemeral_mountpoint] = "/mnt" unless ec2opts[:lvm].has_key?(:ephemeral_mountpoint) 24 | ec2opts[:lvm][:ephemeral_volume_group] = "ephemeral" unless ec2opts[:lvm].has_key?(:ephemeral_volume_group) 25 | ec2opts[:lvm][:ephemeral_logical_volume] = "store" unless ec2opts[:lvm].has_key?(:ephemeral_logical_volume) 26 | ec2opts[:lvm][:ephemeral_devices] = { 27 | "m1.small" => [ "/dev/sda2" ], 28 | "m1.large" => [ "/dev/sdb", "/dev/sdc" ], 29 | "m1.xlarge" => [ "/dev/sdb", "/dev/sdc", "/dev/sdd", "/dev/sde" ], 30 | } unless ec2opts[:lvm].has_key?(:ephemeral_devices) 31 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: . 3 | specs: 4 | poolparty (1.7.0.pre) 5 | amazon-ec2 (~> 0.9.17) 6 | json 7 | xml-simple 8 | 9 | GEM 10 | remote: http://rubygems.org/ 11 | specs: 12 | addressable (2.2.6) 13 | amazon-ec2 (0.9.17) 14 | xml-simple (>= 1.0.12) 15 | archive-tar-minitar (0.5.2) 16 | crack (0.1.8) 17 | erubis (2.7.0) 18 | fakeweb (1.3.0) 19 | ffi (1.0.9) 20 | git-style-binaries (0.1.11) 21 | shoulda 22 | trollop 23 | i18n (0.5.0) 24 | jnunemaker-matchy (0.4.0) 25 | json (1.5.3) 26 | mocha (0.9.12) 27 | net-scp (1.0.4) 28 | net-ssh (>= 1.99.1) 29 | net-ssh (2.1.4) 30 | rcov (0.9.9) 31 | rdoc (3.9.4) 32 | right_http_connection (1.3.0) 33 | shoulda (2.11.3) 34 | thor (0.14.6) 35 | trollop (1.16.2) 36 | vagrant (0.8.6) 37 | archive-tar-minitar (= 0.5.2) 38 | erubis (~> 2.7.0) 39 | i18n (~> 0.5.0) 40 | json (~> 1.5.1) 41 | net-scp (~> 1.0.4) 42 | net-ssh (~> 2.1.4) 43 | thor (~> 0.14.6) 44 | virtualbox (~> 0.9.1) 45 | virtualbox (0.9.2) 46 | ffi (~> 1.0.9) 47 | webmock (1.6.4) 48 | addressable (~> 2.2, > 2.2.5) 49 | crack (>= 0.1.7) 50 | xml-simple (1.1.0) 51 | 52 | PLATFORMS 53 | ruby 54 | 55 | DEPENDENCIES 56 | amazon-ec2 (~> 0.9.17) 57 | fakeweb 58 | git-style-binaries 59 | jnunemaker-matchy (~> 0.4.0) 60 | json 61 | mocha 62 | poolparty! 63 | rcov 64 | rdoc 65 | right_http_connection 66 | shoulda 67 | vagrant 68 | webmock 69 | xml-simple 70 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/bootstrap/templates/default/client.rb.erb: -------------------------------------------------------------------------------- 1 | # 2 | # Chef Client Config File 3 | # 4 | # Dynamically generated by Chef - local modifications will be replaced 5 | # 6 | 7 | log_level :info 8 | log_location <%= @client_log %> 9 | ssl_verify_mode :verify_none 10 | <% if @node[:bootstrap][:chef][:url_type] == "https" -%> 11 | registration_url "https://<%= @node[:bootstrap][:chef][:server_fqdn] %>" 12 | openid_url "https://<%= @node[:bootstrap][:chef][:server_fqdn] %>:444" 13 | template_url "https://<%= @node[:bootstrap][:chef][:server_fqdn] %>" 14 | remotefile_url "https://<%= @node[:bootstrap][:chef][:server_fqdn] %>" 15 | search_url "https://<%= @node[:bootstrap][:chef][:server_fqdn] %>" 16 | role_url "https://<%= @node[:bootstrap][:chef][:server_fqdn] %>" 17 | <% else -%> 18 | registration_url "http://<%= @node[:bootstrap][:chef][:server_fqdn] %>:4000" 19 | openid_url "http://<%= @node[:bootstrap][:chef][:server_fqdn] %>:4001" 20 | template_url "http://<%= @node[:bootstrap][:chef][:server_fqdn] %>:4000" 21 | remotefile_url "http://<%= @node[:bootstrap][:chef][:server_fqdn] %>:4000" 22 | search_url "http://<%= @node[:bootstrap][:chef][:server_fqdn] %>:4000" 23 | role_url "http://<%= @node[:bootstrap][:chef][:server_fqdn] %>:4000" 24 | <% end -%> 25 | 26 | file_cache_path "<%= @node[:bootstrap][:chef][:cache_path] %>" 27 | 28 | pid_file "<%= @node[:bootstrap][:chef][:run_path] %>/chef-client.pid" 29 | 30 | Chef::Log::Formatter.show_time = <%= @show_time %> 31 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/rsyslog/recipes/server.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: rsyslog 3 | # Recipe:: server 4 | # 5 | # Copyright 2009, Opscode, Inc. 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 "rsyslog" 21 | 22 | directory "/srv/rsyslog" do 23 | owner "root" 24 | group "root" 25 | mode 0755 26 | end 27 | 28 | template "/etc/rsyslog.d/server.conf" do 29 | source "server.conf.erb" 30 | backup false 31 | variables :log_dir => node[:rsyslog][:log_dir], :protocol => node[:rsyslog][:protocol] 32 | owner "root" 33 | group "root" 34 | mode 0644 35 | notifies :restart, resources(:service => "rsyslog"), :delayed 36 | end 37 | 38 | file "/etc/rsyslog.d/remote.conf" do 39 | action :delete 40 | notifies :reload, resources(:service => "rsyslog"), :delayed 41 | only_if do File.exists?("/etc/rsyslog.d/remote.conf") end 42 | end 43 | 44 | cron "rsyslog_gz" do 45 | minute "0" 46 | hour "4" 47 | command "find #{node[:rsyslog][:log_dir]}/$(date +\\%Y) -type f -mtime +1 -exec gzip -q {} \\;" 48 | end 49 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/ec2/attributes/ec2_metadata.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: ec2 3 | # Attribute File:: ec2_metadata.rb 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 'net/http' 21 | 22 | def get_from_ec2(thing="/") 23 | base_url = "http://169.254.169.254/latest/meta-data" + thing 24 | url = URI.parse(base_url) 25 | req = Net::HTTP::Get.new(url.path) 26 | res = Net::HTTP.start(url.host, url.port) {|http| 27 | http.request(req) 28 | } 29 | res.body 30 | end 31 | 32 | if @attribute["domain"] =~ /\.amazonaws.com$/ || @attribute["domain"] == "ec2.internal" 33 | ec2 true 34 | get_from_ec2.split("\n").each do |key| 35 | if key =~ /\/$/ 36 | get_from_ec2("/#{key}").split("\n").each do |extra_key| 37 | attr_name = "ec2-#{key}-#{extra_key}" 38 | attr_name.gsub!("/", "") 39 | @attribute[attr_name] = get_from_ec2("/#{key}/#{extra_key}") 40 | end 41 | end 42 | @attribute["ec2-#{key}"] = get_from_ec2("/#{key}") 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /lib/poolparty.rb: -------------------------------------------------------------------------------- 1 | $LOAD_PATH.unshift(File.dirname(__FILE__)) 2 | 3 | t=Time.now 4 | 5 | require 'yaml' 6 | 7 | # Load system gems 8 | %w(rubygems logger erb open-uri fileutils timeout).each do |lib| 9 | require lib 10 | end 11 | 12 | begin 13 | require 'AWS' 14 | rescue LoadError 15 | puts <<-EOM 16 | There was an error requiring AWS 17 | EOM 18 | end 19 | 20 | require 'pp' 21 | 22 | # Add all vendor gems to the load paths 23 | Dir[File.dirname(__FILE__)+"/../vendor/gems/*"].each {|lib| $LOAD_PATH.unshift(File.expand_path("#{lib}/lib")) } 24 | 25 | # Load local gems 26 | %w(dslify json searchable_paths).each do |dep| 27 | require dep 28 | end 29 | 30 | require "poolparty/version" 31 | module PoolParty 32 | def self.version 33 | VERSION 34 | end 35 | 36 | def self.lib_dir 37 | File.join(File.dirname(__FILE__), "..") 38 | end 39 | end 40 | 41 | # Require the poolparty error so we can use it ubiquitously 42 | require "poolparty/pool_party_error" 43 | 44 | # Core object overloads 45 | %w( object 46 | string 47 | array 48 | hash 49 | symbol 50 | ).each do |lib| 51 | require "core/#{lib}" 52 | end 53 | 54 | require "keypair" 55 | 56 | POOLPARTY_CONFIG_FILE = "#{ENV["HOME"]}/.poolparty/aws" unless defined?(POOLPARTY_CONFIG_FILE) 57 | 58 | # PoolParty core 59 | $LOAD_PATH.unshift(File.dirname(__FILE__)/"poolparty") 60 | %w( base 61 | chef_attribute 62 | chef 63 | chef_solo 64 | chef_client 65 | cloud pool 66 | ).each do |lib| 67 | require "poolparty/#{lib}" 68 | end 69 | 70 | require 'cloud_providers' 71 | 72 | puts "PoolParty core loadtime: #{Time.now-t}" 73 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/chef/templates/default/server.rb.erb: -------------------------------------------------------------------------------- 1 | # 2 | # Chef Server Config File 3 | # 4 | # Dynamically generated by Chef - local modifications will be replaced 5 | 6 | log_level :info 7 | log_location <%= @server_log %> 8 | ssl_verify_mode :verify_none 9 | registration_url "http://<%= @node[:chef][:server_fqdn] %>:4000" 10 | openid_url "http://<%= @node[:chef][:server_fqdn] %>:4001" 11 | template_url "http://<%= @node[:chef][:server_fqdn] %>:4000" 12 | remotefile_url "http://<%= @node[:chef][:server_fqdn] %>:4000" 13 | search_url "http://<%= @node[:chef][:server_fqdn] %>:4000" 14 | role_url "http://<%= @node[:chef][:server_fqdn] %>:4000" 15 | 16 | validation_token "<%= @node[:chef][:server_token] %>" 17 | 18 | cookbook_path [ "<%= @node[:chef][:serve_path] %>/site-cookbooks", "<%= @node[:chef][:serve_path] %>/cookbooks" ] 19 | 20 | file_cache_path "<%= @node[:chef][:cache_path] %>" 21 | node_path "<%= @node[:chef][:serve_path] %>/nodes" 22 | openid_store_path "<%= @node[:chef][:path] %>/openid/store" 23 | openid_cstore_path "<%= @node[:chef][:path] %>/openid/cstore" 24 | search_index_path "<%= @node[:chef][:path] %>/search_index" 25 | role_path "<%= @node[:chef][:serve_path] %>/roles" 26 | 27 | # See http://wiki.opscode.com/display/chef/Securing+Chef+Server 28 | # For more information on these settings. 29 | #authorized_openid_providers [ "https://<%= @node[:chef][:server_fqdn]%>", "https://chef", "myopenid.com" ] 30 | #authorized_openid_identifiers [ "" ] 31 | 32 | Chef::Log::Formatter.show_time = <%= @show_time %> 33 | -------------------------------------------------------------------------------- /vendor/gems/dslify/Rakefile: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'rake' 3 | 4 | begin 5 | require 'jeweler' 6 | Jeweler::Tasks.new do |gem| 7 | gem.name = "dslify" 8 | gem.summary = %Q{TODO} 9 | gem.email = "arilerner@mac.com" 10 | gem.homepage = "http://github.com/auser/dslify" 11 | gem.authors = ["Ari Lerner"] 12 | 13 | # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings 14 | end 15 | rescue LoadError 16 | puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com" 17 | end 18 | 19 | require 'rake/testtask' 20 | Rake::TestTask.new(:test) do |test| 21 | test.libs << 'lib' << 'test' 22 | test.pattern = 'test/**/*_test.rb' 23 | test.verbose = false 24 | end 25 | 26 | begin 27 | require 'rcov/rcovtask' 28 | Rcov::RcovTask.new do |test| 29 | test.libs << 'test' 30 | test.pattern = 'test/**/*_test.rb' 31 | test.verbose = true 32 | end 33 | rescue LoadError 34 | task :rcov do 35 | abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov" 36 | end 37 | end 38 | 39 | 40 | task :default => :test 41 | 42 | require 'rake/rdoctask' 43 | Rake::RDocTask.new do |rdoc| 44 | if File.exist?('VERSION.yml') 45 | config = YAML.load(File.read('VERSION.yml')) 46 | version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}" 47 | else 48 | version = "" 49 | end 50 | 51 | rdoc.rdoc_dir = 'rdoc' 52 | rdoc.title = "dslify #{version}" 53 | rdoc.rdoc_files.include('README*') 54 | rdoc.rdoc_files.include('lib/**/*.rb') 55 | end 56 | 57 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/runit/recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: runit 3 | # Recipe:: default 4 | # 5 | # Copyright 2008, Opscode, Inc. 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 | case node[:platform] 21 | when "debian","ubuntu" 22 | execute "start-runsvdir" do 23 | command value_for_platform( 24 | "debian" => { "default" => "runsvdir-start" }, 25 | "ubuntu" => { "default" => "start runsvdir" } 26 | ) 27 | action :nothing 28 | end 29 | 30 | package "runit" do 31 | action :install 32 | notifies value_for_platform( 33 | "debian" => { "4.0" => :run, "default" => :nothing }, 34 | "ubuntu" => { "default" => :run } 35 | ), resources(:execute => "start-runsvdir") 36 | end 37 | 38 | if node[:platform_version] <= "8.04" && node[:platform] =~ /ubuntu/i 39 | remote_file "/etc/event.d/runsvdir" do 40 | source "runsvdir" 41 | mode 0644 42 | notifies :run, resources(:execute => "start-runsvdir") 43 | only_if do File.directory?("/etc/event.d") end 44 | end 45 | end 46 | end 47 | -------------------------------------------------------------------------------- /lib/core/hash.rb: -------------------------------------------------------------------------------- 1 | =begin rdoc 2 | Hash extentions 3 | =end 4 | class Hash 5 | 6 | # Return a hash of all the elements where the block evaluates to true 7 | def choose(&block) 8 | Hash[*self.select(&block).inject([]){|res,(k,v)| res << k << v}] 9 | end 10 | 11 | # Computes the difference between two hashes 12 | def diff(other, *hsh) 13 | o = {} 14 | keys.map do |k| 15 | if hsh.include?(k) || hsh.empty? 16 | other[k] == self[k] ? nil : o.merge!({k => other[k]}) 17 | end 18 | end.reject {|b| b.nil? } 19 | o 20 | end 21 | 22 | def merge_if!(k, v) 23 | self[k] = v if v 24 | self 25 | end 26 | 27 | # Converts all of the keys to strings 28 | # can pass in a :key_modifier that will be sent to each key, before being symbolized. 29 | # This can be usefull if you want to downcase, or snake_case each key. 30 | # >> {'Placement' => {'AvailabilityZone'=>"us-east-1a"} }.symbolize_keys(:snake_case) 31 | # => {:placement=>{:availability_zone=>"us-east-1a"}} 32 | def symbolize_keys!(key_modifier=nil) 33 | keys.each{|k| 34 | v = delete(k) 35 | if key_modifier && k.respond_to?(key_modifier) 36 | k = k.send(key_modifier) 37 | end 38 | self[k.to_sym] = v 39 | v.symbolize_keys!(key_modifier) if v.is_a?(Hash) 40 | v.each{|p| p.symbolize_keys!(key_modifier) if p.is_a?(Hash)} if v.is_a?(Array) 41 | } 42 | self 43 | end 44 | 45 | def method_missing(sym, *args, &block) 46 | if has_key?(sym.to_sym) 47 | fetch(sym) 48 | elsif has_key?(sym.to_s) 49 | fetch(sym.to_s) 50 | else 51 | super 52 | end 53 | end 54 | end -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/definitions/apache_site.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Definition:: apache_site 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | define :apache_site, :enable => true do 21 | include_recipe "apache2" 22 | 23 | if params[:enable] 24 | execute "a2ensite #{params[:name]}" do 25 | command "/usr/sbin/a2ensite #{params[:name]}" 26 | notifies :restart, resources(:service => "apache2") 27 | not_if do 28 | File.symlink?("#{node[:apache][:dir]}/sites-enabled/#{params[:name]}") or 29 | File.symlink?("#{node[:apache][:dir]}/sites-enabled/000-#{params[:name]}") 30 | end 31 | only_if do File.exists?("#{node[:apache][:dir]}/sites-available/#{params[:name]}") end 32 | end 33 | else 34 | execute "a2dissite #{params[:name]}" do 35 | command "/usr/sbin/a2dissite #{params[:name]}" 36 | notifies :restart, resources(:service => "apache2") 37 | only_if do File.symlink?("#{node[:apache][:dir]}/sites-enabled/#{params[:name]}") end 38 | end 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/recipes/mod_fcgid.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Recipe:: fcgid 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | if platform?("debian", "ubuntu") 21 | package "libapache2-mod-fcgid" 22 | elsif platform?("centos", "redhat", "fedora") 23 | package "mod_fcgid" do 24 | notifies :run, resources(:execute => "generate-module-list"), :immediately 25 | end 26 | 27 | file "#{node[:apache][:dir]}/conf.d/fcgid.conf" do 28 | action :delete 29 | backup false 30 | end 31 | elsif platform?("suse") 32 | apache_lib_path = node[:architecture] == "i386" ? "/usr/lib/httpd" : "/usr/lib64/httpd" 33 | package "httpd-devel" 34 | bash "install-fcgid" do 35 | code <<-EOH 36 | (cd /tmp; wget http://superb-east.dl.sourceforge.net/sourceforge/mod-fcgid/mod_fcgid.2.2.tgz) 37 | (cd /tmp; tar zxvf mod_fcgid.2.2.tgz) 38 | (cd /tmp; perl -pi -e 's!/usr/local/apache2!#{apache_lib_path}!g' ./mod_fcgid.2.2/Makefile) 39 | (cd /tmp/mod_fcgid.2.2; make install) 40 | EOH 41 | end 42 | end 43 | 44 | apache_module "fcgid" do 45 | conf true 46 | end 47 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/rsyslog/recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: rsyslog 3 | # Recipe:: default 4 | # 5 | # Copyright 2009, Opscode, Inc. 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 | package "rsyslog" do 21 | action :install 22 | end 23 | 24 | service "rsyslog" do 25 | supports :restart => true, :reload => true 26 | action [:enable, :start] 27 | end 28 | 29 | remote_file "/etc/default/rsyslog" do 30 | source "rsyslog.default" 31 | owner "root" 32 | group "root" 33 | mode 0644 34 | end 35 | 36 | directory "/etc/rsyslog.d" do 37 | owner "root" 38 | group "root" 39 | mode 0755 40 | end 41 | 42 | template "/etc/rsyslog.conf" do 43 | source "rsyslog.conf.erb" 44 | owner "root" 45 | group "root" 46 | mode 0644 47 | notifies :restart, resources(:service => "rsyslog"), :delayed 48 | end 49 | 50 | case node[:platform] 51 | when "ubuntu" 52 | if node[:platform_version] >= "9.10" 53 | template "/etc/rsyslog.d/50-default.conf" do 54 | source "50-default.conf.erb" 55 | backup false 56 | owner "root" 57 | group "root" 58 | mode 0644 59 | end 60 | end 61 | end 62 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/definitions/web_app.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Definition:: web_app 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | define :web_app, :template => "web_app.conf.erb" do 21 | 22 | application_name = params[:name] 23 | 24 | include_recipe "apache2" 25 | include_recipe "apache2::mod_rewrite" 26 | include_recipe "apache2::mod_deflate" 27 | include_recipe "apache2::mod_headers" 28 | 29 | template "#{node[:apache][:dir]}/sites-available/#{application_name}.conf" do 30 | source params[:template] 31 | owner "root" 32 | group "root" 33 | mode 0644 34 | if params[:cookbook] 35 | cookbook params[:cookbook] 36 | end 37 | variables( 38 | :application_name => application_name, 39 | :params => params 40 | ) 41 | if File.exists?("#{node[:apache][:dir]}/sites-enabled/#{application_name}.conf") 42 | notifies :reload, resources(:service => "apache2"), :delayed 43 | end 44 | end 45 | 46 | apache_site "#{params[:name]}.conf" do 47 | enable enable_setting 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /vendor/gems/searchable_paths/Rakefile: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'rake' 3 | 4 | begin 5 | require 'jeweler' 6 | Jeweler::Tasks.new do |gem| 7 | gem.name = "searchable_paths" 8 | gem.summary = %Q{Add path searching} 9 | gem.description = %Q{Add searchable paths to any class} 10 | gem.email = "arilerner@mac.com" 11 | gem.homepage = "http://github.com/auser/searchable_paths" 12 | gem.authors = ["Nate Murray and Ari Lerner"] 13 | # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings 14 | end 15 | Jeweler::GemcutterTasks.new 16 | rescue LoadError 17 | puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler" 18 | end 19 | 20 | require 'rake/testtask' 21 | Rake::TestTask.new(:test) do |test| 22 | test.libs << 'lib' << 'test' 23 | test.pattern = 'test/**/*_test.rb' 24 | test.verbose = true 25 | end 26 | 27 | begin 28 | require 'rcov/rcovtask' 29 | Rcov::RcovTask.new do |test| 30 | test.libs << 'test' 31 | test.pattern = 'test/**/*_test.rb' 32 | test.verbose = true 33 | end 34 | rescue LoadError 35 | task :rcov do 36 | abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov" 37 | end 38 | end 39 | 40 | task :test => :check_dependencies 41 | 42 | task :default => :test 43 | 44 | require 'rake/rdoctask' 45 | Rake::RDocTask.new do |rdoc| 46 | if File.exist?('VERSION') 47 | version = File.read('VERSION') 48 | else 49 | version = "" 50 | end 51 | 52 | rdoc.rdoc_dir = 'rdoc' 53 | rdoc.title = "searchable_paths #{version}" 54 | rdoc.rdoc_files.include('README*') 55 | rdoc.rdoc_files.include('lib/**/*.rb') 56 | end 57 | -------------------------------------------------------------------------------- /test/fixtures/keys/test_key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEogIBAAKCAQEAywLYTlQ+keNiZI2FeBik6q34xStF3fF2+XPk3e21B0YQfbQI 3 | xYJG8gbSro90Tu1hnEBZfYm+AC8HXsR9Kx9LpfTSa3aGFRREwdsi8xuaoeHWNxOh 4 | MykU4UcxahT0Ft5+738kLmtVhw8bjjkqcpxCSgrpcJbad2B2ft1KBE02kiU2y7yS 5 | 92sUSWBzVkkJTmiWBDvn5pT9y6IpVCKseWbumGQ6nozEfXe4ihUsKAH42XPxSXMX 6 | Xe64JuONQlxZPrqyF7L/lt6ZeyKQ7yXVcxr6P4W3rPqlBhq5yXNI3vV67KUNCh+w 7 | HH6RLagaguS0VTdBYwo3dvkmuL6TJqnzPzrv1wIBIwKCAQBczhm9aFceHs3k0vsv 8 | ljzDDbONVZxIM96d69ZW0xDtYdunLbrd8mmTNlGu4n5P930UOqyRKQZme+YcsZhO 9 | OjE17ELvTCAJot2acs4l/f2L1PQ2b1+iW+xJuiU3zxB/e6e98PqY4Jwge+9W9Y+/ 10 | XWAh2RpCGRNpxbKDI1UJR95usRxhxlmY0RmUtpDjc3qEOPRgj7E2iC4fFVdvYzKt 11 | FBkGR6Gv2/jqm+c/TmRCFnyaWJXC8W6LkkACjUc6IKUOBSbs6l+3DH0PBOr+XbGv 12 | peExAfYCTfvGy/NNPpzP0JJUJ92sWaZUPUTf8McSsgrTTRBfklsJuf9Hje/8abcr 13 | AheLAoGBAPGX3CDMU68BTgO8bOvGhFHQSu9AypIhEh0PrE1CYsEvYrIRg9h23fuz 14 | 1nz7Z6kIYTNMywxfphEL65CTiJ5eSJV+UGMFAKYziCwH7MDD4Wc6cPLrGmA0eYDz 15 | QMUQJwqfuXKq/dMw2VB6qGbNmbERWmq3wteF/afyTatd6poV4UcXAoGBANcd/o4s 16 | zf1SwxKoT4GGp62gtqT+gIbGkV0AzWBcaDarRNbcV7uFZLL7wzPcCR8/cPZiN+ks 17 | +LsVYvDfrFHRxtdzIesxcqG2v6LazB/+/rZp4Hqc1a4OwxSdOYzINjA01GV2HcET 18 | XzoJIQA8ZYuVpELaNzjLtKBZ6mrQmBh7RRVBAoGBAJ7C4RzeCxs7XycGyzvaObIb 19 | Ke2uO/mgtCG516B8FQKbe18S0vv2V1xC+qnnCZr24MnworBcHKwdxq925L/Xjsij 20 | dqd4UOI/Hvhc+qqPWZubbsuEjazvSIfwTyJps0F+55R+/pIYyVIkt86HG9rCQrso 21 | TNbFw/IFoMER1K5mJlNJAoGAT+aRv8d/tdzpXrOLPrz8c7C43jKkxFhh4LcnthOx 22 | refXvYUKpLyEfP5tE0MZVL/K3yvLn8A/IOqvuI2Xxp5fzF32p9CJqceJAfl/BJHp 23 | lDX0SsyJ4ZB0WB0kARcqEee8mrbX2f/hipWtK/ktB/XAqx3Z/ycXND6nhsKBorFx 24 | bksCgYEAtPns7oc98wmF8j37ELikMFJOvQgccbGTzcJ1RVzji95HfN4p3kA6emo/ 25 | hRyP8XNedEI/CD6MmthKKymw5Ck1I51nwDW4+zTEDAN14nh4T9p6Jqe7lSENqLaY 26 | A5jkgXV8e0YqKkjLNec5hAzoEY09KryQdz81KXeHvbEUfIiItTk= 27 | -----END RSA PRIVATE KEY----- -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/definitions/apache_module.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: apache2 3 | # Definition:: apache_module 4 | # 5 | # Copyright 2008-2009, Opscode, Inc. 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 | define :apache_module, :enable => true, :conf => false do 21 | include_recipe "apache2" 22 | 23 | if params[:conf] 24 | apache_conf params[:name] 25 | end 26 | 27 | if params[:enable] 28 | execute "a2enmod #{params[:name]}" do 29 | command "/usr/sbin/a2enmod #{params[:name]}" 30 | notifies :restart, resources(:service => "apache2") 31 | not_if do (File.symlink?("#{node[:apache][:dir]}/mods-enabled/#{params[:name]}.load") and 32 | ((File.exists?("#{node[:apache][:dir]}/mods-available/#{params[:name]}.conf"))? 33 | (File.symlink?("#{node[:apache][:dir]}/mods-enabled/#{params[:name]}.conf")):(true))) 34 | end 35 | end 36 | else 37 | execute "a2dismod #{params[:name]}" do 38 | command "/usr/sbin/a2dismod #{params[:name]}" 39 | notifies :restart, resources(:service => "apache2") 40 | only_if do File.symlink?("#{node[:apache][:dir]}/mods-enabled/#{params[:name]}.load") end 41 | end 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /test/fixtures/bad_perms_test_key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEogIBAAKCAQEAywLYTlQ+keNiZI2FeBik6q34xStF3fF2+XPk3e21B0YQfbQI 3 | xYJG8gbSro90Tu1hnEBZfYm+AC8HXsR9Kx9LpfTSa3aGFRREwdsi8xuaoeHWNxOh 4 | MykU4UcxahT0Ft5+738kLmtVhw8bjjkqcpxCSgrpcJbad2B2ft1KBE02kiU2y7yS 5 | 92sUSWBzVkkJTmiWBDvn5pT9y6IpVCKseWbumGQ6nozEfXe4ihUsKAH42XPxSXMX 6 | Xe64JuONQlxZPrqyF7L/lt6ZeyKQ7yXVcxr6P4W3rPqlBhq5yXNI3vV67KUNCh+w 7 | HH6RLagaguS0VTdBYwo3dvkmuL6TJqnzPzrv1wIBIwKCAQBczhm9aFceHs3k0vsv 8 | ljzDDbONVZxIM96d69ZW0xDtYdunLbrd8mmTNlGu4n5P930UOqyRKQZme+YcsZhO 9 | OjE17ELvTCAJot2acs4l/f2L1PQ2b1+iW+xJuiU3zxB/e6e98PqY4Jwge+9W9Y+/ 10 | XWAh2RpCGRNpxbKDI1UJR95usRxhxlmY0RmUtpDjc3qEOPRgj7E2iC4fFVdvYzKt 11 | FBkGR6Gv2/jqm+c/TmRCFnyaWJXC8W6LkkACjUc6IKUOBSbs6l+3DH0PBOr+XbGv 12 | peExAfYCTfvGy/NNPpzP0JJUJ92sWaZUPUTf8McSsgrTTRBfklsJuf9Hje/8abcr 13 | AheLAoGBAPGX3CDMU68BTgO8bOvGhFHQSu9AypIhEh0PrE1CYsEvYrIRg9h23fuz 14 | 1nz7Z6kIYTNMywxfphEL65CTiJ5eSJV+UGMFAKYziCwH7MDD4Wc6cPLrGmA0eYDz 15 | QMUQJwqfuXKq/dMw2VB6qGbNmbERWmq3wteF/afyTatd6poV4UcXAoGBANcd/o4s 16 | zf1SwxKoT4GGp62gtqT+gIbGkV0AzWBcaDarRNbcV7uFZLL7wzPcCR8/cPZiN+ks 17 | +LsVYvDfrFHRxtdzIesxcqG2v6LazB/+/rZp4Hqc1a4OwxSdOYzINjA01GV2HcET 18 | XzoJIQA8ZYuVpELaNzjLtKBZ6mrQmBh7RRVBAoGBAJ7C4RzeCxs7XycGyzvaObIb 19 | Ke2uO/mgtCG516B8FQKbe18S0vv2V1xC+qnnCZr24MnworBcHKwdxq925L/Xjsij 20 | dqd4UOI/Hvhc+qqPWZubbsuEjazvSIfwTyJps0F+55R+/pIYyVIkt86HG9rCQrso 21 | TNbFw/IFoMER1K5mJlNJAoGAT+aRv8d/tdzpXrOLPrz8c7C43jKkxFhh4LcnthOx 22 | refXvYUKpLyEfP5tE0MZVL/K3yvLn8A/IOqvuI2Xxp5fzF32p9CJqceJAfl/BJHp 23 | lDX0SsyJ4ZB0WB0kARcqEee8mrbX2f/hipWtK/ktB/XAqx3Z/ycXND6nhsKBorFx 24 | bksCgYEAtPns7oc98wmF8j37ELikMFJOvQgccbGTzcJ1RVzji95HfN4p3kA6emo/ 25 | hRyP8XNedEI/CD6MmthKKymw5Ck1I51nwDW4+zTEDAN14nh4T9p6Jqe7lSENqLaY 26 | A5jkgXV8e0YqKkjLNec5hAzoEY09KryQdz81KXeHvbEUfIiItTk= 27 | -----END RSA PRIVATE KEY----- -------------------------------------------------------------------------------- /test/fixtures/keys/pem_key.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEogIBAAKCAQEAywLYTlQ+keNiZI2FeBik6q34xStF3fF2+XPk3e21B0YQfbQI 3 | xYJG8gbSro90Tu1hnEBZfYm+AC8HXsR9Kx9LpfTSa3aGFRREwdsi8xuaoeHWNxOh 4 | MykU4UcxahT0Ft5+738kLmtVhw8bjjkqcpxCSgrpcJbad2B2ft1KBE02kiU2y7yS 5 | 92sUSWBzVkkJTmiWBDvn5pT9y6IpVCKseWbumGQ6nozEfXe4ihUsKAH42XPxSXMX 6 | Xe64JuONQlxZPrqyF7L/lt6ZeyKQ7yXVcxr6P4W3rPqlBhq5yXNI3vV67KUNCh+w 7 | HH6RLagaguS0VTdBYwo3dvkmuL6TJqnzPzrv1wIBIwKCAQBczhm9aFceHs3k0vsv 8 | ljzDDbONVZxIM96d69ZW0xDtYdunLbrd8mmTNlGu4n5P930UOqyRKQZme+YcsZhO 9 | OjE17ELvTCAJot2acs4l/f2L1PQ2b1+iW+xJuiU3zxB/e6e98PqY4Jwge+9W9Y+/ 10 | XWAh2RpCGRNpxbKDI1UJR95usRxhxlmY0RmUtpDjc3qEOPRgj7E2iC4fFVdvYzKt 11 | FBkGR6Gv2/jqm+c/TmRCFnyaWJXC8W6LkkACjUc6IKUOBSbs6l+3DH0PBOr+XbGv 12 | peExAfYCTfvGy/NNPpzP0JJUJ92sWaZUPUTf8McSsgrTTRBfklsJuf9Hje/8abcr 13 | AheLAoGBAPGX3CDMU68BTgO8bOvGhFHQSu9AypIhEh0PrE1CYsEvYrIRg9h23fuz 14 | 1nz7Z6kIYTNMywxfphEL65CTiJ5eSJV+UGMFAKYziCwH7MDD4Wc6cPLrGmA0eYDz 15 | QMUQJwqfuXKq/dMw2VB6qGbNmbERWmq3wteF/afyTatd6poV4UcXAoGBANcd/o4s 16 | zf1SwxKoT4GGp62gtqT+gIbGkV0AzWBcaDarRNbcV7uFZLL7wzPcCR8/cPZiN+ks 17 | +LsVYvDfrFHRxtdzIesxcqG2v6LazB/+/rZp4Hqc1a4OwxSdOYzINjA01GV2HcET 18 | XzoJIQA8ZYuVpELaNzjLtKBZ6mrQmBh7RRVBAoGBAJ7C4RzeCxs7XycGyzvaObIb 19 | Ke2uO/mgtCG516B8FQKbe18S0vv2V1xC+qnnCZr24MnworBcHKwdxq925L/Xjsij 20 | dqd4UOI/Hvhc+qqPWZubbsuEjazvSIfwTyJps0F+55R+/pIYyVIkt86HG9rCQrso 21 | TNbFw/IFoMER1K5mJlNJAoGAT+aRv8d/tdzpXrOLPrz8c7C43jKkxFhh4LcnthOx 22 | refXvYUKpLyEfP5tE0MZVL/K3yvLn8A/IOqvuI2Xxp5fzF32p9CJqceJAfl/BJHp 23 | lDX0SsyJ4ZB0WB0kARcqEee8mrbX2f/hipWtK/ktB/XAqx3Z/ycXND6nhsKBorFx 24 | bksCgYEAtPns7oc98wmF8j37ELikMFJOvQgccbGTzcJ1RVzji95HfN4p3kA6emo/ 25 | hRyP8XNedEI/CD6MmthKKymw5Ck1I51nwDW4+zTEDAN14nh4T9p6Jqe7lSENqLaY 26 | A5jkgXV8e0YqKkjLNec5hAzoEY09KryQdz81KXeHvbEUfIiItTk= 27 | -----END RSA PRIVATE KEY----- -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/bootstrap/templates/default/server.rb.erb: -------------------------------------------------------------------------------- 1 | # 2 | # Chef Server Config File 3 | # 4 | # Dynamically generated by Chef - local modifications will be replaced 5 | 6 | log_level :info 7 | log_location <%= @server_log %> 8 | ssl_verify_mode :verify_none 9 | registration_url "http://<%= @node[:bootstrap][:chef][:server_fqdn] %>:4000" 10 | openid_url "http://<%= @node[:bootstrap][:chef][:server_fqdn] %>:4001" 11 | template_url "http://<%= @node[:bootstrap][:chef][:server_fqdn] %>:4000" 12 | remotefile_url "http://<%= @node[:bootstrap][:chef][:server_fqdn] %>:4000" 13 | search_url "http://<%= @node[:bootstrap][:chef][:server_fqdn] %>:4000" 14 | role_url "http://<%= @node[:bootstrap][:chef][:server_fqdn] %>:4000" 15 | 16 | validation_token "<%= @node[:bootstrap][:chef][:server_token] %>" 17 | 18 | cookbook_path [ "<%= @node[:bootstrap][:chef][:serve_path] %>/site-cookbooks", "<%= @node[:bootstrap][:chef][:serve_path] %>/cookbooks" ] 19 | 20 | file_cache_path "<%= @node[:bootstrap][:chef][:cache_path] %>" 21 | node_path "<%= @node[:bootstrap][:chef][:serve_path] %>/nodes" 22 | openid_store_path "<%= @node[:bootstrap][:chef][:path] %>/openid/store" 23 | openid_cstore_path "<%= @node[:bootstrap][:chef][:path] %>/openid/cstore" 24 | search_index_path "<%= @node[:bootstrap][:chef][:path] %>/search_index" 25 | role_path "<%= @node[:bootstrap][:chef][:serve_path] %>/roles" 26 | 27 | # See http://wiki.opscode.com/display/chef/Securing+Chef+Server 28 | # For more information on these settings. 29 | #authorized_openid_providers [ "https://<%= @node[:bootstrap][:chef][:server_fqdn]%>", "https://chef", "myopenid.com" ] 30 | #authorized_openid_identifiers [ "" ] 31 | 32 | Chef::Log::Formatter.show_time = <%= @show_time %> 33 | -------------------------------------------------------------------------------- /bin/cloud-show: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | $:.unshift(File.dirname(__FILE__) + "/../lib") 3 | require "poolparty" 4 | 5 | require 'git-style-binary/command' 6 | 7 | GitStyleBinary.command do 8 | @theme = :short 9 | 10 | version "PoolParty #{$0} command" 11 | banner <<-EOS 12 | Usage: #{$0} #{all_options_string} 13 | 14 | shows output about the clouds.rb 15 | 16 | EOS 17 | 18 | short_desc "shows output about the clouds.rb" 19 | 20 | run do |command| 21 | 22 | @loaded_clouds.each do |cld| 23 | 24 | msg = [ 25 | "Cloud: #{cld.name}", 26 | "----------------------------", 27 | "Running Instances: #{cld.nodes.size}", 28 | "Minimum instances: #{cld.minimum_instances}", 29 | "Maximum instances: #{cld.maximum_instances}", 30 | "Running on: #{cld.cloud_provider.name}", 31 | "Keypair: #{cld.keypair.basename}", 32 | "Security group: #{cld.cloud_provider.security_group_names.join(', ')}", 33 | "Availability zones: #{cld.cloud_provider.availability_zones.join(', ')}", 34 | "User: #{cld.user}", 35 | "Active recipes: #{cld.chef._recipes(cld.pool.chef_step).join ", " }" 36 | ] 37 | 38 | if cld.load_balancers.size > 0 39 | load_balancers = cld.cloud_provider.load_balancers.first.running_load_balancers.map {|a| a[:dns_name]} 40 | msg << "Load balancers: #{load_balancers.join("\n\t\t\t")}" 41 | end 42 | 43 | if cld.rds_instances.size > 0 44 | available = cld.cloud_provider.available_rds_instances.map{|r| "#{r.instance_id}\t#{r.current_status.Endpoint.Address}" } 45 | available.unshift 'RDS Instances:' 46 | 47 | msg << available.join("\n\t\t\t") 48 | end 49 | 50 | puts msg.flatten 51 | 52 | end 53 | 54 | end 55 | end 56 | -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/apache2/templates/default/security.erb: -------------------------------------------------------------------------------- 1 | # 2 | # Disable access to the entire file system except for the directories that 3 | # are explicitly allowed later. 4 | # 5 | # This currently breaks the configurations that come with some web application 6 | # Debian packages. It will be made the default for the release after lenny. 7 | # 8 | # 9 | # AllowOverride None 10 | # Order Deny,Allow 11 | # Deny from all 12 | # 13 | 14 | 15 | # Changing the following options will not really affect the security of the 16 | # server, but might make attacks slightly more difficult in some cases. 17 | 18 | # 19 | # ServerTokens 20 | # This directive configures what you return as the Server HTTP response 21 | # Header. The default is 'Full' which sends information about the OS-Type 22 | # and compiled in modules. 23 | # Set to one of: Full | OS | Minimal | Minor | Major | Prod 24 | # where Full conveys the most information, and Prod the least. 25 | # 26 | #ServerTokens Minimal 27 | ServerTokens <%= @node[:apache][:servertokens] %> 28 | 29 | # 30 | # Optionally add a line containing the server version and virtual host 31 | # name to server-generated pages (internal error documents, FTP directory 32 | # listings, mod_status and mod_info output etc., but not CGI generated 33 | # documents or custom error documents). 34 | # Set to "EMail" to also include a mailto: link to the ServerAdmin. 35 | # Set to one of: On | Off | EMail 36 | # 37 | #ServerSignature Off 38 | ServerSignature <%= @node[:apache][:serversignature] %> 39 | 40 | # 41 | # Allow TRACE method 42 | # 43 | # Set to "extended" to also reflect the request body (only for testing and 44 | # diagnostic purposes). 45 | # 46 | # Set to one of: On | Off | extended 47 | # 48 | #TraceEnable Off 49 | TraceEnable <%= @node[:apache][:traceenable] %> 50 | 51 | -------------------------------------------------------------------------------- /examples/rds_cloud.rb: -------------------------------------------------------------------------------- 1 | # example pool with RDS enabled 2 | 3 | pool :poolparty do 4 | cloud :app do 5 | using :ec2 6 | 7 | # this block will create an RDS DB instance 8 | # by default, the instance id will match the containing cloud 9 | # ("poolparty-app" in this example) 10 | rds do 11 | username "admin" # required 12 | password "secret" # required 13 | 14 | # ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 15 | # these properties have the following overridable defaults: 16 | # 17 | # storage 5 18 | # instance_class "db.m1.small" 19 | # engine "db.m1.small" 20 | 21 | 22 | 23 | # ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 24 | # by default, a user DB will be created with a name that matches the containing cloud... 25 | # ...except RDS does not allow hyphens in DB names, so it will be pool name *underscore* cloud name 26 | # ("poolparty_app" in this example). 27 | # 28 | # to override this, use the database method, like so: 29 | # database :db1 30 | # - or - 31 | # databases :production, :staging # :databases is aliased to :database for nice DSL reading. :) 32 | 33 | 34 | 35 | # ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 36 | # You are required to explicitly open access to the DB server to IP addresses (for outside EC2) or security groups (for inside EC2) 37 | # access will be granted to your containing cloud's security groups unless you explicitly list security group authorization. 38 | # 39 | # to override, use the :authorize method, like so: 40 | # authorize :networks => "1.2.3.4/24" # <--- will authorize access to this CIDR block *in addition to* your EC2 security group 41 | # authorize :networks => ["1.2.3.4/32", "10.10.10.10/24"], :security_groups => "my_ec2_group" 42 | end 43 | end 44 | end -------------------------------------------------------------------------------- /examples/chef_cloud/chef_repo/cookbooks/chef/templates/default/chef_server.conf.erb: -------------------------------------------------------------------------------- 1 | 2 | ServerName <%= @params[:server_name] %> 3 | ServerAlias <% @params[:server_aliases].each do |a| %><%= "#{a}" %> <% end %> 4 | 5 | 6 | BalancerMember http://127.0.0.1:4000 7 | Order deny,allow 8 | Allow from all 9 | 10 | 11 | LogLevel info 12 | ErrorLog <%= @params[:log_dir] %>/<%= @params[:name] %>-error.log 13 | CustomLog <%= @params[:log_dir] %>/<%= @params[:name] %>-access.log combined 14 | 15 | SSLEngine On 16 | SSLCertificateFile /etc/chef/certificates/<%= @params[:server_name] %>.pem 17 | SSLCertificateKeyFile /etc/chef/certificates/<%= @params[:server_name] %>.pem 18 | 19 | RequestHeader set X_FORWARDED_PROTO 'https' 20 | 21 | RewriteEngine On 22 | RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f 23 | RewriteRule ^/(.*)$ balancer://chef_server%{REQUEST_URI} [P,QSA,L] 24 | 25 | 26 | 27 | ServerName <%= @params[:server_name] %> 28 | ServerAlias <% @params[:server_aliases].each do |a| %><%= "#{a}" %> <% end %> 29 | 30 | 31 | BalancerMember http://127.0.0.1:4001 32 | Order deny,allow 33 | Allow from all 34 | 35 | 36 | LogLevel info 37 | ErrorLog <%= @params[:log_dir] %>/<%= @params[:name] %>-error.log 38 | CustomLog <%= @params[:log_dir] %>/<%= @params[:name] %>-access.log combined 39 | 40 | SSLEngine On 41 | SSLCertificateFile /etc/chef/certificates/<%= @params[:server_name] %>.pem 42 | SSLCertificateKeyFile /etc/chef/certificates/<%= @params[:server_name] %>.pem 43 | 44 | RequestHeader set X_FORWARDED_PROTO 'https' 45 | 46 | RewriteEngine On 47 | RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f 48 | RewriteRule ^/(.*)$ balancer://chef_server_openid%{REQUEST_URI} [P,QSA,L] 49 | 50 | --------------------------------------------------------------------------------