├── app
├── logs
│ └── .gitkeep
├── .htaccess
├── Resources
│ └── java
│ │ ├── cssembed-0.3.6.jar
│ │ └── yuicompressor-2.4.6.jar
├── AppCache.php
├── config
│ ├── routing.yml
│ ├── config_test.yml
│ ├── parameters.yml.dist
│ ├── config_prod.yml
│ ├── routing_dev.yml
│ ├── config_dev.yml
│ └── security.yml
├── autoload.php
└── console
├── bin
└── .htaccess
├── cache
└── .htaccess
├── src
└── .htaccess
├── vagrant
├── .gitignore
├── puppet
│ ├── modules
│ │ ├── apache
│ │ │ ├── .gitignore
│ │ │ ├── tests
│ │ │ │ ├── init.pp
│ │ │ │ ├── dev.pp
│ │ │ │ ├── php.pp
│ │ │ │ ├── apache.pp
│ │ │ │ └── vhost.pp
│ │ │ ├── Rakefile
│ │ │ ├── spec
│ │ │ │ ├── spec_helper.rb
│ │ │ │ ├── spec.opts
│ │ │ │ ├── classes
│ │ │ │ │ ├── ssl_spec.rb
│ │ │ │ │ ├── mod
│ │ │ │ │ │ ├── wsgi_spec.rb
│ │ │ │ │ │ ├── auth_kerb_spec.rb
│ │ │ │ │ │ ├── python_spec.rb
│ │ │ │ │ │ └── ssl_spec.rb
│ │ │ │ │ ├── params_spec.rb
│ │ │ │ │ ├── python_spec.rb
│ │ │ │ │ ├── dev_spec.rb
│ │ │ │ │ ├── php_spec.rb
│ │ │ │ │ └── apache_spec.rb
│ │ │ │ └── defines
│ │ │ │ │ └── mod_spec.rb
│ │ │ ├── manifests
│ │ │ │ ├── mod
│ │ │ │ │ ├── cgi.pp
│ │ │ │ │ ├── dav.pp
│ │ │ │ │ ├── perl.pp
│ │ │ │ │ ├── ssl.pp
│ │ │ │ │ ├── cache.pp
│ │ │ │ │ ├── fcgid.pp
│ │ │ │ │ ├── auth_basic.pp
│ │ │ │ │ ├── python.pp
│ │ │ │ │ ├── dav_fs.pp
│ │ │ │ │ ├── proxy_http.pp
│ │ │ │ │ ├── php.pp
│ │ │ │ │ ├── dev.pp
│ │ │ │ │ ├── proxy.pp
│ │ │ │ │ ├── wsgi.pp
│ │ │ │ │ ├── userdir.pp
│ │ │ │ │ ├── auth_kerb.pp
│ │ │ │ │ ├── proxy_html.pp
│ │ │ │ │ └── disk_cache.pp
│ │ │ │ ├── proxy.pp
│ │ │ │ ├── php.pp
│ │ │ │ ├── dev.pp
│ │ │ │ ├── python.pp
│ │ │ │ ├── ssl.pp
│ │ │ │ ├── mod.pp
│ │ │ │ └── vhost
│ │ │ │ │ └── redirect.pp
│ │ │ ├── .gemfile
│ │ │ ├── .fixtures.yml
│ │ │ ├── templates
│ │ │ │ ├── mod
│ │ │ │ │ ├── disk_cache.conf.erb
│ │ │ │ │ ├── proxy.conf.erb
│ │ │ │ │ ├── php.conf.erb
│ │ │ │ │ └── userdir.conf.erb
│ │ │ │ ├── vhost-redirect.conf.erb
│ │ │ │ ├── test.vhost.erb
│ │ │ │ ├── vhost-default.conf.erb
│ │ │ │ └── vhost-proxy.conf.erb
│ │ │ ├── lib
│ │ │ │ └── puppet
│ │ │ │ │ ├── provider
│ │ │ │ │ └── a2mod
│ │ │ │ │ │ ├── modfix.rb
│ │ │ │ │ │ └── a2mod.rb
│ │ │ │ │ └── type
│ │ │ │ │ └── a2mod.rb
│ │ │ ├── Modulefile
│ │ │ ├── LICENSE
│ │ │ └── files
│ │ │ │ └── httpd
│ │ ├── mysql
│ │ │ ├── tests
│ │ │ │ ├── init.pp
│ │ │ │ ├── ruby.pp
│ │ │ │ ├── java.pp
│ │ │ │ ├── python.pp
│ │ │ │ ├── mysql_grant.pp
│ │ │ │ ├── server.pp
│ │ │ │ ├── server
│ │ │ │ │ ├── account_security.pp
│ │ │ │ │ └── config.pp
│ │ │ │ ├── backup.pp
│ │ │ │ ├── mysql_database.pp
│ │ │ │ └── mysql_user.pp
│ │ │ ├── Rakefile
│ │ │ ├── spec
│ │ │ │ ├── spec_helper.rb
│ │ │ │ ├── spec.opts
│ │ │ │ ├── classes
│ │ │ │ │ ├── mysql_server_monitor_spec.rb
│ │ │ │ │ └── mysql_init_spec.rb
│ │ │ │ ├── unit
│ │ │ │ │ └── mysql_password_spec.rb
│ │ │ │ └── defines
│ │ │ │ │ └── mysql_server_config_spec.rb
│ │ │ ├── .fixtures.yml
│ │ │ ├── templates
│ │ │ │ ├── my.cnf.pass.erb
│ │ │ │ ├── my.conf.cnf.erb
│ │ │ │ ├── mysqlbackup.sh.erb
│ │ │ │ └── my.cnf.erb
│ │ │ ├── .gemfile
│ │ │ ├── Modulefile
│ │ │ ├── lib
│ │ │ │ └── puppet
│ │ │ │ │ ├── type
│ │ │ │ │ ├── database.rb
│ │ │ │ │ └── database_user.rb
│ │ │ │ │ ├── parser
│ │ │ │ │ └── functions
│ │ │ │ │ │ └── mysql_password.rb
│ │ │ │ │ └── provider
│ │ │ │ │ └── database
│ │ │ │ │ └── mysql.rb
│ │ │ ├── .travis.yml
│ │ │ ├── TODO
│ │ │ └── manifests
│ │ │ │ ├── init.pp
│ │ │ │ ├── java.pp
│ │ │ │ ├── python.pp
│ │ │ │ ├── server
│ │ │ │ ├── monitor.pp
│ │ │ │ ├── account_security.pp
│ │ │ │ └── mysqltuner.pp
│ │ │ │ └── ruby.pp
│ │ └── stdlib
│ │ │ ├── tests
│ │ │ ├── init.pp
│ │ │ ├── has_ip_network.pp
│ │ │ ├── has_ip_address.pp
│ │ │ ├── file_line.pp
│ │ │ └── has_interface_with.pp
│ │ │ ├── .rspec
│ │ │ ├── Rakefile
│ │ │ ├── spec
│ │ │ ├── spec.opts
│ │ │ ├── monkey_patches
│ │ │ │ ├── alias_should_to_must.rb
│ │ │ │ └── publicize_methods.rb
│ │ │ ├── unit
│ │ │ │ ├── puppet
│ │ │ │ │ ├── type
│ │ │ │ │ │ └── anchor_spec.rb
│ │ │ │ │ └── parser
│ │ │ │ │ │ └── functions
│ │ │ │ │ │ ├── zip_spec.rb
│ │ │ │ │ │ ├── strip_spec.rb
│ │ │ │ │ │ ├── chop_spec.rb
│ │ │ │ │ │ ├── chomp_spec.rb
│ │ │ │ │ │ ├── lstrip_spec.rb
│ │ │ │ │ │ ├── join_spec.rb
│ │ │ │ │ │ ├── reverse_spec.rb
│ │ │ │ │ │ ├── swapcase_spec.rb
│ │ │ │ │ │ ├── hash_spec.rb
│ │ │ │ │ │ ├── prefix_spec.rb
│ │ │ │ │ │ ├── capitalize_spec.rb
│ │ │ │ │ │ ├── grep_spec.rb
│ │ │ │ │ │ ├── delete_at_spec.rb
│ │ │ │ │ │ ├── parsejson_spec.rb
│ │ │ │ │ │ ├── parseyaml_spec.rb
│ │ │ │ │ │ ├── sort_spec.rb
│ │ │ │ │ │ ├── bool2num_spec.rb
│ │ │ │ │ │ ├── num2bool_spec.rb
│ │ │ │ │ │ ├── keys_spec.rb
│ │ │ │ │ │ ├── size_spec.rb
│ │ │ │ │ │ ├── empty_spec.rb
│ │ │ │ │ │ ├── upcase_spec.rb
│ │ │ │ │ │ ├── abs_spec.rb
│ │ │ │ │ │ ├── rstrip_spec.rb
│ │ │ │ │ │ ├── str2bool_spec.rb
│ │ │ │ │ │ ├── squeeze_spec.rb
│ │ │ │ │ │ ├── downcase_spec.rb
│ │ │ │ │ │ ├── unique_spec.rb
│ │ │ │ │ │ ├── member_spec.rb
│ │ │ │ │ │ ├── flatten_spec.rb
│ │ │ │ │ │ ├── shuffle_spec.rb
│ │ │ │ │ │ ├── uriescape_spec.rb
│ │ │ │ │ │ ├── time_spec.rb
│ │ │ │ │ │ ├── is_float_spec.rb
│ │ │ │ │ │ ├── is_integer_spec.rb
│ │ │ │ │ │ ├── is_numeric_spec.rb
│ │ │ │ │ │ ├── is_array_spec.rb
│ │ │ │ │ │ ├── is_hash_spec.rb
│ │ │ │ │ │ ├── strftime_spec.rb
│ │ │ │ │ │ ├── is_mac_address_spec.rb
│ │ │ │ │ │ ├── is_string_spec.rb
│ │ │ │ │ │ ├── pick_spec.rb
│ │ │ │ │ │ ├── range_spec.rb
│ │ │ │ │ │ ├── has_ip_network_spec.rb
│ │ │ │ │ │ ├── values_spec.rb
│ │ │ │ │ │ ├── has_ip_address_spec.rb
│ │ │ │ │ │ ├── is_ip_address_spec.rb
│ │ │ │ │ │ └── type_spec.rb
│ │ │ │ └── facter
│ │ │ │ │ └── util
│ │ │ │ │ └── puppet_settings_spec.rb
│ │ │ └── spec_helper.rb
│ │ │ ├── .gemfile
│ │ │ ├── .travis.yml
│ │ │ ├── Modulefile
│ │ │ ├── manifests
│ │ │ ├── init.pp
│ │ │ └── stages.pp
│ │ │ ├── lib
│ │ │ ├── puppet
│ │ │ │ └── parser
│ │ │ │ │ └── functions
│ │ │ │ │ ├── is_hash.rb
│ │ │ │ │ ├── is_array.rb
│ │ │ │ │ ├── parseyaml.rb
│ │ │ │ │ ├── loadyaml.rb
│ │ │ │ │ ├── parsejson.rb
│ │ │ │ │ ├── keys.rb
│ │ │ │ │ ├── sort.rb
│ │ │ │ │ ├── is_float.rb
│ │ │ │ │ ├── is_integer.rb
│ │ │ │ │ ├── is_numeric.rb
│ │ │ │ │ ├── is_string.rb
│ │ │ │ │ ├── get_module_path.rb
│ │ │ │ │ ├── empty.rb
│ │ │ │ │ ├── reverse.rb
│ │ │ │ │ ├── grep.rb
│ │ │ │ │ ├── is_mac_address.rb
│ │ │ │ │ ├── getvar.rb
│ │ │ │ │ ├── is_ip_address.rb
│ │ │ │ │ ├── flatten.rb
│ │ │ │ │ ├── has_ip_address.rb
│ │ │ │ │ ├── has_ip_network.rb
│ │ │ │ │ ├── rstrip.rb
│ │ │ │ │ ├── values.rb
│ │ │ │ │ ├── has_key.rb
│ │ │ │ │ ├── lstrip.rb
│ │ │ │ │ ├── downcase.rb
│ │ │ │ │ ├── squeeze.rb
│ │ │ │ │ ├── strip.rb
│ │ │ │ │ ├── to_bytes.rb
│ │ │ │ │ ├── validate_hash.rb
│ │ │ │ │ ├── validate_array.rb
│ │ │ │ │ ├── hash.rb
│ │ │ │ │ ├── upcase.rb
│ │ │ │ │ ├── swapcase.rb
│ │ │ │ │ ├── capitalize.rb
│ │ │ │ │ ├── validate_string.rb
│ │ │ │ │ ├── abs.rb
│ │ │ │ │ ├── chomp.rb
│ │ │ │ │ ├── join.rb
│ │ │ │ │ ├── uriescape.rb
│ │ │ │ │ ├── validate_bool.rb
│ │ │ │ │ ├── pick.rb
│ │ │ │ │ ├── str2saltedsha512.rb
│ │ │ │ │ ├── member.rb
│ │ │ │ │ ├── merge.rb
│ │ │ │ │ ├── prefix.rb
│ │ │ │ │ ├── chop.rb
│ │ │ │ │ ├── defined_with_params.rb
│ │ │ │ │ ├── num2bool.rb
│ │ │ │ │ ├── unique.rb
│ │ │ │ │ ├── time.rb
│ │ │ │ │ ├── delete.rb
│ │ │ │ │ ├── type.rb
│ │ │ │ │ ├── shuffle.rb
│ │ │ │ │ ├── fqdn_rotate.rb
│ │ │ │ │ ├── str2bool.rb
│ │ │ │ │ ├── delete_at.rb
│ │ │ │ │ ├── size.rb
│ │ │ │ │ ├── ensure_resource.rb
│ │ │ │ │ ├── is_domain_name.rb
│ │ │ │ │ └── has_interface_with.rb
│ │ │ └── facter
│ │ │ │ ├── root_home.rb
│ │ │ │ ├── util
│ │ │ │ └── puppet_settings.rb
│ │ │ │ ├── puppet_vardir.rb
│ │ │ │ └── pe_version.rb
│ │ │ ├── LICENSE
│ │ │ └── RELEASE_PROCESS.markdown
│ └── app
│ │ ├── webserver.pp
│ │ ├── php.pp
│ │ ├── symfony.pp
│ │ ├── tools.pp
│ │ ├── webserver
│ │ ├── apache2.pp
│ │ └── nginx.pp
│ │ ├── php
│ │ └── fpm.pp
│ │ └── database.pp
├── files
│ └── etc
│ │ ├── php5
│ │ └── fpm
│ │ │ └── pool.d
│ │ │ └── app.conf
│ │ ├── nginx
│ │ ├── nginx.conf
│ │ ├── vhosts.d
│ │ │ └── app.dev.conf
│ │ └── fastcgi_params
│ │ └── apache2
│ │ └── sites-available
│ │ └── app.dev
├── Personalization.dist
└── Vagrantfile
├── web
├── favicon.ico
├── apple-touch-icon.png
├── robots.txt
├── app.php
└── app_dev.php
├── .travis.yml
├── .gitmodules
├── .gitignore
├── LICENSE
└── UPGRADE-2.2.md
/app/logs/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/.htaccess:
--------------------------------------------------------------------------------
1 | deny from all
--------------------------------------------------------------------------------
/bin/.htaccess:
--------------------------------------------------------------------------------
1 | deny from all
--------------------------------------------------------------------------------
/cache/.htaccess:
--------------------------------------------------------------------------------
1 | Deny from all
--------------------------------------------------------------------------------
/src/.htaccess:
--------------------------------------------------------------------------------
1 | deny from all
--------------------------------------------------------------------------------
/vagrant/.gitignore:
--------------------------------------------------------------------------------
1 | .vagrant
2 | Personalization
3 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/.gitignore:
--------------------------------------------------------------------------------
1 | .pkg
2 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/tests/init.pp:
--------------------------------------------------------------------------------
1 | include apache
2 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/tests/init.pp:
--------------------------------------------------------------------------------
1 | include mysql
2 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/tests/init.pp:
--------------------------------------------------------------------------------
1 | include stdlib
2 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/tests/dev.pp:
--------------------------------------------------------------------------------
1 | include apache::dev
2 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/tests/php.pp:
--------------------------------------------------------------------------------
1 | include apache::php
2 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/tests/ruby.pp:
--------------------------------------------------------------------------------
1 | include mysql::ruby
2 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/tests/java.pp:
--------------------------------------------------------------------------------
1 | class { 'mysql::java':}
2 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/tests/python.pp:
--------------------------------------------------------------------------------
1 | class { 'mysql::python':}
2 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/Rakefile:
--------------------------------------------------------------------------------
1 | require 'puppetlabs_spec_helper/rake_tasks'
2 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/Rakefile:
--------------------------------------------------------------------------------
1 | require 'puppetlabs_spec_helper/rake_tasks'
2 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/.rspec:
--------------------------------------------------------------------------------
1 | --color
2 | --format
3 | progress
4 | --backtrace
5 |
--------------------------------------------------------------------------------
/web/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/phiamo/symfony-bootstrap/HEAD/web/favicon.ico
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | require 'puppetlabs_spec_helper/module_spec_helper'
2 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | require 'puppetlabs_spec_helper/module_spec_helper'
2 |
--------------------------------------------------------------------------------
/web/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/phiamo/symfony-bootstrap/HEAD/web/apple-touch-icon.png
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/Rakefile:
--------------------------------------------------------------------------------
1 | require 'rubygems'
2 | require 'puppetlabs_spec_helper/rake_tasks'
3 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/manifests/mod/cgi.pp:
--------------------------------------------------------------------------------
1 | class apache::mod::cgi {
2 | apache::mod { 'cgi': }
3 | }
4 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/manifests/mod/dav.pp:
--------------------------------------------------------------------------------
1 | class apache::mod::dav {
2 | apache::mod { 'dav': }
3 | }
4 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/manifests/mod/perl.pp:
--------------------------------------------------------------------------------
1 | class apache::mod::perl {
2 | apache::mod { 'perl': }
3 | }
4 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/manifests/mod/ssl.pp:
--------------------------------------------------------------------------------
1 | class apache::mod::ssl {
2 | apache::mod { 'ssl': }
3 | }
4 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/spec/spec.opts:
--------------------------------------------------------------------------------
1 | --format
2 | s
3 | --colour
4 | --loadby
5 | mtime
6 | --backtrace
7 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/spec/spec.opts:
--------------------------------------------------------------------------------
1 | --format
2 | s
3 | --colour
4 | --loadby
5 | mtime
6 | --backtrace
7 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/spec.opts:
--------------------------------------------------------------------------------
1 | --format
2 | s
3 | --colour
4 | --loadby
5 | mtime
6 | --backtrace
7 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/manifests/mod/cache.pp:
--------------------------------------------------------------------------------
1 | class apache::mod::cache {
2 | apache::mod { 'cache': }
3 | }
4 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/manifests/mod/fcgid.pp:
--------------------------------------------------------------------------------
1 | class apache::mod::fcgid {
2 | apache::mod { 'fcgid': }
3 | }
4 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/tests/mysql_grant.pp:
--------------------------------------------------------------------------------
1 | database_grant{'test1@localhost/redmine':
2 | privileges => [update],
3 | }
4 |
--------------------------------------------------------------------------------
/app/Resources/java/cssembed-0.3.6.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/phiamo/symfony-bootstrap/HEAD/app/Resources/java/cssembed-0.3.6.jar
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/manifests/mod/auth_basic.pp:
--------------------------------------------------------------------------------
1 | class apache::mod::auth_basic {
2 | apache::mod { 'auth_basic': }
3 | }
4 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/tests/server.pp:
--------------------------------------------------------------------------------
1 | class { 'mysql::server':
2 | config_hash => { 'root_password' => 'password', },
3 | }
4 |
--------------------------------------------------------------------------------
/web/robots.txt:
--------------------------------------------------------------------------------
1 | # www.robotstxt.org/
2 | # www.google.com/support/webmasters/bin/answer.py?hl=en&answer=156449
3 |
4 | User-agent: *
5 |
--------------------------------------------------------------------------------
/app/Resources/java/yuicompressor-2.4.6.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/phiamo/symfony-bootstrap/HEAD/app/Resources/java/yuicompressor-2.4.6.jar
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/manifests/mod/python.pp:
--------------------------------------------------------------------------------
1 | class apache::mod::python {
2 | #include apache
3 | apache::mod { 'python': }
4 | }
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: php
2 |
3 | php:
4 | - 5.3.3
5 | - 5.3
6 | - 5.4
7 |
8 | before_script: composer install -n
9 |
10 | script: phpunit -c app
11 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/manifests/mod/dav_fs.pp:
--------------------------------------------------------------------------------
1 | class apache::mod::dav_fs {
2 | Class['apache::mod::dav'] -> Class['apache::mod::dav_fs']
3 | apache::mod { 'dav_fs': }
4 | }
5 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/.fixtures.yml:
--------------------------------------------------------------------------------
1 | fixtures:
2 | repositories:
3 | "stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib"
4 | symlinks:
5 | "mysql": "#{source_dir}"
6 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/templates/my.cnf.pass.erb:
--------------------------------------------------------------------------------
1 | [client]
2 | user=root
3 | host=localhost
4 | <% unless root_password == 'UNSET' -%>
5 | password=<%= root_password %>
6 | <% end -%>
7 |
--------------------------------------------------------------------------------
/app/AppCache.php:
--------------------------------------------------------------------------------
1 | { 'root_password' => 'password', },
3 | }
4 | class { 'mysql::server::account_security': }
5 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/manifests/mod/proxy_http.pp:
--------------------------------------------------------------------------------
1 | class apache::mod::proxy_http {
2 | Class['apache::mod::proxy'] -> Class['apache::mod::proxy_http']
3 | apache::mod { 'proxy_http': }
4 | }
5 |
--------------------------------------------------------------------------------
/vagrant/puppet/app/webserver.pp:
--------------------------------------------------------------------------------
1 | class app::webserver {
2 | if 'nginx' == $webserver {
3 | include app::webserver::nginx
4 | } else {
5 | include app::webserver::apache2
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/tests/has_ip_network.pp:
--------------------------------------------------------------------------------
1 | include stdlib
2 | info("has_ip_network('127.0.0.0'):", has_ip_network('127.0.0.0'))
3 | info("has_ip_network('128.0.0.0'):", has_ip_network('128.0.0.0'))
4 |
5 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/tests/has_ip_address.pp:
--------------------------------------------------------------------------------
1 | include stdlib
2 | info("has_ip_address('192.168.1.256'):", has_ip_address('192.168.1.256'))
3 | info("has_ip_address('127.0.0.1'):", has_ip_address('127.0.0.1'))
4 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/tests/apache.pp:
--------------------------------------------------------------------------------
1 | include apache
2 | include apache::mod::php
3 | include apache::mod::cgi
4 | include apache::mod::userdir
5 | include apache::mod::disk_cache
6 | include apache::mod::proxy_http
7 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/.gemfile:
--------------------------------------------------------------------------------
1 | source :rubygems
2 |
3 | puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 2.7']
4 | gem 'puppet', puppetversion
5 | gem 'puppetlabs_spec_helper', '>= 0.1.0'
6 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/.gemfile:
--------------------------------------------------------------------------------
1 | source :rubygems
2 |
3 | puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 2.7']
4 | gem 'puppet', puppetversion
5 | gem 'puppetlabs_spec_helper', '>= 0.1.0'
6 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/.gemfile:
--------------------------------------------------------------------------------
1 | source :rubygems
2 |
3 | puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 2.7']
4 | gem 'puppet', puppetversion
5 | gem 'puppetlabs_spec_helper', '>= 0.1.0'
6 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/manifests/mod/php.pp:
--------------------------------------------------------------------------------
1 | class apache::mod::php {
2 | apache::mod { 'php5': }
3 | file { "${apache::params::vdir}/php.conf":
4 | ensure => present,
5 | content => template('apache/mod/php.conf.erb'),
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/monkey_patches/alias_should_to_must.rb:
--------------------------------------------------------------------------------
1 | require 'rspec'
2 |
3 | class Object
4 | # This is necessary because the RAL has a 'should'
5 | # method.
6 | alias :must :should
7 | alias :must_not :should_not
8 | end
9 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/.fixtures.yml:
--------------------------------------------------------------------------------
1 | fixtures:
2 | repositories:
3 | stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib.git"
4 | firewall: "git://github.com/puppetlabs/puppetlabs-firewall.git"
5 | symlinks:
6 | apache: "#{source_dir}"
7 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/tests/backup.pp:
--------------------------------------------------------------------------------
1 | class { 'mysql::server':
2 | config_hash => {'root_password' => 'password'}
3 | }
4 | class { 'mysql::backup':
5 | backupuser => 'myuser',
6 | backuppassword => 'mypassword',
7 | backupdir => '/tmp/backups',
8 | }
9 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/tests/file_line.pp:
--------------------------------------------------------------------------------
1 | # This is a simple smoke test
2 | # of the file_line resource type.
3 | file { '/tmp/dansfile':
4 | ensure => present
5 | }->
6 | file_line { 'dans_line':
7 | line => 'dan is awesome',
8 | path => '/tmp/dansfile',
9 | }
10 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/tests/server/config.pp:
--------------------------------------------------------------------------------
1 | mysql::server::config { 'testfile':
2 | settings => {
3 | 'mysqld' => {
4 | 'bind-address' => '0.0.0.0',
5 | 'read-only' => true,
6 | },
7 | 'client' => {
8 | 'port' => '3306'
9 | }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/manifests/mod/dev.pp:
--------------------------------------------------------------------------------
1 | class apache::mod::dev inherits apache::params {
2 | # Development packages have no mod to load
3 | $packages = $apache::params::mod_packages['dev']
4 | package { $packages:
5 | ensure => present,
6 | require => Package['httpd'],
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/app/config/routing.yml:
--------------------------------------------------------------------------------
1 | # Internal routing configuration to handle ESI
2 | #_internal:
3 | # resource: "@FrameworkBundle/Resources/config/routing/internal.xml"
4 | # prefix: /_internal
5 |
6 | mopa_bootstrap_welcome:
7 | pattern: /
8 | defaults: { _controller: MopaBootstrapSandboxBundle:Examples:index }
9 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/spec/classes/ssl_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'apache::ssl', :type => :class do
4 | describe 'when running on redhat' do
5 | let(:facts) { {:operatingsystem => 'redhat', :osfamily => 'redhat'} }
6 | it { should include_class('apache::mod::ssl') }
7 | end
8 | end
9 |
--------------------------------------------------------------------------------
/vagrant/puppet/app/php.pp:
--------------------------------------------------------------------------------
1 | class app::php {
2 | package {["php5", "php5-dev", "php-apc", "php5-mysql", "php5-suhosin", "php5-cli"]:
3 | ensure => present,
4 | notify => Service[$webserverService],
5 | }
6 |
7 | if 'nginx' == $webserver {
8 | include app::php::fpm
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/vagrant/puppet/app/symfony.pp:
--------------------------------------------------------------------------------
1 | class app::symfony {
2 | exec {"clear-symfony-cache":
3 | require => Exec["db-default-data"],
4 | command => "sudo /bin/bash -c 'cd /srv/www/vhosts/$vhost.dev && /usr/bin/php app/console cache:clear --env=dev && /usr/bin/php app/console cache:clear --env=prod'",
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/type/anchor_spec.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'puppet'
4 |
5 | anchor = Puppet::Type.type(:anchor).new(:name => "ntp::begin")
6 |
7 | describe anchor do
8 | it "should stringify normally" do
9 | anchor.to_s.should == "Anchor[ntp::begin]"
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/app/autoload.php:
--------------------------------------------------------------------------------
1 | present,
8 | content => template('apache/mod/proxy.conf.erb'),
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/manifests/mod/wsgi.pp:
--------------------------------------------------------------------------------
1 | class apache::mod::wsgi {
2 | include apache
3 |
4 | package { 'mod_wsgi_package':
5 | ensure => installed,
6 | name => $apache::params::mod_wsgi_package,
7 | require => Package['httpd'];
8 | }
9 |
10 | a2mod { 'wsgi': ensure => present; }
11 |
12 | }
13 |
14 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/manifests/mod/userdir.pp:
--------------------------------------------------------------------------------
1 | class apache::mod::userdir (
2 | $dir = 'public_html',
3 | ) {
4 | apache::mod { 'userdir': }
5 |
6 | # Template uses $dir
7 | file { "${apache::params::vdir}/userdir.conf":
8 | ensure => present,
9 | content => template('apache/mod/userdir.conf.erb'),
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/.travis.yml:
--------------------------------------------------------------------------------
1 | language: ruby
2 | rvm:
3 | - 1.8.7
4 | before_script:
5 | after_script:
6 | script: "rake spec_full"
7 | branches:
8 | only:
9 | - master
10 | env:
11 | - PUPPET_VERSION=2.7.13
12 | - PUPPET_VERSION=2.7.6
13 | - PUPPET_VERSION=2.6.9
14 | notifications:
15 | email: false
16 | gemfile: .gemfile
17 |
--------------------------------------------------------------------------------
/app/config/config_test.yml:
--------------------------------------------------------------------------------
1 | imports:
2 | - { resource: config_dev.yml }
3 |
4 | framework:
5 | test: ~
6 | session:
7 | storage_id: session.storage.mock_file
8 | profiler:
9 | collect: false
10 |
11 | web_profiler:
12 | toolbar: false
13 | intercept_redirects: false
14 |
15 | swiftmailer:
16 | disable_delivery: true
17 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/tests/mysql_database.pp:
--------------------------------------------------------------------------------
1 | class { 'mysql::server':
2 | config_hash => {'root_password' => 'password'}
3 | }
4 | database{ ['test1', 'test2', 'test3']:
5 | ensure => present,
6 | charset => 'utf8',
7 | require => Class['mysql::server'],
8 | }
9 | database{ 'test4':
10 | ensure => present,
11 | charset => 'latin1',
12 | }
13 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/manifests/mod/auth_kerb.pp:
--------------------------------------------------------------------------------
1 | class apache::mod::auth_kerb {
2 | include apache
3 |
4 | package { 'mod_auth_kerb_package':
5 | ensure => installed,
6 | name => $apache::params::mod_auth_kerb_package,
7 | require => Package['httpd'];
8 | }
9 |
10 | a2mod { 'auth_kerb': ensure => present; }
11 |
12 | }
13 |
14 |
15 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/Modulefile:
--------------------------------------------------------------------------------
1 | name 'puppetlabs-mysql'
2 | version '0.5.0'
3 | source 'git://github.com/puppetlabs/puppetlabs-mysql.git'
4 | author 'Puppet Labs'
5 | license 'Apache 2.0'
6 | summary 'Mysql module'
7 | description 'Mysql module'
8 | project_page 'http://github.com/puppetlabs/puppetlabs-mysql'
9 | dependency 'puppetlabs/stdlib', '>= 2.2.1'
10 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/templates/mod/disk_cache.conf.erb:
--------------------------------------------------------------------------------
1 |
2 | # To enable a cache of proxied content, uncomment the following lines.
3 | # See http://httpd.apache.org/docs/2.2/mod/mod_cache.html for more details.
4 |
5 | CacheEnable disk /
6 | CacheRoot "<%= cache_root %>"
7 |
8 |
9 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/manifests/proxy.pp:
--------------------------------------------------------------------------------
1 | # Class: apache::proxy
2 | #
3 | # This class enabled the proxy module for Apache
4 | #
5 | # Actions:
6 | # - Enables Apache Proxy module
7 | #
8 | # Requires:
9 | #
10 | # Sample Usage:
11 | #
12 | class apache::proxy {
13 | warning('apache::proxy is deprecated; please use apache::mod::proxy')
14 | include apache::mod::proxy
15 | }
16 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/tests/vhost.pp:
--------------------------------------------------------------------------------
1 | include apache
2 | apache::vhost {
3 | 'test.vhost':
4 | port => 80,
5 | docroot => '/tmp/testvhost',
6 | template => 'apache/test.vhost.erb';
7 | 'test.vhost-override':
8 | port => 80,
9 | docroot => '/tmp/testvhost',
10 | override => ['Options', 'FileInfo'],
11 | template => 'apache/test.vhost.erb';
12 | }
13 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/manifests/php.pp:
--------------------------------------------------------------------------------
1 | # Class: apache::php
2 | #
3 | # This class installs PHP for Apache
4 | #
5 | # Parameters:
6 | # - $php_package
7 | #
8 | # Actions:
9 | # - Install Apache PHP package
10 | #
11 | # Requires:
12 | #
13 | # Sample Usage:
14 | #
15 | class apache::php {
16 | warning('apache::php is deprecated; please use apache::mod::php')
17 | include apache::mod::php
18 | }
19 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/manifests/dev.pp:
--------------------------------------------------------------------------------
1 | # Class: apache::dev
2 | #
3 | # This class installs Apache development libraries
4 | #
5 | # Parameters:
6 | #
7 | # Actions:
8 | # - Install Apache development libraries
9 | #
10 | # Requires:
11 | #
12 | # Sample Usage:
13 | #
14 | class apache::dev {
15 | warning('apache::dev is deprecated; please use apache::mod::dev')
16 | include apache::mod::dev
17 | }
18 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/manifests/python.pp:
--------------------------------------------------------------------------------
1 | # Class: apache::python
2 | #
3 | # This class installs Python for Apache
4 | #
5 | # Parameters:
6 | # - $php_package
7 | #
8 | # Actions:
9 | # - Install Apache Python package
10 | #
11 | # Requires:
12 | #
13 | # Sample Usage:
14 | #
15 | class apache::python {
16 | warning('apache::python is deprecated; please use apache::mod::python')
17 | include apache::mod::python
18 | }
19 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/Modulefile:
--------------------------------------------------------------------------------
1 | name 'puppetlabs-stdlib'
2 | version '3.1.1'
3 | source 'git://github.com/puppetlabs/puppetlabs-stdlib'
4 | author 'puppetlabs'
5 | license 'Apache 2.0'
6 | summary 'Puppet Module Standard Library'
7 | description 'Standard Library for Puppet Modules'
8 | project_page 'https://github.com/puppetlabs/puppetlabs-stdlib'
9 |
10 | ## Add dependencies, if any:
11 | # dependency 'username/name', '>= 1.2.0'
12 |
--------------------------------------------------------------------------------
/vagrant/files/etc/php5/fpm/pool.d/app.conf:
--------------------------------------------------------------------------------
1 | [shelf]
2 |
3 | listen = /run/shm/<%= @vhost %>.phpfpm.socket
4 | user = vagrant
5 | group = users
6 | pm = static
7 | pm.max_children = 1
8 | ;request_slowlog_timeout = 1
9 | ;slowlog = /var/log/fpm.$pool.slow.log
10 | php_value[memory_limit] = 600M
11 | php_value[post_max_size] = 600M
12 | php_value[upload_max_filesize] = 600M
13 | php_value[max_file_uploads] = 300
14 | php_flag[magic_quotes_gpc] = off
15 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/templates/vhost-redirect.conf.erb:
--------------------------------------------------------------------------------
1 | NameVirtualHost <%= vhost_name %>:<%= port %>
2 | :<%= port %>>
3 | ServerName <%= srvname %>
4 | <% if serveraliases.is_a? Array %>
5 | <% serveraliases.each do |name| %><%= " ServerAlias #{name}\n" %><% end %>
6 | <% elsif serveraliases != '' %>
7 | <%= " ServerAlias #{serveraliases}" %>
8 | <% end %>
9 | Redirect / <%= dest %>/
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/config/parameters.yml.dist:
--------------------------------------------------------------------------------
1 | parameters:
2 | database_driver: pdo_sqlite
3 | database_host: localhost
4 | database_port: null
5 | database_name: symfony
6 | database_user: root
7 | database_password: null
8 |
9 | mailer_transport: smtp
10 | mailer_host: 127.0.0.1
11 | mailer_user: ~
12 | mailer_password: ~
13 |
14 | locale: en
15 | secret: ThisTokenIsNotSoSecretChangeIt
16 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/lib/puppet/provider/a2mod/modfix.rb:
--------------------------------------------------------------------------------
1 | Puppet::Type.type(:a2mod).provide :modfix do
2 | desc "Dummy provider for A2mod.
3 |
4 | Fake nil resources when there is no crontab binary available. Allows
5 | puppetd to run on a bootstrapped machine before a Cron package has been
6 | installed. Workaround for: http://projects.puppetlabs.com/issues/2384
7 | "
8 |
9 | def self.instances
10 | []
11 | end
12 | end
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/manifests/ssl.pp:
--------------------------------------------------------------------------------
1 | # Class: apache::ssl
2 | #
3 | # This class installs Apache SSL capabilities
4 | #
5 | # Parameters:
6 | # - The $ssl_package name from the apache::params class
7 | #
8 | # Actions:
9 | # - Install Apache SSL capabilities
10 | #
11 | # Requires:
12 | #
13 | # Sample Usage:
14 | #
15 | class apache::ssl {
16 | warning('apache::ssl is deprecated; please use apache::mod::ssl')
17 | include apache::mod::ssl
18 | }
19 |
--------------------------------------------------------------------------------
/vagrant/files/etc/nginx/nginx.conf:
--------------------------------------------------------------------------------
1 |
2 | worker_processes 1;
3 |
4 | events {
5 | worker_connections 1024;
6 | use epoll;
7 | }
8 |
9 | http {
10 | include mime.types;
11 | default_type application/octet-stream;
12 |
13 | sendfile off;
14 |
15 | keepalive_timeout 65;
16 |
17 | large_client_header_buffers 8 16k;
18 |
19 | include conf.d/*.conf;
20 | charset utf-8;
21 |
22 | include vhosts.d/*.conf;
23 | }
24 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/lib/puppet/type/database.rb:
--------------------------------------------------------------------------------
1 | # This has to be a separate type to enable collecting
2 | Puppet::Type.newtype(:database) do
3 | @doc = "Manage databases."
4 |
5 | ensurable
6 |
7 | newparam(:name, :namevar=>true) do
8 | desc "The name of the database."
9 | end
10 |
11 | newproperty(:charset) do
12 | desc "The characterset to use for a database"
13 | defaultto :utf8
14 | newvalue(/^\S+$/)
15 | end
16 |
17 | end
18 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/monkey_patches/publicize_methods.rb:
--------------------------------------------------------------------------------
1 | # Some monkey-patching to allow us to test private methods.
2 | class Class
3 | def publicize_methods(*methods)
4 | saved_private_instance_methods = methods.empty? ? self.private_instance_methods : methods
5 |
6 | self.class_eval { public(*saved_private_instance_methods) }
7 | yield
8 | self.class_eval { private(*saved_private_instance_methods) }
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/vagrant/Personalization.dist:
--------------------------------------------------------------------------------
1 | # Name of the vhost to create
2 | $vhost = "bootstrap"
3 | # this will also be the username and the database name set up by vagrant
4 |
5 | # VM IP
6 | $ip = "192.168.10.42"
7 |
8 | # Use NFS?
9 | $use_nfs = true
10 |
11 | # Base box name
12 | $base_box = "ubuntu-server-1204"
13 |
14 | # Which webserver do you want to use?
15 | # Valid choices are "nginx" and "apache2"
16 | #
17 | # Note: nginx implies the use of php-fpm
18 | $webserver = "nginx"
19 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/manifests/mod/proxy_html.pp:
--------------------------------------------------------------------------------
1 | class apache::mod::proxy_html {
2 | Class['apache::mod::proxy'] -> Class['apache::mod::proxy_html']
3 | Class['apache::mod::proxy_http'] -> Class['apache::mod::proxy_html']
4 | apache::mod { 'proxy_html': }
5 | # proxy_html uses libxml2 so we need to load this .so
6 | file { "${apache::params::mod_dir}/libxml2.load":
7 | ensure => present,
8 | content => "LoadFile /usr/lib/libxml2.so.2\n",
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/Modulefile:
--------------------------------------------------------------------------------
1 | name 'puppetlabs-apache'
2 | version '0.4.0'
3 | source 'git://github.com/puppetlabs/puppetlabs-apache.git'
4 | author 'puppetlabs'
5 | license 'Apache 2.0'
6 | summary 'Puppet module for Apache'
7 | description 'Module for Apache configuration'
8 | project_page 'https://github.com/puppetlabs/puppetlabs-apache'
9 |
10 | ## Add dependencies, if any:
11 | dependency 'puppetlabs/firewall', '>= 0.0.4'
12 | dependency 'puppetlabs/stdlib', '>= 2.2.1'
13 |
--------------------------------------------------------------------------------
/vagrant/puppet/app/tools.pp:
--------------------------------------------------------------------------------
1 | class app::tools {
2 | package {["mlocate",
3 | "zip",
4 | "unzip",
5 | "strace",
6 | "patch",
7 | "git",
8 | "vim",
9 | "build-essential",
10 | "augeas-tools"]:
11 | ensure => present,
12 | }
13 |
14 | #exec {"find-utils-updatedb":
15 | # command => "/usr/bin/updatedb &",
16 | # require => Package["mlocate"],
17 | #}
18 | }
19 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/.travis.yml:
--------------------------------------------------------------------------------
1 | language: ruby
2 | rvm:
3 | - 1.8.7
4 | before_script:
5 | - "[ '2.6.9' = $PUPPET_VERSION ] && git clone git://github.com/puppetlabs/puppetlabs-create_resources.git spec/fixtures/modules/create_resources || true"
6 | after_script:
7 | script: "rake spec"
8 | branches:
9 | only:
10 | - master
11 | env:
12 | - PUPPET_VERSION=2.7.13
13 | - PUPPET_VERSION=2.7.6
14 | - PUPPET_VERSION=2.6.9
15 | notifications:
16 | email: false
17 | gemfile: .gemfile
18 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/TODO:
--------------------------------------------------------------------------------
1 | The best that I can tell is that this code traces back to David Schmitt. It has been forked many times since then :)
2 |
3 | 1. you cannot add databases to an instance that has a root password
4 | 2. you have to specify username as USER@BLAH or it cannot be found
5 | 3. mysql_grant does not complain if user does not exist
6 | 4. Needs support for pre-seeding on debian
7 | 5. the types may need to take user/password
8 | 6. rather or not to configure /etc/.my.cnf should be configurable
9 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/manifests/mod/disk_cache.pp:
--------------------------------------------------------------------------------
1 | class apache::mod::disk_cache (
2 | $cache_root = '/var/cache/mod_proxy'
3 | ) {
4 | Class['apache::mod::proxy'] -> Class['apache::mod::disk_cache']
5 | Class['apache::mod::cache'] -> Class['apache::mod::disk_cache']
6 |
7 | apache::mod { 'disk_cache': }
8 | # Template uses $cache_proxy
9 | file { "${apache::params::vdir}/disk_cache.conf":
10 | ensure => present,
11 | content => template('apache/mod/disk_cache.conf.erb'),
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/spec/classes/mod/wsgi_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'apache::mod::wsgi', :type => :class do
4 | context "On a Debian OS" do
5 | let :facts do
6 | { :osfamily => 'Debian' }
7 | end
8 | it { should include_class("apache") }
9 | it { should contain_package("mod_wsgi_package").with(
10 | 'require' => 'Package[httpd]'
11 | ) }
12 | it { should contain_a2mod("wsgi").with(
13 | 'ensure' => 'present'
14 | )
15 | }
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/manifests/init.pp:
--------------------------------------------------------------------------------
1 | # Class: stdlib
2 | #
3 | # This module manages stdlib. Most of stdlib's features are automatically
4 | # loaded by Puppet, but this class should be declared in order to use the
5 | # standardized run stages.
6 | #
7 | # Parameters: none
8 | #
9 | # Actions:
10 | #
11 | # Declares all other classes in the stdlib module. Currently, this consists
12 | # of stdlib::stages.
13 | #
14 | # Requires: nothing
15 | #
16 | class stdlib {
17 |
18 | class { 'stdlib::stages': }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/templates/test.vhost.erb:
--------------------------------------------------------------------------------
1 | #
2 | # Test vhost
3 | #
4 | NameVirtualHost *:80
5 |
6 | ServerName testvhost
7 | DocumentRoot <%= docroot %>
8 | >
9 | Options <%= options %>
10 | AllowOverride <%= Array(override).join(' ') %>
11 | Order allow,deny
12 | allow from all
13 |
14 | ErrorLog /var/log/apache2/error.log
15 | LogLevel warn
16 | CustomLog /var/log/apache2/access.log combined
17 | ServerSignature On
18 |
19 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/spec/classes/mod/auth_kerb_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'apache::mod::auth_kerb', :type => :class do
4 | context "On a Debian OS" do
5 | let :facts do
6 | { :osfamily => 'Debian' }
7 | end
8 | it { should include_class("apache") }
9 | it { should contain_package("mod_auth_kerb_package").with(
10 | 'require' => 'Package[httpd]'
11 | )
12 | }
13 | it { should contain_a2mod("auth_kerb").with(
14 | 'ensure' => 'present'
15 | )
16 | }
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/spec/classes/mysql_server_monitor_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 | describe 'mysql::server::monitor' do
3 | let :facts do
4 | { :osfamily => 'Debian' }
5 | end
6 | let :pre_condition do
7 | "include 'mysql::server'"
8 | end
9 | let :params do
10 | {
11 | :mysql_monitor_username => 'monitoruser',
12 | :mysql_monitor_password => 'monitorpass',
13 | :mysql_monitor_hostname => 'monitorhost'
14 | }
15 | end
16 |
17 | it { should contain_database_user("monitoruser@monitorhost")}
18 | end
19 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/manifests/init.pp:
--------------------------------------------------------------------------------
1 | # Class: mysql
2 | #
3 | # This class installs mysql client software.
4 | #
5 | # Parameters:
6 | # [*client_package_name*] - The name of the mysql client package.
7 | #
8 | # Actions:
9 | #
10 | # Requires:
11 | #
12 | # Sample Usage:
13 | #
14 | class mysql (
15 | $package_name = $mysql::params::client_package_name,
16 | $package_ensure = 'present'
17 | ) inherits mysql::params {
18 |
19 | package { 'mysql_client':
20 | ensure => $package_ensure,
21 | name => $package_name,
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/manifests/java.pp:
--------------------------------------------------------------------------------
1 | # Class: mysql::java
2 | #
3 | # This class installs the mysql-java-connector.
4 | #
5 | # Parameters:
6 | # [*java_package_name*] - The name of the mysql java package.
7 | #
8 | # Actions:
9 | #
10 | # Requires:
11 | #
12 | # Sample Usage:
13 | #
14 | class mysql::java (
15 | $package_name = $mysql::params::java_package_name,
16 | $package_ensure = 'present'
17 | ) inherits mysql::params {
18 |
19 | package { 'mysql-connector-java':
20 | ensure => $package_ensure,
21 | name => $package_name,
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/zip_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the zip function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should raise a ParseError if there is less than 1 arguments" do
8 | lambda { scope.function_zip([]) }.should( raise_error(Puppet::ParseError))
9 | end
10 |
11 | it "should be able to zip an array" do
12 | result = scope.function_zip([['1','2','3'],['4','5','6']])
13 | result.should(eq([["1", "4"], ["2", "5"], ["3", "6"]]))
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/is_hash.rb:
--------------------------------------------------------------------------------
1 | #
2 | # is_hash.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:is_hash, :type => :rvalue, :doc => <<-EOS
7 | Returns true if the variable passed to this function is a hash.
8 | EOS
9 | ) do |arguments|
10 |
11 | raise(Puppet::ParseError, "is_hash(): Wrong number of arguments " +
12 | "given (#{arguments.size} for 1)") if arguments.size != 1
13 |
14 | type = arguments[0]
15 |
16 | result = type.is_a?(Hash)
17 |
18 | return result
19 | end
20 | end
21 |
22 | # vim: set ts=2 sw=2 et :
23 |
--------------------------------------------------------------------------------
/app/config/config_prod.yml:
--------------------------------------------------------------------------------
1 | imports:
2 | - { resource: config.yml }
3 |
4 | #framework:
5 | # validation:
6 | # cache: apc
7 |
8 | #doctrine:
9 | # orm:
10 | # metadata_cache_driver: apc
11 | # result_cache_driver: apc
12 | # query_cache_driver: apc
13 |
14 | monolog:
15 | handlers:
16 | main:
17 | type: fingers_crossed
18 | action_level: error
19 | handler: nested
20 | nested:
21 | type: stream
22 | path: %kernel.logs_dir%/%kernel.environment%.log
23 | level: debug
24 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/is_array.rb:
--------------------------------------------------------------------------------
1 | #
2 | # is_array.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:is_array, :type => :rvalue, :doc => <<-EOS
7 | Returns true if the variable passed to this function is an array.
8 | EOS
9 | ) do |arguments|
10 |
11 | raise(Puppet::ParseError, "is_array(): Wrong number of arguments " +
12 | "given (#{arguments.size} for 1)") if arguments.size < 1
13 |
14 | type = arguments[0]
15 |
16 | result = type.is_a?(Array)
17 |
18 | return result
19 | end
20 | end
21 |
22 | # vim: set ts=2 sw=2 et :
23 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/lib/puppet/parser/functions/mysql_password.rb:
--------------------------------------------------------------------------------
1 | # hash a string as mysql's "PASSWORD()" function would do it
2 | require 'digest/sha1'
3 |
4 | module Puppet::Parser::Functions
5 | newfunction(:mysql_password, :type => :rvalue, :doc => <<-EOS
6 | Returns the mysql password hash from the clear text password.
7 | EOS
8 | ) do |args|
9 |
10 | raise(Puppet::ParseError, "mysql_password(): Wrong number of arguments " +
11 | "given (#{args.size} for 1)") if args.size != 1
12 |
13 | '*' + Digest::SHA1.hexdigest(Digest::SHA1.digest(args[0])).upcase
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/tests/mysql_user.pp:
--------------------------------------------------------------------------------
1 | $mysql_root_pw = 'password'
2 |
3 | class { 'mysql::server':
4 | config_hash => {
5 | root_password => 'password',
6 | }
7 | }
8 |
9 | database_user{ 'redmine@localhost':
10 | ensure => present,
11 | password_hash => mysql_password('redmine'),
12 | require => Class['mysql::server'],
13 | }
14 |
15 | database_user{ 'dan@localhost':
16 | ensure => present,
17 | password_hash => mysql_password('blah')
18 | }
19 |
20 | database_user{ 'dan@%':
21 | ensure => present,
22 | password_hash => mysql_password('blah'),
23 | }
24 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/spec/classes/params_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'apache::params', :type => :class do
4 | context "On a Debian OS" do
5 | let :facts do
6 | { :osfamily => 'Debian' }
7 | end
8 | it { should contain_apache__params }
9 |
10 | # There are 4 resources in this class currently
11 | # there should not be any more resources because it is a params class
12 | # The resources are class[apache::params], class[main], class[settings], stage[main]
13 | it "Should not contain any resources" do
14 | subject.resources.size.should == 4
15 | end
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/templates/my.conf.cnf.erb:
--------------------------------------------------------------------------------
1 | ### MANAGED BY PUPPET ###
2 | <% settings.sort.each do |section, content| -%>
3 | [<%= section %>]
4 | <% content.sort.each do |key, values| -%>
5 | <% [values].flatten.sort.each do |value| -%>
6 | <%= value == false ? '#' : '' %><%= key -%><%=
7 | case value
8 | when true, false
9 | ''
10 | else
11 | " = #{value}"
12 | end
13 | %>
14 | <% end -%>
15 | <% end -%>
16 |
17 | <% end -%>
18 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/parseyaml.rb:
--------------------------------------------------------------------------------
1 | #
2 | # parseyaml.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:parseyaml, :type => :rvalue, :doc => <<-EOS
7 | This function accepts YAML as a string and converts it into the correct
8 | Puppet structure.
9 | EOS
10 | ) do |arguments|
11 |
12 | if (arguments.size != 1) then
13 | raise(Puppet::ParseError, "parseyaml(): Wrong number of arguments "+
14 | "given #{arguments.size} for 1")
15 | end
16 |
17 | require 'yaml'
18 |
19 | YAML::load(arguments[0])
20 |
21 | end
22 | end
23 |
24 | # vim: set ts=2 sw=2 et :
25 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/loadyaml.rb:
--------------------------------------------------------------------------------
1 | module Puppet::Parser::Functions
2 |
3 | newfunction(:loadyaml, :type => :rvalue, :doc => <<-'ENDHEREDOC') do |args|
4 | Load a YAML file containing an array, string, or hash, and return the data
5 | in the corresponding native data type.
6 |
7 | For example:
8 |
9 | $myhash = loadyaml('/etc/puppet/data/myhash.yaml')
10 | ENDHEREDOC
11 |
12 | unless args.length == 1
13 | raise Puppet::ParseError, ("loadyaml(): wrong number of arguments (#{args.length}; must be 1)")
14 | end
15 |
16 | YAML.load_file(args[0])
17 |
18 | end
19 |
20 | end
21 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/lib/puppet/provider/a2mod/a2mod.rb:
--------------------------------------------------------------------------------
1 | Puppet::Type.type(:a2mod).provide(:a2mod) do
2 | desc "Manage Apache 2 modules on Debian and Ubuntu"
3 |
4 | optional_commands :encmd => "a2enmod"
5 | optional_commands :discmd => "a2dismod"
6 |
7 | confine :osfamily => :debian
8 | defaultfor :operatingsystem => [:debian, :ubuntu]
9 |
10 | def create
11 | encmd resource[:name]
12 | end
13 |
14 | def destroy
15 | discmd resource[:name]
16 | end
17 |
18 | def exists?
19 | mod= "/etc/apache2/mods-enabled/" + resource[:name] + ".load"
20 | File.exists?(mod)
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/spec/classes/python_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'apache::python', :type => :class do
4 | context "On a Debian OS" do
5 | let :facts do
6 | { :osfamily => 'Debian' }
7 | end
8 | it { should include_class("apache::params") }
9 | it { should contain_package("libapache2-mod-python") }
10 | end
11 | context "On a RedHat OS" do
12 | let :facts do
13 | { :osfamily => 'RedHat' }
14 | end
15 | it { should include_class("apache::params") }
16 | it { should contain_package("mod_python") }
17 | it { should contain_a2mod("python").with('ensure'=>'present') }
18 | end
19 | end
20 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/manifests/python.pp:
--------------------------------------------------------------------------------
1 | # Class: mysql::python
2 | #
3 | # This class installs the python libs for mysql.
4 | #
5 | # Parameters:
6 | # [*ensure*] - ensure state for package.
7 | # can be specified as version.
8 | # [*package_name*] - name of package
9 | #
10 | # Actions:
11 | #
12 | # Requires:
13 | #
14 | # Sample Usage:
15 | #
16 | class mysql::python(
17 | $package_name = $mysql::params::python_package_name,
18 | $package_ensure = 'present'
19 | ) inherits mysql::params {
20 |
21 | package { 'python-mysqldb':
22 | ensure => $package_ensure,
23 | name => $package_name,
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/strip_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the strip function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 | it "should exist" do
7 | Puppet::Parser::Functions.function("strip").should == "function_strip"
8 | end
9 |
10 | it "should raise a ParseError if there is less than 1 arguments" do
11 | lambda { scope.function_strip([]) }.should( raise_error(Puppet::ParseError))
12 | end
13 |
14 | it "should strip a string" do
15 | result = scope.function_strip([" ab cd "])
16 | result.should(eq('ab cd'))
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/vagrant/puppet/app/webserver/apache2.pp:
--------------------------------------------------------------------------------
1 | class app::webserver::apache2 {
2 | class { "apache": }
3 | class { "apache::mod::php": }
4 |
5 | package { "nginx":
6 | ensure => purged,
7 | }
8 |
9 | file {"/etc/apache2/sites-enabled/000-default":
10 | ensure => absent,
11 | notify => Service["httpd"],
12 | }
13 |
14 | file {"/etc/apache2/sites-enabled/$vhost":
15 | ensure => present,
16 | content => template("/vagrant/files/etc/apache2/sites-available/app.dev"),
17 | require => Package["httpd"],
18 | notify => Service["httpd"],
19 | }
20 |
21 | a2mod { 'rewrite': ensure => present, }
22 | }
23 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/parsejson.rb:
--------------------------------------------------------------------------------
1 | #
2 | # parsejson.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:parsejson, :type => :rvalue, :doc => <<-EOS
7 | This function accepts JSON as a string and converts into the correct Puppet
8 | structure.
9 | EOS
10 | ) do |arguments|
11 |
12 | if (arguments.size != 1) then
13 | raise(Puppet::ParseError, "parsejson(): Wrong number of arguments "+
14 | "given #{arguments.size} for 1")
15 | end
16 |
17 | json = arguments[0]
18 |
19 | # PSON is natively available in puppet
20 | PSON.load(json)
21 | end
22 | end
23 |
24 | # vim: set ts=2 sw=2 et :
25 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/chop_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the chop function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("chop").should == "function_chop"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_chop([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should chop the end of a string" do
16 | result = scope.function_chop(["asdf\n"])
17 | result.should(eq("asdf"))
18 | end
19 | end
20 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/chomp_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the chomp function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("chomp").should == "function_chomp"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_chomp([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should chomp the end of a string" do
16 | result = scope.function_chomp(["abc\n"])
17 | result.should(eq("abc"))
18 | end
19 | end
20 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/lstrip_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the lstrip function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("lstrip").should == "function_lstrip"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_lstrip([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should lstrip a string" do
16 | result = scope.function_lstrip([" asdf"])
17 | result.should(eq('asdf'))
18 | end
19 | end
20 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/keys.rb:
--------------------------------------------------------------------------------
1 | #
2 | # keys.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:keys, :type => :rvalue, :doc => <<-EOS
7 | Returns the keys of a hash as an array.
8 | EOS
9 | ) do |arguments|
10 |
11 | raise(Puppet::ParseError, "keys(): Wrong number of arguments " +
12 | "given (#{arguments.size} for 1)") if arguments.size < 1
13 |
14 | hash = arguments[0]
15 |
16 | unless hash.is_a?(Hash)
17 | raise(Puppet::ParseError, 'keys(): Requires hash to work with')
18 | end
19 |
20 | result = hash.keys
21 |
22 | return result
23 | end
24 | end
25 |
26 | # vim: set ts=2 sw=2 et :
27 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/sort.rb:
--------------------------------------------------------------------------------
1 | #
2 | # sort.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:sort, :type => :rvalue, :doc => <<-EOS
7 | Sorts strings and arrays lexically.
8 | EOS
9 | ) do |arguments|
10 |
11 | if (arguments.size != 1) then
12 | raise(Puppet::ParseError, "sort(): Wrong number of arguments "+
13 | "given #{arguments.size} for 1")
14 | end
15 |
16 | value = arguments[0]
17 |
18 | if value.is_a?(Array) then
19 | value.sort
20 | elsif value.is_a?(String) then
21 | value.split("").sort.join("")
22 | end
23 |
24 | end
25 | end
26 |
27 | # vim: set ts=2 sw=2 et :
28 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/manifests/server/monitor.pp:
--------------------------------------------------------------------------------
1 | class mysql::server::monitor (
2 | $mysql_monitor_username,
3 | $mysql_monitor_password,
4 | $mysql_monitor_hostname
5 | ) {
6 |
7 | Class['mysql::server'] -> Class['mysql::server::monitor']
8 |
9 | database_user{ "${mysql_monitor_username}@${mysql_monitor_hostname}":
10 | ensure => present,
11 | password_hash => mysql_password($mysql_monitor_password),
12 | }
13 |
14 | database_grant { "${mysql_monitor_username}@${mysql_monitor_hostname}":
15 | privileges => [ 'process_priv', 'super_priv' ],
16 | require => Mysql_user["${mysql_monitor_username}@${mysql_monitor_hostname}"],
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/join_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the join function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("join").should == "function_join"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_join([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should join an array into a string" do
16 | result = scope.function_join([["a","b","c"], ":"])
17 | result.should(eq("a:b:c"))
18 | end
19 | end
20 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/is_float.rb:
--------------------------------------------------------------------------------
1 | #
2 | # is_float.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:is_float, :type => :rvalue, :doc => <<-EOS
7 | Returns true if the variable passed to this function is a float.
8 | EOS
9 | ) do |arguments|
10 |
11 | if (arguments.size != 1) then
12 | raise(Puppet::ParseError, "is_float(): Wrong number of arguments "+
13 | "given #{arguments.size} for 1")
14 | end
15 |
16 | value = arguments[0]
17 |
18 | if value != value.to_f.to_s then
19 | return false
20 | else
21 | return true
22 | end
23 |
24 | end
25 | end
26 |
27 | # vim: set ts=2 sw=2 et :
28 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/reverse_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the reverse function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("reverse").should == "function_reverse"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_reverse([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should reverse a string" do
16 | result = scope.function_reverse(["asdfghijkl"])
17 | result.should(eq('lkjihgfdsa'))
18 | end
19 | end
20 |
--------------------------------------------------------------------------------
/app/config/routing_dev.yml:
--------------------------------------------------------------------------------
1 |
2 | my_barcode_playground:
3 | resource: "@MopaBarcodeBundle/Resources/config/routing/barcode_playground.yml"
4 | prefix: /
5 |
6 | _wdt:
7 | resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml"
8 | prefix: /_wdt
9 |
10 | _profiler:
11 | resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml"
12 | prefix: /_profiler
13 |
14 | _configurator:
15 | resource: "@SensioDistributionBundle/Resources/config/routing/webconfigurator.xml"
16 | prefix: /_configurator
17 |
18 | _main:
19 | resource: routing.yml
20 |
21 | MopaBootstrapSandbox:
22 | resource: "@MopaBootstrapSandboxBundle/Resources/config/routing.yml"
23 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (C) 2012 Puppet Labs Inc
2 |
3 | Puppet Labs can be contacted at: info@puppetlabs.com
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/swapcase_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the swapcase function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("swapcase").should == "function_swapcase"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_swapcase([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should swapcase a string" do
16 | result = scope.function_swapcase(["aaBBccDD"])
17 | result.should(eq('AAbbCCdd'))
18 | end
19 | end
20 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/facter/root_home.rb:
--------------------------------------------------------------------------------
1 | # A facter fact to determine the root home directory.
2 | # This varies on PE supported platforms and may be
3 | # reconfigured by the end user.
4 |
5 | module Facter::Util::RootHome
6 | class << self
7 | def get_root_home
8 | root_ent = Facter::Util::Resolution.exec("getent passwd root")
9 | # The home directory is the sixth element in the passwd entry
10 | # If the platform doesn't have getent, root_ent will be nil and we should
11 | # return it straight away.
12 | root_ent && root_ent.split(":")[5]
13 | end
14 | end
15 | end
16 |
17 | Facter.add(:root_home) do
18 | setcode { Facter::Util::RootHome.get_root_home }
19 | end
20 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/is_integer.rb:
--------------------------------------------------------------------------------
1 | #
2 | # is_integer.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:is_integer, :type => :rvalue, :doc => <<-EOS
7 | Returns true if the variable returned to this string is an integer.
8 | EOS
9 | ) do |arguments|
10 |
11 | if (arguments.size != 1) then
12 | raise(Puppet::ParseError, "is_integer(): Wrong number of arguments "+
13 | "given #{arguments.size} for 1")
14 | end
15 |
16 | value = arguments[0]
17 |
18 | if value != value.to_i.to_s then
19 | return false
20 | else
21 | return true
22 | end
23 |
24 | end
25 | end
26 |
27 | # vim: set ts=2 sw=2 et :
28 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/hash_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the hash function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("hash").should == "function_hash"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_hash([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should convert an array to a hash" do
16 | result = scope.function_hash([['a',1,'b',2,'c',3]])
17 | result.should(eq({'a'=>1,'b'=>2,'c'=>3}))
18 | end
19 | end
20 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/prefix_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the prefix function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("prefix").should == "function_prefix"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_prefix([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should return a prefixed array" do
16 | result = scope.function_prefix([['a','b','c'], 'p'])
17 | result.should(eq(['pa','pb','pc']))
18 | end
19 | end
20 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/spec/classes/dev_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'apache::dev', :type => :class do
4 | context "On a Debian OS" do
5 | let :facts do
6 | { :osfamily => 'Debian' }
7 | end
8 | it {
9 | should include_class("apache::params")
10 | should contain_package("libaprutil1-dev")
11 | should contain_package("libapr1-dev")
12 | should contain_package("apache2-prefork-dev")
13 | }
14 | end
15 | context "On a RedHat OS" do
16 | let :facts do
17 | { :osfamily => 'RedHat' }
18 | end
19 | it {
20 | should include_class("apache::params")
21 | should contain_package("httpd-devel")
22 | }
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/capitalize_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the capitalize function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("capitalize").should == "function_capitalize"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_capitalize([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should capitalize the beginning of a string" do
16 | result = scope.function_capitalize(["abc"])
17 | result.should(eq("Abc"))
18 | end
19 | end
20 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/grep_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the grep function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("grep").should == "function_grep"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_grep([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should grep contents from an array" do
16 | result = scope.function_grep([["aaabbb","bbbccc","dddeee"], "bbb"])
17 | result.should(eq(["aaabbb","bbbccc"]))
18 | end
19 | end
20 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/is_numeric.rb:
--------------------------------------------------------------------------------
1 | #
2 | # is_numeric.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:is_numeric, :type => :rvalue, :doc => <<-EOS
7 | Returns true if the variable passed to this function is a number.
8 | EOS
9 | ) do |arguments|
10 |
11 | if (arguments.size != 1) then
12 | raise(Puppet::ParseError, "is_numeric(): Wrong number of arguments "+
13 | "given #{arguments.size} for 1")
14 | end
15 |
16 | value = arguments[0]
17 |
18 | if value == value.to_f.to_s or value == value.to_i.to_s then
19 | return true
20 | else
21 | return false
22 | end
23 |
24 | end
25 | end
26 |
27 | # vim: set ts=2 sw=2 et :
28 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/is_string.rb:
--------------------------------------------------------------------------------
1 | #
2 | # is_string.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:is_string, :type => :rvalue, :doc => <<-EOS
7 | Returns true if the variable passed to this function is a string.
8 | EOS
9 | ) do |arguments|
10 |
11 | raise(Puppet::ParseError, "is_string(): Wrong number of arguments " +
12 | "given (#{arguments.size} for 1)") if arguments.size < 1
13 |
14 | type = arguments[0]
15 |
16 | result = type.is_a?(String)
17 |
18 | if result and (type == type.to_f.to_s or type == type.to_i.to_s) then
19 | return false
20 | end
21 |
22 | return result
23 | end
24 | end
25 |
26 | # vim: set ts=2 sw=2 et :
27 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/delete_at_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the delete_at function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("delete_at").should == "function_delete_at"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_delete_at([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should delete an item at specified location from an array" do
16 | result = scope.function_delete_at([['a','b','c'],1])
17 | result.should(eq(['a','c']))
18 | end
19 | end
20 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/get_module_path.rb:
--------------------------------------------------------------------------------
1 | module Puppet::Parser::Functions
2 | newfunction(:get_module_path, :type =>:rvalue, :doc => <<-EOT
3 | Returns the absolute path of the specified module for the current
4 | environment.
5 |
6 | Example:
7 | $module_path = get_module_path('stdlib')
8 | EOT
9 | ) do |args|
10 | raise(Puppet::ParseError, "get_module_path(): Wrong number of arguments, expects one") unless args.size == 1
11 | if module_path = Puppet::Module.find(args[0], compiler.environment.to_s)
12 | module_path.path
13 | else
14 | raise(Puppet::ParseError, "Could not find module #{args[0]} in environment #{compiler.environment}")
15 | end
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/manifests/ruby.pp:
--------------------------------------------------------------------------------
1 | # Class: mysql::ruby
2 | #
3 | # installs the ruby bindings for mysql
4 | #
5 | # Parameters:
6 | # [*ensure*] - ensure state for package.
7 | # can be specified as version.
8 | # [*package_name*] - name of package
9 | #
10 | # Actions:
11 | #
12 | # Requires:
13 | #
14 | # Sample Usage:
15 | #
16 | class mysql::ruby (
17 | $package_name = $mysql::params::ruby_package_name,
18 | $package_provider = $mysql::params::ruby_package_provider,
19 | $package_ensure = 'present'
20 | ) inherits mysql::params {
21 |
22 | package{ 'ruby_mysql':
23 | ensure => $package_ensure,
24 | name => $package_name,
25 | provider => $package_provider,
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/templates/mod/proxy.conf.erb:
--------------------------------------------------------------------------------
1 | #
2 | # Proxy Server directives. Uncomment the following lines to
3 | # enable the proxy server:
4 | #
5 |
6 | # Do not enable proxying with ProxyRequests until you have secured your
7 | # server. Open proxy servers are dangerous both to your network and to the
8 | # Internet at large.
9 | ProxyRequests <%= proxy_requests %>
10 |
11 |
12 | Order deny,allow
13 | Deny from all
14 | #Allow from .example.com
15 |
16 |
17 | # Enable/disable the handling of HTTP/1.1 "Via:" headers.
18 | # ("Full" adds the server version; "Block" removes all outgoing Via: headers)
19 | # Set to one of: Off | On | Full | Block
20 | ProxyVia On
21 |
22 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/manifests/server/account_security.pp:
--------------------------------------------------------------------------------
1 | class mysql::server::account_security {
2 | # Some installations have some default users which are not required.
3 | # We remove them here. You can subclass this class to overwrite this behavior.
4 | database_user { [ "root@${::fqdn}", 'root@127.0.0.1', 'root@::1',
5 | "@${::fqdn}", '@localhost', '@%' ]:
6 | ensure => 'absent',
7 | require => Class['mysql::config'],
8 | }
9 | if ($::fqdn != $::hostname) {
10 | database_user { ["root@${::hostname}", "@${::hostname}"]:
11 | ensure => 'absent',
12 | require => Class['mysql::config'],
13 | }
14 | }
15 | database { 'test':
16 | ensure => 'absent',
17 | require => Class['mysql::config'],
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (C) 2011 Puppet Labs Inc
2 |
3 | and some parts:
4 |
5 | Copyright (C) 2011 Krzysztof Wilczynski
6 |
7 | Puppet Labs can be contacted at: info@puppetlabs.com
8 |
9 | Licensed under the Apache License, Version 2.0 (the "License");
10 | you may not use this file except in compliance with the License.
11 | You may obtain a copy of the License at
12 |
13 | http://www.apache.org/licenses/LICENSE-2.0
14 |
15 | Unless required by applicable law or agreed to in writing, software
16 | distributed under the License is distributed on an "AS IS" BASIS,
17 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | See the License for the specific language governing permissions and
19 | limitations under the License.
20 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/parsejson_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the parsejson function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("parsejson").should == "function_parsejson"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_parsejson([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should convert JSON to a data structure" do
16 | json = <<-EOS
17 | ["aaa","bbb","ccc"]
18 | EOS
19 | result = scope.function_parsejson([json])
20 | result.should(eq(['aaa','bbb','ccc']))
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/empty.rb:
--------------------------------------------------------------------------------
1 | #
2 | # empty.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:empty, :type => :rvalue, :doc => <<-EOS
7 | Returns true if the variable is empty.
8 | EOS
9 | ) do |arguments|
10 |
11 | raise(Puppet::ParseError, "empty(): Wrong number of arguments " +
12 | "given (#{arguments.size} for 1)") if arguments.size < 1
13 |
14 | value = arguments[0]
15 | klass = value.class
16 |
17 | unless [Array, Hash, String].include?(klass)
18 | raise(Puppet::ParseError, 'empty(): Requires either ' +
19 | 'array, hash or string to work with')
20 | end
21 |
22 | result = value.empty?
23 |
24 | return result
25 | end
26 | end
27 |
28 | # vim: set ts=2 sw=2 et :
29 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/reverse.rb:
--------------------------------------------------------------------------------
1 | #
2 | # reverse.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:reverse, :type => :rvalue, :doc => <<-EOS
7 | Reverses the order of a string or array.
8 | EOS
9 | ) do |arguments|
10 |
11 | raise(Puppet::ParseError, "reverse(): Wrong number of arguments " +
12 | "given (#{arguments.size} for 1)") if arguments.size < 1
13 |
14 | value = arguments[0]
15 | klass = value.class
16 |
17 | unless [Array, String].include?(klass)
18 | raise(Puppet::ParseError, 'reverse(): Requires either ' +
19 | 'array or string to work with')
20 | end
21 |
22 | result = value.reverse
23 |
24 | return result
25 | end
26 | end
27 |
28 | # vim: set ts=2 sw=2 et :
29 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/parseyaml_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the parseyaml function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("parseyaml").should == "function_parseyaml"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_parseyaml([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should convert YAML to a data structure" do
16 | yaml = <<-EOS
17 | - aaa
18 | - bbb
19 | - ccc
20 | EOS
21 | result = scope.function_parseyaml([yaml])
22 | result.should(eq(['aaa','bbb','ccc']))
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/spec/classes/php_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'apache::php', :type => :class do
4 | context "On a Debian OS" do
5 | let :facts do
6 | { :osfamily => 'Debian' }
7 | end
8 | it { should include_class("apache::params") }
9 | it { should contain_apache__mod("php5") }
10 | it { should contain_package("libapache2-mod-php5") }
11 | end
12 |
13 | context "On a RedHat OS" do
14 | let :facts do
15 | { :osfamily => 'RedHat' }
16 | end
17 | it { should include_class("apache::params") }
18 | it { should contain_apache__mod("php5") }
19 | it { should contain_package("php") }
20 | end
21 |
22 | context "On undefined OS" do
23 | it { expect { should raise_error(Puppet::Error) } }
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/files/httpd:
--------------------------------------------------------------------------------
1 | # Configuration file for the httpd service.
2 |
3 | #
4 | # The default processing model (MPM) is the process-based
5 | # 'prefork' model. A thread-based model, 'worker', is also
6 | # available, but does not work with some modules (such as PHP).
7 | # The service must be stopped before changing this variable.
8 | #
9 | #HTTPD=/usr/sbin/httpd.worker
10 |
11 | #
12 | # To pass additional options (for instance, -D definitions) to the
13 | # httpd binary at startup, set OPTIONS here.
14 | #
15 | #OPTIONS=
16 | #OPTIONS=-DDOWN
17 |
18 | #
19 | # By default, the httpd process is started in the C locale; to
20 | # change the locale in which the server runs, the HTTPD_LANG
21 | # variable can be set.
22 | #
23 | #HTTPD_LANG=C
24 | export SHORTHOST=`hostname -s`
25 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/facter/util/puppet_settings.rb:
--------------------------------------------------------------------------------
1 | module Facter
2 | module Util
3 | module PuppetSettings
4 | # This method is intended to provide a convenient way to evaluate a
5 | # Facter code block only if Puppet is loaded. This is to account for the
6 | # situation where the fact happens to be in the load path, but Puppet is
7 | # not loaded for whatever reason. Perhaps the user is simply running
8 | # facter without the --puppet flag and they happen to be working in a lib
9 | # directory of a module.
10 | def self.with_puppet
11 | begin
12 | Module.const_get("Puppet")
13 | rescue NameError
14 | nil
15 | else
16 | yield
17 | end
18 | end
19 | end
20 | end
21 | end
22 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/sort_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the sort function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("sort").should == "function_sort"
9 | end
10 |
11 | it "should raise a ParseError if there is not 1 arguments" do
12 | lambda { scope.function_sort(['','']) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should sort an array" do
16 | result = scope.function_sort([["a","c","b"]])
17 | result.should(eq(['a','b','c']))
18 | end
19 |
20 | it "should sort a string" do
21 | result = scope.function_sort(["acb"])
22 | result.should(eq('abc'))
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/tests/has_interface_with.pp:
--------------------------------------------------------------------------------
1 | include stdlib
2 | info("has_interface_with('lo'):", has_interface_with('lo'))
3 | info("has_interface_with('loX'):", has_interface_with('loX'))
4 | info("has_interface_with('ipaddress', '127.0.0.1'):", has_interface_with('ipaddress', '127.0.0.1'))
5 | info("has_interface_with('ipaddress', '127.0.0.100'):", has_interface_with('ipaddress', '127.0.0.100'))
6 | info("has_interface_with('network', '127.0.0.0'):", has_interface_with('network', '127.0.0.0'))
7 | info("has_interface_with('network', '128.0.0.0'):", has_interface_with('network', '128.0.0.0'))
8 | info("has_interface_with('netmask', '255.0.0.0'):", has_interface_with('netmask', '255.0.0.0'))
9 | info("has_interface_with('netmask', '256.0.0.0'):", has_interface_with('netmask', '256.0.0.0'))
10 |
11 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/grep.rb:
--------------------------------------------------------------------------------
1 | #
2 | # grep.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:grep, :type => :rvalue, :doc => <<-EOS
7 | This function searches through an array and returns any elements that match
8 | the provided regular expression.
9 |
10 | *Examples:*
11 |
12 | grep(['aaa','bbb','ccc','aaaddd'], 'aaa')
13 |
14 | Would return:
15 |
16 | ['aaa','aaaddd']
17 | EOS
18 | ) do |arguments|
19 |
20 | if (arguments.size != 2) then
21 | raise(Puppet::ParseError, "grep(): Wrong number of arguments "+
22 | "given #{arguments.size} for 2")
23 | end
24 |
25 | a = arguments[0]
26 | pattern = Regexp.new(arguments[1])
27 |
28 | a.grep(pattern)
29 |
30 | end
31 | end
32 |
33 | # vim: set ts=2 sw=2 et :
34 |
--------------------------------------------------------------------------------
/vagrant/files/etc/apache2/sites-available/app.dev:
--------------------------------------------------------------------------------
1 |
2 | ServerAdmin developer@<%= @vhost %>.dev
3 |
4 | ServerName <%= @vhost %>.dev
5 | DocumentRoot /srv/www/vhosts/<%= @vhost %>.dev/web
6 | .dev>
7 | Options FollowSymLinks
8 | AllowOverride None
9 |
10 | .dev/web>
11 | Options Indexes FollowSymLinks MultiViews
12 | AllowOverride All
13 | Order allow,deny
14 | allow from all
15 |
16 |
17 | ErrorLog /srv/www/vhosts/<%= @vhost %>.dev/app/logs/error.log
18 |
19 | # Possible values include: debug, info, notice, warn, error, crit,
20 | # alert, emerg.
21 | LogLevel notice
22 |
23 | CustomLog /srv/www/vhosts/<%= @vhost %>.dev/app/logs/access.log combined
24 |
25 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/lib/puppet/type/a2mod.rb:
--------------------------------------------------------------------------------
1 | Puppet::Type.newtype(:a2mod) do
2 | @doc = "Manage Apache 2 modules"
3 |
4 | ensurable
5 |
6 | newparam(:name) do
7 | desc "The name of the module to be managed"
8 |
9 | isnamevar
10 |
11 | end
12 |
13 | newparam(:lib) do
14 | desc "The name of the .so library to be loaded"
15 |
16 | defaultto { "mod_#{@resource[:name]}.so" }
17 | end
18 |
19 | newparam(:identifier) do
20 | desc "Module identifier string used by LoadModule. Default: module-name_module"
21 |
22 | # http://httpd.apache.org/docs/2.2/mod/module-dict.html#ModuleIdentifier
23 |
24 | defaultto { "#{resource[:name]}_module" }
25 | end
26 |
27 | autorequire(:package) { catalog.resource(:package, 'httpd')}
28 |
29 | end
30 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/is_mac_address.rb:
--------------------------------------------------------------------------------
1 | #
2 | # is_mac_address.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:is_mac_address, :type => :rvalue, :doc => <<-EOS
7 | Returns true if the string passed to this function is a valid mac address.
8 | EOS
9 | ) do |arguments|
10 |
11 | if (arguments.size != 1) then
12 | raise(Puppet::ParseError, "is_mac_address(): Wrong number of arguments "+
13 | "given #{arguments.size} for 1")
14 | end
15 |
16 | mac = arguments[0]
17 |
18 | if /^[a-fA-F0-9]{1,2}:[a-fA-F0-9]{1,2}:[a-fA-F0-9]{1,2}:[a-fA-F0-9]{1,2}:[a-fA-F0-9]{1,2}:[a-fA-F0-9]{1,2}$/.match(mac) then
19 | return true
20 | else
21 | return false
22 | end
23 |
24 | end
25 | end
26 |
27 | # vim: set ts=2 sw=2 et :
28 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/bool2num_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the bool2num function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("bool2num").should == "function_bool2num"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_bool2num([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should convert true to 1" do
16 | result = scope.function_bool2num([true])
17 | result.should(eq(1))
18 | end
19 |
20 | it "should convert false to 0" do
21 | result = scope.function_bool2num([false])
22 | result.should(eq(0))
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/num2bool_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the num2bool function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("num2bool").should == "function_num2bool"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_num2bool([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should return true if 1" do
16 | result = scope.function_num2bool(["1"])
17 | result.should(be_true)
18 | end
19 |
20 | it "should return false if 0" do
21 | result = scope.function_num2bool(["0"])
22 | result.should(be_false)
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/keys_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the keys function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("keys").should == "function_keys"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_keys([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should return an array of keys when given a hash" do
16 | result = scope.function_keys([{'a'=>1, 'b'=>2}])
17 | # =~ performs 'array with same elements' (set) matching
18 | # For more info see RSpec::Matchers::MatchArray
19 | result.should =~ ['a','b']
20 | end
21 | end
22 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/size_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the size function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("size").should == "function_size"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_size([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should return the size of a string" do
16 | result = scope.function_size(["asdf"])
17 | result.should(eq(4))
18 | end
19 |
20 | it "should return the size of an array" do
21 | result = scope.function_size([["a","b","c"]])
22 | result.should(eq(3))
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/getvar.rb:
--------------------------------------------------------------------------------
1 | module Puppet::Parser::Functions
2 |
3 | newfunction(:getvar, :type => :rvalue, :doc => <<-'ENDHEREDOC') do |args|
4 | Lookup a variable in a remote namespace.
5 |
6 | For example:
7 |
8 | $foo = getvar('site::data::foo')
9 | # Equivalent to $foo = $site::data::foo
10 |
11 | This is useful if the namespace itself is stored in a string:
12 |
13 | $datalocation = 'site::data'
14 | $bar = getvar("${datalocation}::bar")
15 | # Equivalent to $bar = $site::data::bar
16 | ENDHEREDOC
17 |
18 | unless args.length == 1
19 | raise Puppet::ParseError, ("getvar(): wrong number of arguments (#{args.length}; must be 1)")
20 | end
21 |
22 | self.lookupvar("#{args[0]}")
23 |
24 | end
25 |
26 | end
27 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/spec/classes/mod/python_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'apache::mod::python', :type => :class do
4 | context "On a Debian OS" do
5 | let :facts do
6 | { :osfamily => 'Debian' }
7 | end
8 | it { should include_class("apache::params") }
9 | it { should contain_package("libapache2-mod-python").with(
10 | 'ensure' => 'present',
11 | 'require' => 'Package[httpd]'
12 | ) }
13 | it { should contain_a2mod("python") }
14 | end
15 | context "On a RedHat OS" do
16 | let :facts do
17 | { :osfamily => 'RedHat' }
18 | end
19 | it { should include_class("apache::params") }
20 | it { should contain_package("mod_python") }
21 | it { should contain_a2mod("python").with(
22 | 'ensure' => 'present'
23 | ) }
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/empty_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the empty function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 | it "should exist" do
7 | Puppet::Parser::Functions.function("empty").should == "function_empty"
8 | end
9 |
10 | it "should raise a ParseError if there is less than 1 arguments" do
11 | lambda { scope.function_empty([]) }.should( raise_error(Puppet::ParseError))
12 | end
13 |
14 | it "should return a true for an empty string" do
15 | result = scope.function_empty([''])
16 | result.should(eq(true))
17 | end
18 |
19 | it "should return a false for a non-empty string" do
20 | result = scope.function_empty(['asdf'])
21 | result.should(eq(false))
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/upcase_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the upcase function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("upcase").should == "function_upcase"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_upcase([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should upcase a string" do
16 | result = scope.function_upcase(["abc"])
17 | result.should(eq('ABC'))
18 | end
19 |
20 | it "should do nothing if a string is already upcase" do
21 | result = scope.function_upcase(["ABC"])
22 | result.should(eq('ABC'))
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/is_ip_address.rb:
--------------------------------------------------------------------------------
1 | #
2 | # is_ip_address.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:is_ip_address, :type => :rvalue, :doc => <<-EOS
7 | Returns true if the string passed to this function is a valid IP address.
8 | EOS
9 | ) do |arguments|
10 |
11 | require 'ipaddr'
12 |
13 | if (arguments.size != 1) then
14 | raise(Puppet::ParseError, "is_ip_address(): Wrong number of arguments "+
15 | "given #{arguments.size} for 1")
16 | end
17 |
18 | begin
19 | ip = IPAddr.new(arguments[0])
20 | rescue ArgumentError
21 | return false
22 | end
23 |
24 | if ip.ipv4? or ip.ipv6? then
25 | return true
26 | else
27 | return false
28 | end
29 | end
30 | end
31 |
32 | # vim: set ts=2 sw=2 et :
33 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/abs_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 |
3 | require 'spec_helper'
4 |
5 | describe "the abs function" do
6 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
7 |
8 | it "should exist" do
9 | Puppet::Parser::Functions.function("abs").should == "function_abs"
10 | end
11 |
12 | it "should raise a ParseError if there is less than 1 arguments" do
13 | lambda { scope.function_abs([]) }.should( raise_error(Puppet::ParseError))
14 | end
15 |
16 | it "should convert a negative number into a positive" do
17 | result = scope.function_abs(["-34"])
18 | result.should(eq(34))
19 | end
20 |
21 | it "should do nothing with a positive number" do
22 | result = scope.function_abs(["5678"])
23 | result.should(eq(5678))
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/rstrip_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the rstrip function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("rstrip").should == "function_rstrip"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_rstrip([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should rstrip a string" do
16 | result = scope.function_rstrip(["asdf "])
17 | result.should(eq('asdf'))
18 | end
19 |
20 | it "should rstrip each element in an array" do
21 | result = scope.function_rstrip([["a ","b ", "c "]])
22 | result.should(eq(['a','b','c']))
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/str2bool_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the str2bool function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("str2bool").should == "function_str2bool"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_str2bool([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should convert string 'true' to true" do
16 | result = scope.function_str2bool(["true"])
17 | result.should(eq(true))
18 | end
19 |
20 | it "should convert string 'undef' to false" do
21 | result = scope.function_str2bool(["undef"])
22 | result.should(eq(false))
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/web/app.php:
--------------------------------------------------------------------------------
1 | register(true);
14 | */
15 |
16 | require_once __DIR__.'/../app/AppKernel.php';
17 | //require_once __DIR__.'/../app/AppCache.php';
18 |
19 | $kernel = new AppKernel('prod', false);
20 | $kernel->loadClassCache();
21 | //$kernel = new AppCache($kernel);
22 | $request = Request::createFromGlobals();
23 | $response = $kernel->handle($request);
24 | $response->send();
25 | $kernel->terminate($request, $response);
26 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/flatten.rb:
--------------------------------------------------------------------------------
1 | #
2 | # flatten.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:flatten, :type => :rvalue, :doc => <<-EOS
7 | This function flattens any deeply nested arrays and returns a single flat array
8 | as a result.
9 |
10 | *Examples:*
11 |
12 | flatten(['a', ['b', ['c']]])
13 |
14 | Would return: ['a','b','c']
15 | EOS
16 | ) do |arguments|
17 |
18 | raise(Puppet::ParseError, "flatten(): Wrong number of arguments " +
19 | "given (#{arguments.size} for 1)") if arguments.size < 1
20 |
21 | array = arguments[0]
22 |
23 | unless array.is_a?(Array)
24 | raise(Puppet::ParseError, 'flatten(): Requires array to work with')
25 | end
26 |
27 | result = array.flatten
28 |
29 | return result
30 | end
31 | end
32 |
33 | # vim: set ts=2 sw=2 et :
34 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/squeeze_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the squeeze function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("squeeze").should == "function_squeeze"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 2 arguments" do
12 | lambda { scope.function_squeeze([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should squeeze a string" do
16 | result = scope.function_squeeze(["aaabbbbcccc"])
17 | result.should(eq('abc'))
18 | end
19 |
20 | it "should squeeze all elements in an array" do
21 | result = scope.function_squeeze([["aaabbbbcccc","dddfff"]])
22 | result.should(eq(['abc','df']))
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "vagrant/puppet/modules/java"]
2 | path = vagrant/puppet/modules/java
3 | url = git@github.com:puppetlabs/puppetlabs-java.git
4 | [submodule "vagrant/puppet/modules/apt"]
5 | path = vagrant/puppet/modules/apt
6 | url = git@github.com:puppetlabs/puppetlabs-apt.git
7 | [submodule "vagrant/puppet/modules/nodejs"]
8 | path = vagrant/puppet/modules/nodejs
9 | url = git@github.com:puppetlabs/puppetlabs-nodejs.git
10 | [submodule "vagrant/puppet/modules/augeas"]
11 | path = vagrant/puppet/modules/augeas
12 | url = git://github.com/camptocamp/puppet-augeas.git
13 | [submodule "vagrant/puppet/modules/composer"]
14 | path = vagrant/puppet/modules/composer
15 | url = git://github.com/tPl0ch/puppet-composer.git
16 | [submodule "vagrant/puppet/modules/git"]
17 | path = vagrant/puppet/modules/git
18 | url = https://github.com/puppetlabs/puppetlabs-git.git
19 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/downcase_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the downcase function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("downcase").should == "function_downcase"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_downcase([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should downcase a string" do
16 | result = scope.function_downcase(["ASFD"])
17 | result.should(eq("asfd"))
18 | end
19 |
20 | it "should do nothing to a string that is already downcase" do
21 | result = scope.function_downcase(["asdf asdf"])
22 | result.should(eq("asdf asdf"))
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/unique_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the unique function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("unique").should == "function_unique"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_unique([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should remove duplicate elements in a string" do
16 | result = scope.function_unique(["aabbc"])
17 | result.should(eq('abc'))
18 | end
19 |
20 | it "should remove duplicate elements in an array" do
21 | result = scope.function_unique([["a","a","b","b","c"]])
22 | result.should(eq(['a','b','c']))
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/vagrant/puppet/app/php/fpm.pp:
--------------------------------------------------------------------------------
1 | class app::php::fpm {
2 | package { "php5-fpm":
3 | ensure => present,
4 | notify => Service[$webserver],
5 | }
6 |
7 | file {"/etc/php5/fpm/pool.d":
8 | ensure => directory,
9 | owner => root,
10 | group => root,
11 | require => [Package["php5-fpm"]],
12 | }
13 |
14 | file {"/etc/php5/fpm/pool.d/$vhost.conf":
15 | ensure => present,
16 | owner => root,
17 | group => root,
18 | content => template("/vagrant/files/etc/php5/fpm/pool.d/app.conf"),
19 | require => [File["/etc/php5/fpm/pool.d"]],
20 | notify => Service["php5-fpm", "nginx"],
21 | }
22 |
23 | service {"php5-fpm":
24 | ensure => running,
25 | hasrestart => true,
26 | hasstatus => true,
27 | require => [Package[php5-fpm]],
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/app/console:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env php
2 | getParameterOption(array('--env', '-e'), getenv('SYMFONY_ENV') ?: 'dev');
18 | $debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(array('--no-debug', '')) && $env !== 'prod';
19 |
20 | $kernel = new AppKernel($env, $debug);
21 | $application = new Application($kernel);
22 | $application->run($input);
23 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/templates/mysqlbackup.sh.erb:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 | # MySQL Backup Script
4 | # Dumps mysql databases to a file for another backup tool to pick up.
5 | #
6 | # MySQL code:
7 | # GRANT SELECT, RELOAD, LOCK TABLES ON *.* TO 'user'@'localhost'
8 | # IDENTIFIED BY 'password';
9 | # FLUSH PRIVILEGES;
10 | #
11 | ##### START CONFIG ###################################################
12 |
13 | USER=<%= backupuser %>
14 | PASS=<%= backuppassword %>
15 | DIR=<%= backupdir %>
16 |
17 | ##### STOP CONFIG ####################################################
18 | PATH=/usr/bin:/usr/sbin:/bin:/sbin
19 |
20 | find $DIR -mtime +30 -exec rm -f {} \;
21 | mysqldump -u${USER} -p${PASS} --opt --flush-logs --single-transaction \
22 | --all-databases <% if backupcompress %>| bzcat -zc <% end %>> ${DIR}/mysql_backup_`date +%Y%m%d-%H%M%S`.sql<% if backupcompress %>.bz2<% end %>
23 |
24 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/member_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the member function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("member").should == "function_member"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_member([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should return true if a member is in an array" do
16 | result = scope.function_member([["a","b","c"], "a"])
17 | result.should(eq(true))
18 | end
19 |
20 | it "should return false if a member is not in an array" do
21 | result = scope.function_member([["a","b","c"], "d"])
22 | result.should(eq(false))
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/has_ip_address.rb:
--------------------------------------------------------------------------------
1 | #
2 | # has_ip_address
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:has_ip_address, :type => :rvalue, :doc => <<-EOS
7 | Returns true if the client has the requested IP address on some interface.
8 |
9 | This function iterates through the 'interfaces' fact and checks the
10 | 'ipaddress_IFACE' facts, performing a simple string comparison.
11 | EOS
12 | ) do |args|
13 |
14 | raise(Puppet::ParseError, "has_ip_address(): Wrong number of arguments " +
15 | "given (#{args.size} for 1)") if args.size != 1
16 |
17 | Puppet::Parser::Functions.autoloader.load(:has_interface_with) \
18 | unless Puppet::Parser::Functions.autoloader.loaded?(:has_interface_with)
19 |
20 | function_has_interface_with(['ipaddress', args[0]])
21 |
22 | end
23 | end
24 |
25 | # vim:sts=2 sw=2
26 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/has_ip_network.rb:
--------------------------------------------------------------------------------
1 | #
2 | # has_ip_network
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:has_ip_network, :type => :rvalue, :doc => <<-EOS
7 | Returns true if the client has an IP address within the requested network.
8 |
9 | This function iterates through the 'interfaces' fact and checks the
10 | 'network_IFACE' facts, performing a simple string comparision.
11 | EOS
12 | ) do |args|
13 |
14 | raise(Puppet::ParseError, "has_ip_network(): Wrong number of arguments " +
15 | "given (#{args.size} for 1)") if args.size != 1
16 |
17 | Puppet::Parser::Functions.autoloader.load(:has_interface_with) \
18 | unless Puppet::Parser::Functions.autoloader.loaded?(:has_interface_with)
19 |
20 | function_has_interface_with(['network', args[0]])
21 |
22 | end
23 | end
24 |
25 | # vim:sts=2 sw=2
26 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/rstrip.rb:
--------------------------------------------------------------------------------
1 | #
2 | # rstrip.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:rstrip, :type => :rvalue, :doc => <<-EOS
7 | Strips leading spaces to the right of the string.
8 | EOS
9 | ) do |arguments|
10 |
11 | raise(Puppet::ParseError, "rstrip(): Wrong number of arguments " +
12 | "given (#{arguments.size} for 1)") if arguments.size < 1
13 |
14 | value = arguments[0]
15 | klass = value.class
16 |
17 | unless [Array, String].include?(klass)
18 | raise(Puppet::ParseError, 'rstrip(): Requires either ' +
19 | 'array or string to work with')
20 | end
21 |
22 | if value.is_a?(Array)
23 | result = value.collect { |i| i.is_a?(String) ? i.rstrip : i }
24 | else
25 | result = value.rstrip
26 | end
27 |
28 | return result
29 | end
30 | end
31 |
32 | # vim: set ts=2 sw=2 et :
33 |
--------------------------------------------------------------------------------
/vagrant/puppet/app/database.pp:
--------------------------------------------------------------------------------
1 | class app::database {
2 |
3 | mysql::db { $vhost:
4 | user => $vhost,
5 | password => $vhost,
6 | }
7 |
8 | exec {"db-drop":
9 | require => [Package["php5-cli"], Class["composer"], Database["$vhost"]],
10 | command => "/bin/bash -c 'cd /srv/www/vhosts/$vhost.dev && /usr/bin/php app/console doctrine:schema:drop --force || exit 0'",
11 | }
12 |
13 | exec {"db-setup":
14 | require => Exec["db-drop"],
15 | command => "/bin/bash -c 'cd /srv/www/vhosts/$vhost.dev && /usr/bin/php app/console doctrine:schema:create'",
16 | }
17 |
18 | exec {"db-default-data":
19 | require => Exec["db-setup"],
20 | command => "/bin/bash -c 'cd /srv/www/vhosts/$vhost.dev && /usr/bin/php app/console doctrine:fixtures:load'",
21 | onlyif => "/usr/bin/test -d /srv/www/vhosts/$vhost.dev/src/*/*/DataFixtures",
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/values.rb:
--------------------------------------------------------------------------------
1 | #
2 | # values.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:values, :type => :rvalue, :doc => <<-EOS
7 | When given a hash this function will return the values of that hash.
8 |
9 | *Examples:*
10 |
11 | $hash = {
12 | 'a' => 1,
13 | 'b' => 2,
14 | 'c' => 3,
15 | }
16 | values($hash)
17 |
18 | This example would return:
19 |
20 | [1,2,3]
21 | EOS
22 | ) do |arguments|
23 |
24 | raise(Puppet::ParseError, "values(): Wrong number of arguments " +
25 | "given (#{arguments.size} for 1)") if arguments.size < 1
26 |
27 | hash = arguments[0]
28 |
29 | unless hash.is_a?(Hash)
30 | raise(Puppet::ParseError, 'values(): Requires hash to work with')
31 | end
32 |
33 | result = hash.values
34 |
35 | return result
36 | end
37 | end
38 |
39 | # vim: set ts=2 sw=2 et :
40 |
--------------------------------------------------------------------------------
/vagrant/files/etc/nginx/vhosts.d/app.dev.conf:
--------------------------------------------------------------------------------
1 | server {
2 | listen 80;
3 | server_name <%= @vhost %>.dev;
4 | root /srv/www/vhosts/<%= @vhost %>.dev/web;
5 | index app_dev.php;
6 | access_log /srv/www/vhosts/<%= @vhost %>.dev/app/logs/access.log;
7 | error_log /srv/www/vhosts/<%= @vhost %>.dev/app/logs/error.log;
8 |
9 | location /favicon.ico {
10 | return 204;
11 | break;
12 | }
13 |
14 | location / {
15 | index app.php;
16 | try_files $uri @rewriteindex;
17 | }
18 |
19 | location @rewriteindex {
20 | rewrite ^(.*)$ /app.php/$1 last;
21 | }
22 |
23 | location ~ ^/(app|app_dev)\.php(/|$) {
24 | fastcgi_pass unix:/run/shm/<%= @vhost %>.phpfpm.socket;
25 | fastcgi_split_path_info ^(.+\.php)(/.*)$;
26 | include fastcgi_params;
27 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
28 | }
29 | }
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/flatten_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the flatten function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 | it "should exist" do
7 | Puppet::Parser::Functions.function("flatten").should == "function_flatten"
8 | end
9 |
10 | it "should raise a ParseError if there is less than 1 arguments" do
11 | lambda { scope.function_flatten([]) }.should( raise_error(Puppet::ParseError))
12 | end
13 |
14 | it "should flatten a complex data structure" do
15 | result = scope.function_flatten([["a","b",["c",["d","e"],"f","g"]]])
16 | result.should(eq(["a","b","c","d","e","f","g"]))
17 | end
18 |
19 | it "should do nothing to a structure that is already flat" do
20 | result = scope.function_flatten([["a","b","c","d"]])
21 | result.should(eq(["a","b","c","d"]))
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/shuffle_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the shuffle function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("shuffle").should == "function_shuffle"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_shuffle([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should shuffle a string and the result should be the same size" do
16 | result = scope.function_shuffle(["asdf"])
17 | result.size.should(eq(4))
18 | end
19 |
20 | it "should shuffle a string but the sorted contents should still be the same" do
21 | result = scope.function_shuffle(["adfs"])
22 | result.split("").sort.join("").should(eq("adfs"))
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/uriescape_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the uriescape function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("uriescape").should == "function_uriescape"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_uriescape([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should uriescape a string" do
16 | result = scope.function_uriescape([":/?#[]@!$&'()*+,;= "])
17 | result.should(eq('%3A%2F%3F%23%5B%5D%40%21%24%26%27%28%29%2A%2B%2C%3B%3D%20'))
18 | end
19 |
20 | it "should do nothing if a string is already safe" do
21 | result = scope.function_uriescape(["ABCdef"])
22 | result.should(eq('ABCdef'))
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/manifests/server/mysqltuner.pp:
--------------------------------------------------------------------------------
1 | # Copyright 2009 Larry Ludwig (larrylud@gmail.com)
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may not
4 | # use this file except in compliance with the License. You may obtain a copy of
5 | # the License at:
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 | # License for the specific language governing permissions and limitations under
13 | # the License.
14 | #
15 | class mysql::server::mysqltuner {
16 | # mysql performance tester
17 | file { '/usr/bin/mysqltuner':
18 | ensure => present,
19 | mode => '0550',
20 | source => 'puppet:///modules/mysql/mysqltuner.pl',
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /web/bundles/
2 | /app/bootstrap.php.cache
3 | /app/cache/*
4 | /app/config/parameters.yml
5 | /app/logs/*
6 | !app/cache/.gitkeep
7 | !app/logs/.gitkeep
8 | /build/
9 | /vendor/
10 | /bin/
11 | /composer.phar
12 | /web
13 |
14 | ## generic files to ignore
15 | *~
16 | *.lock
17 | *.DS_Store
18 | *.swp
19 | *.out
20 |
21 | ## IDE files to ignore
22 | bootstrap.sublime-workspace
23 | nbproject/
24 | .idea/
25 | *.tmproj
26 | .buildpath
27 | .project
28 | .settings/
29 |
30 | # envvars
31 | bin/envvars
32 |
33 | # to have the possibility to have an own htaccess e.g. with protection (as on prod)
34 | web/.htaccess
35 |
36 | # ignore compiled files (see config.yml assetic: read_from)
37 | web/compiled/
38 |
39 | # ignore parameters so everone can have its own
40 | app/config/parameters.yml
41 |
42 | # ignore MopaRemoteUpdateBundle bin files
43 | bin/post-composer.sh
44 | bin/envvars.default
45 | app/Resources/mopa_remote_update.sqlite
46 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/templates/mod/php.conf.erb:
--------------------------------------------------------------------------------
1 | #
2 | # PHP is an HTML-embedded scripting language which attempts to make it
3 | # easy for developers to write dynamically generated webpages.
4 | #
5 | #
6 | # LoadModule php5_module modules/libphp5.so
7 | #
8 | #
9 | # # Use of the "ZTS" build with worker is experimental, and no shared
10 | # # modules are supported.
11 | # LoadModule php5_module modules/libphp5-zts.so
12 | #
13 |
14 | #
15 | # Cause the PHP interpreter to handle files with a .php extension.
16 | #
17 | AddHandler php5-script .php
18 | AddType text/html .php
19 |
20 | #
21 | # Add index.php to the list of files that will be served as directory
22 | # indexes.
23 | #
24 | DirectoryIndex index.php
25 |
26 | #
27 | # Uncomment the following line to allow PHP to pretty-print .phps
28 | # files as PHP source code:
29 | #
30 | #AddType application/x-httpd-php-source .phps
31 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/spec/classes/mod/ssl_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'apache::mod::ssl', :type => :class do
4 | describe 'when running on an unsupported OS' do
5 | let(:facts) { {:operatingsystem => 'MagicUnicorn', :osfamily => 'Magic'} }
6 | it { expect { should raise_error(Puppet::Error, "Unsupported operatingsystem:") } }
7 | end
8 |
9 | describe 'when running on redhat' do
10 | let(:facts) { {:operatingsystem => 'redhat', :osfamily => 'redhat'} }
11 | it { should include_class('apache::params') }
12 | it { should contain_package('mod_ssl') }
13 | it { should contain_a2mod('ssl') }
14 | end
15 |
16 | describe 'when running on debian' do
17 | let(:facts) { {:operatingsystem => 'debian', :osfamily => 'debian'} }
18 | it { should include_class('apache::params') }
19 | it { should_not contain_package('libapache2-mod-ssl') }
20 | it { should contain_a2mod('ssl') }
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/has_key.rb:
--------------------------------------------------------------------------------
1 | module Puppet::Parser::Functions
2 |
3 | newfunction(:has_key, :type => :rvalue, :doc => <<-'ENDHEREDOC') do |args|
4 | Determine if a hash has a certain key value.
5 |
6 | Example:
7 |
8 | $my_hash = {'key_one' => 'value_one'}
9 | if has_key($my_hash, 'key_two') {
10 | notice('we will not reach here')
11 | }
12 | if has_key($my_hash, 'key_one') {
13 | notice('this will be printed')
14 | }
15 |
16 | ENDHEREDOC
17 |
18 | unless args.length == 2
19 | raise Puppet::ParseError, ("has_key(): wrong number of arguments (#{args.length}; must be 2)")
20 | end
21 | unless args[0].is_a?(Hash)
22 | raise Puppet::ParseError, "has_key(): expects the first argument to be a hash, got #{args[0].inspect} which is of type #{args[0].class}"
23 | end
24 | args[0].has_key?(args[1])
25 |
26 | end
27 |
28 | end
29 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/time_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the time function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("time").should == "function_time"
9 | end
10 |
11 | it "should raise a ParseError if there is more than 2 arguments" do
12 | lambda { scope.function_time(['','']) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should return a number" do
16 | result = scope.function_time([])
17 | result.should be_an(Integer)
18 | end
19 |
20 | it "should be higher then when I wrote this test" do
21 | result = scope.function_time([])
22 | result.should(be > 1311953157)
23 | end
24 |
25 | it "should be lower then 1.5 trillion" do
26 | result = scope.function_time([])
27 | result.should(be < 1500000000)
28 | end
29 | end
30 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_float_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the is_float function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("is_float").should == "function_is_float"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_is_float([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should return true if a float" do
16 | result = scope.function_is_float(["0.12"])
17 | result.should(eq(true))
18 | end
19 |
20 | it "should return false if a string" do
21 | result = scope.function_is_float(["asdf"])
22 | result.should(eq(false))
23 | end
24 |
25 | it "should return false if an integer" do
26 | result = scope.function_is_float(["3"])
27 | result.should(eq(false))
28 | end
29 | end
30 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/lstrip.rb:
--------------------------------------------------------------------------------
1 | #
2 | # lstrip.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:lstrip, :type => :rvalue, :doc => <<-EOS
7 | Strips leading spaces to the left of a string.
8 | EOS
9 | ) do |arguments|
10 |
11 | raise(Puppet::ParseError, "lstrip(): Wrong number of arguments " +
12 | "given (#{arguments.size} for 1)") if arguments.size < 1
13 |
14 | value = arguments[0]
15 | klass = value.class
16 |
17 | unless [Array, String].include?(klass)
18 | raise(Puppet::ParseError, 'lstrip(): Requires either ' +
19 | 'array or string to work with')
20 | end
21 |
22 | if value.is_a?(Array)
23 | # Numbers in Puppet are often string-encoded which is troublesome ...
24 | result = value.collect { |i| i.is_a?(String) ? i.lstrip : i }
25 | else
26 | result = value.lstrip
27 | end
28 |
29 | return result
30 | end
31 | end
32 |
33 | # vim: set ts=2 sw=2 et :
34 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_integer_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the is_integer function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("is_integer").should == "function_is_integer"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_is_integer([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should return true if an integer" do
16 | result = scope.function_is_integer(["3"])
17 | result.should(eq(true))
18 | end
19 |
20 | it "should return false if a float" do
21 | result = scope.function_is_integer(["3.2"])
22 | result.should(eq(false))
23 | end
24 |
25 | it "should return false if a string" do
26 | result = scope.function_is_integer(["asdf"])
27 | result.should(eq(false))
28 | end
29 | end
30 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_numeric_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the is_numeric function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("is_numeric").should == "function_is_numeric"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 argument" do
12 | lambda { scope.function_is_numeric([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should return true if an integer" do
16 | result = scope.function_is_numeric(["3"])
17 | result.should(eq(true))
18 | end
19 |
20 | it "should return true if a float" do
21 | result = scope.function_is_numeric(["3.2"])
22 | result.should(eq(true))
23 | end
24 |
25 | it "should return false if a string" do
26 | result = scope.function_is_numeric(["asdf"])
27 | result.should(eq(false))
28 | end
29 | end
30 |
--------------------------------------------------------------------------------
/vagrant/Vagrantfile:
--------------------------------------------------------------------------------
1 | # -*- mode: ruby -*-
2 | # vi: set ft=ruby :
3 |
4 | personalization = File.expand_path("../Personalization", __FILE__)
5 | load personalization
6 |
7 | Vagrant::Config.run do |config|
8 | config.vm.box = $base_box
9 |
10 | config.vm.host_name = $vhost + ".dev"
11 |
12 | config.vm.network :hostonly, $ip
13 |
14 | config.vm.share_folder $vhost, "/srv/www/vhosts/" + $vhost + ".dev", "../", :nfs => $use_nfs
15 |
16 | config.vm.customize ["modifyvm", :id, "--memory", "512"]
17 |
18 | config.vm.provision :shell, :inline => "sudo apt-get update && sudo apt-get install puppet -y"
19 |
20 | config.vm.provision :puppet do |puppet|
21 | puppet.manifests_path = "puppet"
22 | puppet.manifest_file = "app.pp"
23 | puppet.module_path = "puppet/modules"
24 | puppet.facter = {
25 | "vhost" => $vhost,
26 | "webserver" => $webserver
27 | }
28 | end
29 | end
30 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_array_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the is_array function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("is_array").should == "function_is_array"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_is_array([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should return true if passed an array" do
16 | result = scope.function_is_array([[1,2,3]])
17 | result.should(eq(true))
18 | end
19 |
20 | it "should return false if passed a hash" do
21 | result = scope.function_is_array([{'a'=>1}])
22 | result.should(eq(false))
23 | end
24 |
25 | it "should return false if passed a string" do
26 | result = scope.function_is_array(["asdf"])
27 | result.should(eq(false))
28 | end
29 | end
30 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_hash_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the is_hash function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("is_hash").should == "function_is_hash"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_is_hash([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should return true if passed a hash" do
16 | result = scope.function_is_hash([{"a"=>1,"b"=>2}])
17 | result.should(eq(true))
18 | end
19 |
20 | it "should return false if passed an array" do
21 | result = scope.function_is_hash([["a","b"]])
22 | result.should(eq(false))
23 | end
24 |
25 | it "should return false if passed a string" do
26 | result = scope.function_is_hash(["asdf"])
27 | result.should(eq(false))
28 | end
29 | end
30 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/downcase.rb:
--------------------------------------------------------------------------------
1 | #
2 | # downcase.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:downcase, :type => :rvalue, :doc => <<-EOS
7 | Converts the case of a string or all strings in an array to lower case.
8 | EOS
9 | ) do |arguments|
10 |
11 | raise(Puppet::ParseError, "downcase(): Wrong number of arguments " +
12 | "given (#{arguments.size} for 1)") if arguments.size < 1
13 |
14 | value = arguments[0]
15 | klass = value.class
16 |
17 | unless [Array, String].include?(klass)
18 | raise(Puppet::ParseError, 'downcase(): Requires either ' +
19 | 'array or string to work with')
20 | end
21 |
22 | if value.is_a?(Array)
23 | # Numbers in Puppet are often string-encoded which is troublesome ...
24 | result = value.collect { |i| i.is_a?(String) ? i.downcase : i }
25 | else
26 | result = value.downcase
27 | end
28 |
29 | return result
30 | end
31 | end
32 |
33 | # vim: set ts=2 sw=2 et :
34 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/squeeze.rb:
--------------------------------------------------------------------------------
1 | #
2 | # squeeze.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:squeeze, :type => :rvalue, :doc => <<-EOS
7 | Returns a new string where runs of the same character that occur in this set are replaced by a single character.
8 | EOS
9 | ) do |arguments|
10 |
11 | if ((arguments.size != 2) and (arguments.size != 1)) then
12 | raise(Puppet::ParseError, "squeeze(): Wrong number of arguments "+
13 | "given #{arguments.size} for 2 or 1")
14 | end
15 |
16 | item = arguments[0]
17 | squeezeval = arguments[1]
18 |
19 | if item.is_a?(Array) then
20 | if squeezeval then
21 | item.collect { |i| i.squeeze(squeezeval) }
22 | else
23 | item.collect { |i| i.squeeze }
24 | end
25 | else
26 | if squeezeval then
27 | item.squeeze(squeezeval)
28 | else
29 | item.squeeze
30 | end
31 | end
32 |
33 | end
34 | end
35 |
36 | # vim: set ts=2 sw=2 et :
37 |
--------------------------------------------------------------------------------
/app/config/config_dev.yml:
--------------------------------------------------------------------------------
1 | imports:
2 | - { resource: config.yml }
3 | - { resource: @MopaBootstrapSandboxBundle/Resources/config/themes.yml }
4 |
5 | framework:
6 | router:
7 | resource: "%kernel.root_dir%/config/routing_dev.yml"
8 | strict_requirements: true
9 | profiler: { only_exceptions: false }
10 |
11 | web_profiler:
12 | toolbar: true
13 | intercept_redirects: false
14 |
15 | monolog:
16 | handlers:
17 | main:
18 | type: stream
19 | path: %kernel.logs_dir%/%kernel.environment%.log
20 | level: debug
21 | firephp:
22 | type: firephp
23 | level: info
24 | chromephp:
25 | type: chromephp
26 | level: info
27 |
28 | assetic:
29 | debug: %kernel.debug%
30 | use_controller: false
31 |
32 | services:
33 | twig.extension.debug:
34 | class: Twig_Extension_Debug
35 | tags: [{ name: 'twig.extension' }]
36 |
37 | #swiftmailer:
38 | # delivery_address: me@example.com
39 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/templates/vhost-default.conf.erb:
--------------------------------------------------------------------------------
1 | # ************************************
2 | # Default template in module puppetlabs-apache
3 | # Managed by Puppet
4 | # ************************************
5 |
6 | NameVirtualHost <%= vhost_name %>:<%= port %>
7 | :<%= port %>>
8 | ServerName <%= srvname %>
9 | <% if serveradmin %>
10 | ServerAdmin <%= serveradmin %>
11 | <% end %>
12 | <% if serveraliases.is_a? Array -%>
13 | <% serveraliases.each do |name| -%><%= " ServerAlias #{name}\n" %><% end -%>
14 | <% elsif serveraliases != '' -%>
15 | <%= " ServerAlias #{serveraliases}" %>
16 | <% end -%>
17 | DocumentRoot <%= docroot %>
18 | >
19 | Options <%= options %>
20 | AllowOverride <%= Array(override).join(' ') %>
21 | Order allow,deny
22 | allow from all
23 |
24 | ErrorLog <%= logroot %>/<%= name %>_error.log
25 | LogLevel warn
26 | CustomLog <%= logroot %>/<%= name %>_access.log combined
27 | ServerSignature Off
28 |
29 |
30 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/spec/unit/mysql_password_spec.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env rspec
2 | require 'spec_helper'
3 |
4 | describe "the mysql_password function" do
5 | before :all do
6 | Puppet::Parser::Functions.autoloader.loadall
7 | end
8 |
9 | before :each do
10 | @scope = Puppet::Parser::Scope.new
11 | end
12 |
13 | it "should exist" do
14 | Puppet::Parser::Functions.function("mysql_password").should == "function_mysql_password"
15 | end
16 |
17 | it "should raise a ParseError if there is less than 1 arguments" do
18 | lambda { @scope.function_mysql_password([]) }.should( raise_error(Puppet::ParseError))
19 | end
20 |
21 | it "should raise a ParseError if there is more than 1 arguments" do
22 | lambda { @scope.function_mysql_password(['foo', 'bar']) }.should( raise_error(Puppet::ParseError))
23 | end
24 |
25 | it "should convert password into a hash" do
26 | result = @scope.function_mysql_password(["password"])
27 | result.should(eq('*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19'))
28 | end
29 |
30 | end
31 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/strip.rb:
--------------------------------------------------------------------------------
1 | #
2 | # strip.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:strip, :type => :rvalue, :doc => <<-EOS
7 | This function removes leading and trailing whitespace from a string or from
8 | every string inside an array.
9 |
10 | *Examples:*
11 |
12 | strip(" aaa ")
13 |
14 | Would result in: "aaa"
15 | EOS
16 | ) do |arguments|
17 |
18 | raise(Puppet::ParseError, "strip(): Wrong number of arguments " +
19 | "given (#{arguments.size} for 1)") if arguments.size < 1
20 |
21 | value = arguments[0]
22 | klass = value.class
23 |
24 | unless [Array, String].include?(klass)
25 | raise(Puppet::ParseError, 'strip(): Requires either ' +
26 | 'array or string to work with')
27 | end
28 |
29 | if value.is_a?(Array)
30 | result = value.collect { |i| i.is_a?(String) ? i.strip : i }
31 | else
32 | result = value.strip
33 | end
34 |
35 | return result
36 | end
37 | end
38 |
39 | # vim: set ts=2 sw=2 et :
40 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/spec/defines/mod_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'apache::mod', :type => :define do
4 | context "On a Red Hat OS with shibboleth module and package param passed" do
5 | let :facts do
6 | { :osfamily => 'redhat' }
7 | end
8 | # name/title for the apache::mod define
9 | let :title do
10 | 'xsendfile'
11 | end
12 | # parameters
13 | let(:params) { {:package => 'mod_xsendfile'} }
14 |
15 | it { should include_class("apache::params") }
16 | it { should contain_package('mod_xsendfile') }
17 | end
18 |
19 | context "On a Red Hat OS with shibboleth module" do
20 | let :facts do
21 | { :osfamily => 'redhat' }
22 | end
23 | let :title do
24 | 'shibboleth'
25 | end
26 | it { should include_class("apache::params") }
27 | it { should contain_package('shibboleth') }
28 | it do
29 | should contain_a2mod(title).with({
30 | 'ensure' => 'present',
31 | 'identifier' => 'mod_shib',
32 | })
33 | end
34 | end
35 | end
36 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/strftime_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the strftime function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("strftime").should == "function_strftime"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_strftime([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "using %s should be higher then when I wrote this test" do
16 | result = scope.function_strftime(["%s"])
17 | result.to_i.should(be > 1311953157)
18 | end
19 |
20 | it "using %s should be lower then 1.5 trillion" do
21 | result = scope.function_strftime(["%s"])
22 | result.to_i.should(be < 1500000000)
23 | end
24 |
25 | it "should return a date when given %Y-%m-%d" do
26 | result = scope.function_strftime(["%Y-%m-%d"])
27 | result.should =~ /^\d{4}-\d{2}-\d{2}$/
28 | end
29 | end
30 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/to_bytes.rb:
--------------------------------------------------------------------------------
1 | module Puppet::Parser::Functions
2 | newfunction(:to_bytes, :type => :rvalue, :doc => <<-EOS
3 | Converts the argument into bytes, for example 4 kB becomes 4096.
4 | Takes a single string value as an argument.
5 | EOS
6 | ) do |arguments|
7 |
8 | raise(Puppet::ParseError, "to_bytes(): Wrong number of arguments " +
9 | "given (#{arguments.size} for 1)") if arguments.size != 1
10 |
11 | arg = arguments[0]
12 |
13 | return arg if arg.is_a? Numeric
14 |
15 | value,prefix = */([0-9.e+-]*)\s*([^bB]?)/.match(arg)[1,2]
16 |
17 | value = value.to_f
18 | case prefix
19 | when '' then return value.to_i
20 | when 'k' then return (value*(1<<10)).to_i
21 | when 'M' then return (value*(1<<20)).to_i
22 | when 'G' then return (value*(1<<30)).to_i
23 | when 'T' then return (value*(1<<40)).to_i
24 | when 'E' then return (value*(1<<50)).to_i
25 | else raise Puppet::ParseError, "to_bytes(): Unknown prefix #{prefix}"
26 | end
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/validate_hash.rb:
--------------------------------------------------------------------------------
1 | module Puppet::Parser::Functions
2 |
3 | newfunction(:validate_hash, :doc => <<-'ENDHEREDOC') do |args|
4 | Validate that all passed values are hash data structures. Abort catalog
5 | compilation if any value fails this check.
6 |
7 | The following values will pass:
8 |
9 | $my_hash = { 'one' => 'two' }
10 | validate_hash($my_hash)
11 |
12 | The following values will fail, causing compilation to abort:
13 |
14 | validate_hash(true)
15 | validate_hash('some_string')
16 | $undefined = undef
17 | validate_hash($undefined)
18 |
19 | ENDHEREDOC
20 |
21 | unless args.length > 0 then
22 | raise Puppet::ParseError, ("validate_hash(): wrong number of arguments (#{args.length}; must be > 0)")
23 | end
24 |
25 | args.each do |arg|
26 | unless arg.is_a?(Hash)
27 | raise Puppet::ParseError, ("#{arg.inspect} is not a Hash. It looks to be a #{arg.class}")
28 | end
29 | end
30 |
31 | end
32 |
33 | end
34 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/validate_array.rb:
--------------------------------------------------------------------------------
1 | module Puppet::Parser::Functions
2 |
3 | newfunction(:validate_array, :doc => <<-'ENDHEREDOC') do |args|
4 | Validate that all passed values are array data structures. Abort catalog
5 | compilation if any value fails this check.
6 |
7 | The following values will pass:
8 |
9 | $my_array = [ 'one', 'two' ]
10 | validate_array($my_array)
11 |
12 | The following values will fail, causing compilation to abort:
13 |
14 | validate_array(true)
15 | validate_array('some_string')
16 | $undefined = undef
17 | validate_array($undefined)
18 |
19 | ENDHEREDOC
20 |
21 | unless args.length > 0 then
22 | raise Puppet::ParseError, ("validate_array(): wrong number of arguments (#{args.length}; must be > 0)")
23 | end
24 |
25 | args.each do |arg|
26 | unless arg.is_a?(Array)
27 | raise Puppet::ParseError, ("#{arg.inspect} is not an Array. It looks to be a #{arg.class}")
28 | end
29 | end
30 |
31 | end
32 |
33 | end
34 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/facter/puppet_vardir.rb:
--------------------------------------------------------------------------------
1 | # This facter fact returns the value of the Puppet vardir setting for the node
2 | # running puppet or puppet agent. The intent is to enable Puppet modules to
3 | # automatically have insight into a place where they can place variable data,
4 | # regardless of the node's platform.
5 | #
6 | # The value should be directly usable in a File resource path attribute.
7 |
8 |
9 | begin
10 | require 'facter/util/puppet_settings'
11 | rescue LoadError => e
12 | # puppet apply does not add module lib directories to the $LOAD_PATH (See
13 | # #4248). It should (in the future) but for the time being we need to be
14 | # defensive which is what this rescue block is doing.
15 | rb_file = File.join(File.dirname(__FILE__), 'util', 'puppet_settings.rb')
16 | load rb_file if File.exists?(rb_file) or raise e
17 | end
18 |
19 | Facter.add(:puppet_vardir) do
20 | setcode do
21 | # This will be nil if Puppet is not available.
22 | Facter::Util::PuppetSettings.with_puppet do
23 | Puppet[:vardir]
24 | end
25 | end
26 | end
27 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/manifests/stages.pp:
--------------------------------------------------------------------------------
1 | # Class: stdlib::stages
2 | #
3 | # This class manages a standard set of run stages for Puppet. It is managed by
4 | # the stdlib class, and should not be declared independently.
5 | #
6 | # The high level stages are (in order):
7 | #
8 | # * setup
9 | # * main
10 | # * runtime
11 | # * setup_infra
12 | # * deploy_infra
13 | # * setup_app
14 | # * deploy_app
15 | # * deploy
16 | #
17 | # Parameters: none
18 | #
19 | # Actions:
20 | #
21 | # Declares various run-stages for deploying infrastructure,
22 | # language runtimes, and application layers.
23 | #
24 | # Requires: nothing
25 | #
26 | # Sample Usage:
27 | #
28 | # node default {
29 | # include stdlib
30 | # class { java: stage => 'runtime' }
31 | # }
32 | #
33 | class stdlib::stages {
34 |
35 | stage { 'setup': before => Stage['main'] }
36 | stage { 'runtime': require => Stage['main'] }
37 | -> stage { 'setup_infra': }
38 | -> stage { 'deploy_infra': }
39 | -> stage { 'setup_app': }
40 | -> stage { 'deploy_app': }
41 | -> stage { 'deploy': }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_mac_address_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the is_mac_address function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("is_mac_address").should == "function_is_mac_address"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_is_mac_address([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should return true if a valid mac address" do
16 | result = scope.function_is_mac_address(["00:a0:1f:12:7f:a0"])
17 | result.should(eq(true))
18 | end
19 |
20 | it "should return false if octets are out of range" do
21 | result = scope.function_is_mac_address(["00:a0:1f:12:7f:g0"])
22 | result.should(eq(false))
23 | end
24 |
25 | it "should return false if not valid" do
26 | result = scope.function_is_mac_address(["not valid"])
27 | result.should(eq(false))
28 | end
29 | end
30 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/hash.rb:
--------------------------------------------------------------------------------
1 | #
2 | # hash.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:hash, :type => :rvalue, :doc => <<-EOS
7 | This function converts and array into a hash.
8 |
9 | *Examples:*
10 |
11 | hash(['a',1,'b',2,'c',3])
12 |
13 | Would return: {'a'=>1,'b'=>2,'c'=>3}
14 | EOS
15 | ) do |arguments|
16 |
17 | raise(Puppet::ParseError, "hash(): Wrong number of arguments " +
18 | "given (#{arguments.size} for 1)") if arguments.size < 1
19 |
20 | array = arguments[0]
21 |
22 | unless array.is_a?(Array)
23 | raise(Puppet::ParseError, 'hash(): Requires array to work with')
24 | end
25 |
26 | result = {}
27 |
28 | begin
29 | # This is to make it compatible with older version of Ruby ...
30 | array = array.flatten
31 | result = Hash[*array]
32 | rescue Exception
33 | raise(Puppet::ParseError, 'hash(): Unable to compute ' +
34 | 'hash from array given')
35 | end
36 |
37 | return result
38 | end
39 | end
40 |
41 | # vim: set ts=2 sw=2 et :
42 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/upcase.rb:
--------------------------------------------------------------------------------
1 | #
2 | # upcase.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:upcase, :type => :rvalue, :doc => <<-EOS
7 | Converts a string or an array of strings to uppercase.
8 |
9 | *Examples:*
10 |
11 | upcase("abcd")
12 |
13 | Will return:
14 |
15 | ASDF
16 | EOS
17 | ) do |arguments|
18 |
19 | raise(Puppet::ParseError, "upcase(): Wrong number of arguments " +
20 | "given (#{arguments.size} for 1)") if arguments.size < 1
21 |
22 | value = arguments[0]
23 | klass = value.class
24 |
25 | unless [Array, String].include?(klass)
26 | raise(Puppet::ParseError, 'upcase(): Requires either ' +
27 | 'array or string to work with')
28 | end
29 |
30 | if value.is_a?(Array)
31 | # Numbers in Puppet are often string-encoded which is troublesome ...
32 | result = value.collect { |i| i.is_a?(String) ? i.upcase : i }
33 | else
34 | result = value.upcase
35 | end
36 |
37 | return result
38 | end
39 | end
40 |
41 | # vim: set ts=2 sw=2 et :
42 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/lib/puppet/type/database_user.rb:
--------------------------------------------------------------------------------
1 | # This has to be a separate type to enable collecting
2 | Puppet::Type.newtype(:database_user) do
3 | @doc = "Manage a database user. This includes management of users password as well as priveleges"
4 |
5 | ensurable
6 |
7 | newparam(:name, :namevar=>true) do
8 | desc "The name of the user. This uses the 'username@hostname' or username@hostname."
9 | validate do |value|
10 | # https://dev.mysql.com/doc/refman/5.1/en/account-names.html
11 | # Regex should problably be more like this: /^[`'"]?[^`'"]*[`'"]?@[`'"]?[\w%\.]+[`'"]?$/
12 | raise(ArgumentError, "Invalid database user #{value}") unless value =~ /[\w-]*@[\w%\.:]+/
13 | username = value.split('@')[0]
14 | if username.size > 16
15 | raise ArgumentError, "MySQL usernames are limited to a maximum of 16 characters"
16 | end
17 | end
18 | end
19 |
20 | newproperty(:password_hash) do
21 | desc "The password hash of the user. Use mysql_password() for creating such a hash."
22 | newvalue(/\w+/)
23 | end
24 |
25 | end
26 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/swapcase.rb:
--------------------------------------------------------------------------------
1 | #
2 | # swapcase.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:swapcase, :type => :rvalue, :doc => <<-EOS
7 | This function will swap the existing case of a string.
8 |
9 | *Examples:*
10 |
11 | swapcase("aBcD")
12 |
13 | Would result in: "AbCd"
14 | EOS
15 | ) do |arguments|
16 |
17 | raise(Puppet::ParseError, "swapcase(): Wrong number of arguments " +
18 | "given (#{arguments.size} for 1)") if arguments.size < 1
19 |
20 | value = arguments[0]
21 | klass = value.class
22 |
23 | unless [Array, String].include?(klass)
24 | raise(Puppet::ParseError, 'swapcase(): Requires either ' +
25 | 'array or string to work with')
26 | end
27 |
28 | if value.is_a?(Array)
29 | # Numbers in Puppet are often string-encoded which is troublesome ...
30 | result = value.collect { |i| i.is_a?(String) ? i.swapcase : i }
31 | else
32 | result = value.swapcase
33 | end
34 |
35 | return result
36 | end
37 | end
38 |
39 | # vim: set ts=2 sw=2 et :
40 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/capitalize.rb:
--------------------------------------------------------------------------------
1 | #
2 | # capitalize.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:capitalize, :type => :rvalue, :doc => <<-EOS
7 | Capitalizes the first letter of a string or array of strings.
8 | Requires either a single string or an array as an input.
9 | EOS
10 | ) do |arguments|
11 |
12 | raise(Puppet::ParseError, "capitalize(): Wrong number of arguments " +
13 | "given (#{arguments.size} for 1)") if arguments.size < 1
14 |
15 | value = arguments[0]
16 | klass = value.class
17 |
18 | unless [Array, String].include?(klass)
19 | raise(Puppet::ParseError, 'capitalize(): Requires either ' +
20 | 'array or string to work with')
21 | end
22 |
23 | if value.is_a?(Array)
24 | # Numbers in Puppet are often string-encoded which is troublesome ...
25 | result = value.collect { |i| i.is_a?(String) ? i.capitalize : i }
26 | else
27 | result = value.capitalize
28 | end
29 |
30 | return result
31 | end
32 | end
33 |
34 | # vim: set ts=2 sw=2 et :
35 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/validate_string.rb:
--------------------------------------------------------------------------------
1 | module Puppet::Parser::Functions
2 |
3 | newfunction(:validate_string, :doc => <<-'ENDHEREDOC') do |args|
4 | Validate that all passed values are string data structures. Abort catalog
5 | compilation if any value fails this check.
6 |
7 | The following values will pass:
8 |
9 | $my_string = "one two"
10 | validate_string($my_string, 'three')
11 |
12 | The following values will fail, causing compilation to abort:
13 |
14 | validate_string(true)
15 | validate_string([ 'some', 'array' ])
16 | $undefined = undef
17 | validate_string($undefined)
18 |
19 | ENDHEREDOC
20 |
21 | unless args.length > 0 then
22 | raise Puppet::ParseError, ("validate_string(): wrong number of arguments (#{args.length}; must be > 0)")
23 | end
24 |
25 | args.each do |arg|
26 | unless arg.is_a?(String)
27 | raise Puppet::ParseError, ("#{arg.inspect} is not a string. It looks to be a #{arg.class}")
28 | end
29 | end
30 |
31 | end
32 |
33 | end
34 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | dir = File.expand_path(File.dirname(__FILE__))
2 | $LOAD_PATH.unshift File.join(dir, 'lib')
3 |
4 | # Don't want puppet getting the command line arguments for rake or autotest
5 | ARGV.clear
6 |
7 | require 'puppet'
8 | require 'facter'
9 | require 'mocha'
10 | gem 'rspec', '>=2.0.0'
11 | require 'rspec/expectations'
12 |
13 | require 'puppetlabs_spec_helper/module_spec_helper'
14 |
15 | RSpec.configure do |config|
16 | # FIXME REVISIT - We may want to delegate to Facter like we do in
17 | # Puppet::PuppetSpecInitializer.initialize_via_testhelper(config) because
18 | # this behavior is a duplication of the spec_helper in Facter.
19 | config.before :each do
20 | # Ensure that we don't accidentally cache facts and environment between
21 | # test cases. This requires each example group to explicitly load the
22 | # facts being exercised with something like
23 | # Facter.collection.loader.load(:ipaddress)
24 | Facter::Util::Loader.any_instance.stubs(:load_all)
25 | Facter.clear
26 | Facter.clear_messages
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/abs.rb:
--------------------------------------------------------------------------------
1 | #
2 | # abs.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:abs, :type => :rvalue, :doc => <<-EOS
7 | Returns the absolute value of a number, for example -34.56 becomes
8 | 34.56. Takes a single integer and float value as an argument.
9 | EOS
10 | ) do |arguments|
11 |
12 | raise(Puppet::ParseError, "abs(): Wrong number of arguments " +
13 | "given (#{arguments.size} for 1)") if arguments.size < 1
14 |
15 | value = arguments[0]
16 |
17 | # Numbers in Puppet are often string-encoded which is troublesome ...
18 | if value.is_a?(String)
19 | if value.match(/^-?(?:\d+)(?:\.\d+){1}$/)
20 | value = value.to_f
21 | elsif value.match(/^-?\d+$/)
22 | value = value.to_i
23 | else
24 | raise(Puppet::ParseError, 'abs(): Requires float or ' +
25 | 'integer to work with')
26 | end
27 | end
28 |
29 | # We have numeric value to handle ...
30 | result = value.abs
31 |
32 | return result
33 | end
34 | end
35 |
36 | # vim: set ts=2 sw=2 et :
37 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/chomp.rb:
--------------------------------------------------------------------------------
1 | #
2 | # chomp.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:chomp, :type => :rvalue, :doc => <<-'EOS'
7 | Removes the record separator from the end of a string or an array of
8 | strings, for example `hello\n` becomes `hello`.
9 | Requires a single string or array as an input.
10 | EOS
11 | ) do |arguments|
12 |
13 | raise(Puppet::ParseError, "chomp(): Wrong number of arguments " +
14 | "given (#{arguments.size} for 1)") if arguments.size < 1
15 |
16 | value = arguments[0]
17 | klass = value.class
18 |
19 | unless [Array, String].include?(klass)
20 | raise(Puppet::ParseError, 'chomp(): Requires either ' +
21 | 'array or string to work with')
22 | end
23 |
24 | if value.is_a?(Array)
25 | # Numbers in Puppet are often string-encoded which is troublesome ...
26 | result = value.collect { |i| i.is_a?(String) ? i.chomp : i }
27 | else
28 | result = value.chomp
29 | end
30 |
31 | return result
32 | end
33 | end
34 |
35 | # vim: set ts=2 sw=2 et :
36 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2004-2013 Fabien Potencier
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is furnished
8 | to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/templates/vhost-proxy.conf.erb:
--------------------------------------------------------------------------------
1 | NameVirtualHost <%= vhost_name %>:<%= port %>
2 | :<%= port %>>
3 | <% if ssl == true %>
4 | SSLEngine on
5 | SSLCertificateFile <%= ssl_path %>/certs/pl.cert
6 | SSLCertificateKeyFile <%= ssl_path %>/private/pl.key
7 | <% end %>
8 | ServerName <%= srvname %>
9 | <% if serveraliases.is_a? Array %>
10 | <% serveraliases.each do |name| %><%= " ServerAlias #{name}\n" %><% end %>
11 | <% elsif serveraliases != '' %>
12 | <%= " ServerAlias #{serveraliases}" %>
13 | <% end %>
14 | ProxyRequests Off
15 |
16 | Order deny,allow
17 | Allow from all
18 |
19 |
20 | <% for uri in no_proxy_uris %>
21 | ProxyPass <%= uri %> !
22 | <% end %>
23 | ProxyPass / <%= dest %>/
24 | ProxyPassReverse / <%= dest %>/
25 | ProxyPreserveHost On
26 |
27 | ErrorLog /var/log/<%= scope.lookupvar("apache::params::apache_name") %>/<%= name %>_error.log
28 | LogLevel warn
29 | CustomLog /var/log/<%= scope.lookupvar("apache::params::apache_name") %>/<%= name %>_access.log combined
30 |
31 |
32 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/RELEASE_PROCESS.markdown:
--------------------------------------------------------------------------------
1 | # Contributing to this module #
2 |
3 | * Work in a topic branch
4 | * Submit a github pull request
5 | * Address any comments / feeback
6 | * Merge into master using --no-ff
7 |
8 | # Releasing this module #
9 |
10 | * This module adheres to http://semver.org/
11 | * Look for API breaking changes using git diff vX.Y.Z..master
12 | * If no API breaking changes, the minor version may be bumped.
13 | * If there are API breaking changes, the major version must be bumped.
14 | * If there are only small minor changes, the patch version may be bumped.
15 | * Update the CHANGELOG
16 | * Update the Modulefile
17 | * Commit these changes with a message along the lines of "Update CHANGELOG and
18 | Modulefile for release"
19 | * Create an annotated tag with git tag -a vX.Y.Z -m 'version X.Y.Z' (NOTE the
20 | leading v as per semver.org)
21 | * Push the tag with git push origin --tags
22 | * Build a new package with puppet-module or the rake build task if it exists
23 | * Publish the new package to the forge
24 | * Bonus points for an announcement to puppet-users.
25 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/join.rb:
--------------------------------------------------------------------------------
1 | #
2 | # join.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:join, :type => :rvalue, :doc => <<-EOS
7 | This function joins an array into a string using a seperator.
8 |
9 | *Examples:*
10 |
11 | join(['a','b','c'], ",")
12 |
13 | Would result in: "a,b,c"
14 | EOS
15 | ) do |arguments|
16 |
17 | # Technically we support two arguments but only first is mandatory ...
18 | raise(Puppet::ParseError, "join(): Wrong number of arguments " +
19 | "given (#{arguments.size} for 1)") if arguments.size < 1
20 |
21 | array = arguments[0]
22 |
23 | unless array.is_a?(Array)
24 | raise(Puppet::ParseError, 'join(): Requires array to work with')
25 | end
26 |
27 | suffix = arguments[1] if arguments[1]
28 |
29 | if suffix
30 | unless suffix.is_a?(String)
31 | raise(Puppet::ParseError, 'join(): Requires string to work with')
32 | end
33 | end
34 |
35 | result = suffix ? array.join(suffix) : array.join
36 |
37 | return result
38 | end
39 | end
40 |
41 | # vim: set ts=2 sw=2 et :
42 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/uriescape.rb:
--------------------------------------------------------------------------------
1 | #
2 | # uriescape.rb
3 | #
4 | require 'uri'
5 |
6 | module Puppet::Parser::Functions
7 | newfunction(:uriescape, :type => :rvalue, :doc => <<-EOS
8 | Urlencodes a string or array of strings.
9 | Requires either a single string or an array as an input.
10 | EOS
11 | ) do |arguments|
12 |
13 | raise(Puppet::ParseError, "uriescape(): Wrong number of arguments " +
14 | "given (#{arguments.size} for 1)") if arguments.size < 1
15 |
16 | value = arguments[0]
17 | klass = value.class
18 | unsafe = ":/?#[]@!$&'()*+,;= "
19 |
20 | unless [Array, String].include?(klass)
21 | raise(Puppet::ParseError, 'uriescape(): Requires either ' +
22 | 'array or string to work with')
23 | end
24 |
25 | if value.is_a?(Array)
26 | # Numbers in Puppet are often string-encoded which is troublesome ...
27 | result = value.collect { |i| i.is_a?(String) ? URI.escape(i,unsafe) : i }
28 | else
29 | result = URI.escape(value,unsafe)
30 | end
31 |
32 | return result
33 | end
34 | end
35 |
36 | # vim: set ts=2 sw=2 et :
37 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/validate_bool.rb:
--------------------------------------------------------------------------------
1 | module Puppet::Parser::Functions
2 |
3 | newfunction(:validate_bool, :doc => <<-'ENDHEREDOC') do |args|
4 | Validate that all passed values are either true or false. Abort catalog
5 | compilation if any value fails this check.
6 |
7 | The following values will pass:
8 |
9 | $iamtrue = true
10 | validate_bool(true)
11 | validate_bool(true, true, false, $iamtrue)
12 |
13 | The following values will fail, causing compilation to abort:
14 |
15 | $some_array = [ true ]
16 | validate_bool("false")
17 | validate_bool("true")
18 | validate_bool($some_array)
19 |
20 | ENDHEREDOC
21 |
22 | unless args.length > 0 then
23 | raise Puppet::ParseError, ("validate_bool(): wrong number of arguments (#{args.length}; must be > 0)")
24 | end
25 |
26 | args.each do |arg|
27 | unless (arg.is_a?(TrueClass) || arg.is_a?(FalseClass))
28 | raise Puppet::ParseError, ("#{arg.inspect} is not a boolean. It looks to be a #{arg.class}")
29 | end
30 | end
31 |
32 | end
33 |
34 | end
35 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_string_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the is_string function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("is_string").should == "function_is_string"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_is_string([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should return true if a string" do
16 | result = scope.function_is_string(["asdf"])
17 | result.should(eq(true))
18 | end
19 |
20 | it "should return false if an integer" do
21 | result = scope.function_is_string(["3"])
22 | result.should(eq(false))
23 | end
24 |
25 | it "should return false if a float" do
26 | result = scope.function_is_string(["3.23"])
27 | result.should(eq(false))
28 | end
29 |
30 | it "should return false if an array" do
31 | result = scope.function_is_string([["a","b","c"]])
32 | result.should(eq(false))
33 | end
34 | end
35 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/spec/defines/mysql_server_config_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'mysql::server::config', :type => :define do
4 | filename = '/etc/mysql/conf.d/test_config.cnf'
5 |
6 | let :facts do
7 | { :osfamily => 'Debian'}
8 | end
9 |
10 | let(:title) { File.basename(filename, '.cnf') }
11 |
12 | let(:params) {
13 | { 'settings' => {
14 | 'mysqld' => {
15 | 'bind-address' => '0.0.0.0'
16 | }
17 | }
18 | }
19 | }
20 |
21 | it 'should notify the mysql daemon' do
22 | should contain_file(filename).with_notify('Exec[mysqld-restart]')
23 | end
24 |
25 | it 'should contain config parameter in content' do
26 | should contain_file(filename).with_content("### MANAGED BY PUPPET ###\n[mysqld]\nbind-address = 0.0.0.0\n\n")
27 | end
28 |
29 | it 'should not notify the mysql daemon' do
30 | params.merge!({ 'notify_service' => false })
31 | should contain_file(filename).without_notify
32 | end
33 |
34 | it 'should require on the mysql-server package' do
35 | should contain_file(filename).with_require('Package[mysql-server]')
36 | end
37 | end
38 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/templates/mod/userdir.conf.erb:
--------------------------------------------------------------------------------
1 | #
2 | # UserDir: The name of the directory that is appended onto a user's home
3 | # directory if a ~user request is received.
4 | #
5 | # The path to the end user account 'public_html' directory must be
6 | # accessible to the webserver userid. This usually means that ~userid
7 | # must have permissions of 711, ~userid/public_html must have permissions
8 | # of 755, and documents contained therein must be world-readable.
9 | # Otherwise, the client will only receive a "403 Forbidden" message.
10 | #
11 | # See also: http://httpd.apache.org/docs/misc/FAQ.html#forbidden
12 | #
13 |
14 | #
15 | # UserDir is disabled by default since it can confirm the presence
16 | # of a username on the system (depending on home directory
17 | # permissions).
18 | #
19 | #UserDir disable
20 |
21 | #
22 | # To enable requests to /~user/ to serve the user's public_html
23 | # directory, remove the "UserDir disable" line above, and uncomment
24 | # the following line instead:
25 | #
26 | #UserDir public_html
27 |
28 | UserDir <%= dir %>
29 |
30 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/facter/util/puppet_settings_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 | require 'facter/util/puppet_settings'
3 |
4 | describe Facter::Util::PuppetSettings do
5 |
6 | describe "#with_puppet" do
7 | context "Without Puppet loaded" do
8 | before(:each) do
9 | Module.expects(:const_get).with("Puppet").raises(NameError)
10 | end
11 |
12 | it 'should be nil' do
13 | subject.with_puppet { Puppet[:vardir] }.should be_nil
14 | end
15 | it 'should not yield to the block' do
16 | Puppet.expects(:[]).never
17 | subject.with_puppet { Puppet[:vardir] }.should be_nil
18 | end
19 | end
20 | context "With Puppet loaded" do
21 | module Puppet; end
22 | let(:vardir) { "/var/lib/puppet" }
23 |
24 | before :each do
25 | Puppet.expects(:[]).with(:vardir).returns vardir
26 | end
27 | it 'should yield to the block' do
28 | subject.with_puppet { Puppet[:vardir] }
29 | end
30 | it 'should return the nodes vardir' do
31 | subject.with_puppet { Puppet[:vardir] }.should eq vardir
32 | end
33 | end
34 | end
35 | end
36 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/pick.rb:
--------------------------------------------------------------------------------
1 | module Puppet::Parser::Functions
2 | newfunction(:pick, :type => :rvalue, :doc => <<-EOS
3 |
4 | This function is similar to a coalesce function in SQL in that it will return
5 | the first value in a list of values that is not undefined or an empty string
6 | (two things in Puppet that will return a boolean false value). Typically,
7 | this function is used to check for a value in the Puppet Dashboard/Enterprise
8 | Console, and failover to a default value like the following:
9 |
10 | $real_jenkins_version = pick($::jenkins_version, '1.449')
11 |
12 | The value of $real_jenkins_version will first look for a top-scope variable
13 | called 'jenkins_version' (note that parameters set in the Puppet Dashboard/
14 | Enterprise Console are brought into Puppet as top-scope variables), and,
15 | failing that, will use a default value of 1.449.
16 |
17 | EOS
18 | ) do |args|
19 | args = args.compact
20 | args.delete(:undef)
21 | args.delete(:undefined)
22 | args.delete("")
23 | if args[0].to_s.empty? then
24 | fail "Must provide non empty value."
25 | else
26 | return args[0]
27 | end
28 | end
29 | end
30 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/pick_spec.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the pick function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("pick").should == "function_pick"
9 | end
10 |
11 | it 'should return the correct value' do
12 | scope.function_pick(['first', 'second']).should == 'first'
13 | end
14 |
15 | it 'should return the correct value if the first value is empty' do
16 | scope.function_pick(['', 'second']).should == 'second'
17 | end
18 |
19 | it 'should remove empty string values' do
20 | scope.function_pick(['', 'first']).should == 'first'
21 | end
22 |
23 | it 'should remove :undef values' do
24 | scope.function_pick([:undef, 'first']).should == 'first'
25 | end
26 |
27 | it 'should remove :undefined values' do
28 | scope.function_pick([:undefined, 'first']).should == 'first'
29 | end
30 |
31 | it 'should error if no values are passed' do
32 | expect { scope.function_pick([]) }.to raise_error(Puppet::Error, /Must provide non empty value./)
33 | end
34 | end
35 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/range_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the range function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("range").should == "function_range"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_range([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should return a letter range" do
16 | result = scope.function_range(["a","d"])
17 | result.should(eq(['a','b','c','d']))
18 | end
19 |
20 | it "should return a number range" do
21 | result = scope.function_range(["1","4"])
22 | result.should(eq([1,2,3,4]))
23 | end
24 |
25 | it "should work with padded hostname like strings" do
26 | expected = ("host01".."host10").to_a
27 | scope.function_range(["host01","host10"]).should eq expected
28 | end
29 |
30 | it "should coerce zero padded digits to integers" do
31 | expected = (0..10).to_a
32 | scope.function_range(["00", "10"]).should eq expected
33 | end
34 | end
35 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/has_ip_network_spec.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe Puppet::Parser::Functions.function(:has_ip_network) do
5 |
6 | let(:scope) do
7 | PuppetlabsSpec::PuppetInternals.scope
8 | end
9 |
10 | subject do
11 | function_name = Puppet::Parser::Functions.function(:has_ip_network)
12 | scope.method(function_name)
13 | end
14 |
15 | context "On Linux Systems" do
16 | before :each do
17 | scope.stubs(:lookupvar).with('interfaces').returns('eth0,lo')
18 | scope.stubs(:lookupvar).with('network').returns(:undefined)
19 | scope.stubs(:lookupvar).with('network_eth0').returns('10.0.2.0')
20 | scope.stubs(:lookupvar).with('network_lo').returns('127.0.0.1')
21 | end
22 |
23 | it 'should have primary network (10.0.2.0)' do
24 | subject.call(['10.0.2.0']).should be_true
25 | end
26 |
27 | it 'should have loopback network (127.0.0.0)' do
28 | subject.call(['127.0.0.1']).should be_true
29 | end
30 |
31 | it 'should not have other network' do
32 | subject.call(['192.168.1.0']).should be_false
33 | end
34 | end
35 | end
36 |
37 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/manifests/mod.pp:
--------------------------------------------------------------------------------
1 | define apache::mod (
2 | $package = undef
3 | ) {
4 | $mod = $name
5 | include apache::params
6 | #include apache #This creates duplicate resources in rspec-puppet
7 | $mod_packages = $apache::params::mod_packages
8 | $mod_package = $mod_packages[$mod] # 2.6 compatibility hack
9 | if $package {
10 | $package_REAL = $package
11 | } elsif "$mod_package" {
12 | $package_REAL = $mod_package
13 | }
14 | $mod_libs = $apache::params::mod_libs
15 | $mod_lib = $mod_libs[$mod] # 2.6 compatibility hack
16 | if "${mod_lib}" {
17 | $lib = $mod_lib
18 | }
19 |
20 | $mod_identifiers = $apache::params::mod_identifiers
21 | $mod_identifier = $mod_identifiers[$mod]
22 | if "${mod_identifier}" {
23 | $identifier = $mod_identifier
24 | }
25 |
26 | if $package_REAL {
27 | package { $package_REAL:
28 | ensure => present,
29 | require => Package['httpd'],
30 | before => A2mod[$mod],
31 | }
32 | }
33 |
34 | a2mod { $mod:
35 | ensure => present,
36 | lib => $lib,
37 | identifier => $identifier,
38 | require => Package['httpd'],
39 | notify => Service['httpd'],
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/templates/my.cnf.erb:
--------------------------------------------------------------------------------
1 | [client]
2 | port = <%= port %>
3 | socket = <%= socket %>
4 | [mysqld_safe]
5 | socket = <%= socket %>
6 | nice = 0
7 | [mysqld]
8 | user = mysql
9 | pid-file = <%= pidfile %>
10 | socket = <%= socket %>
11 | port = <%= port %>
12 | basedir = <%= basedir %>
13 | datadir = <%= datadir %>
14 | tmpdir = /tmp
15 | skip-external-locking
16 |
17 | <% if bind_address %>
18 | bind-address = <%= bind_address %>
19 | <% end %>
20 |
21 | key_buffer = 16M
22 | max_allowed_packet = 16M
23 | thread_stack = 192K
24 | thread_cache_size = 8
25 | myisam-recover = BACKUP
26 | query_cache_limit = 1M
27 | query_cache_size = 16M
28 | log_error = <%= log_error %>
29 | expire_logs_days = 10
30 | max_binlog_size = 100M
31 | <% if default_engine != 'UNSET' %>
32 | default-storage-engine = <%= default_engine %>
33 | <% end %>
34 | <% if ssl == true %>
35 | ssl-ca = <%= ssl_ca %>
36 | ssl-cert = <%= ssl_cert %>
37 | ssl-key = <%= ssl_key %>
38 | <% end %>
39 |
40 | [mysqldump]
41 | quick
42 | quote-names
43 | max_allowed_packet = 16M
44 | [mysql]
45 | [isamchk]
46 | key_buffer = 16M
47 | !includedir /etc/mysql/conf.d/
48 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/str2saltedsha512.rb:
--------------------------------------------------------------------------------
1 | #
2 | # str2saltedsha512.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:str2saltedsha512, :type => :rvalue, :doc => <<-EOS
7 | This converts a string to a salted-SHA512 password hash (which is used for
8 | OS X versions >= 10.7). Given any simple string, you will get a hex version
9 | of a salted-SHA512 password hash that can be inserted into your Puppet
10 | manifests as a valid password attribute.
11 | EOS
12 | ) do |arguments|
13 | require 'digest/sha2'
14 |
15 | raise(Puppet::ParseError, "str2saltedsha512(): Wrong number of arguments " +
16 | "passed (#{arguments.size} but we require 1)") if arguments.size != 1
17 |
18 | password = arguments[0]
19 |
20 | unless password.is_a?(String)
21 | raise(Puppet::ParseError, 'str2saltedsha512(): Requires a ' +
22 | "String argument, you passed: #{password.class}")
23 | end
24 |
25 | seedint = rand(2**31 - 1)
26 | seedstring = Array(seedint).pack("L")
27 | saltedpass = Digest::SHA512.digest(seedstring + password)
28 | (seedstring + saltedpass).unpack('H*')[0]
29 | end
30 | end
31 |
32 | # vim: set ts=2 sw=2 et :
33 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/values_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the values function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("values").should == "function_values"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_values([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should return values from a hash" do
16 | result = scope.function_values([{'a'=>'1','b'=>'2','c'=>'3'}])
17 | # =~ is the RSpec::Matchers::MatchArray matcher.
18 | # A.K.A. "array with same elements" (multiset) matching
19 | result.should =~ %w{ 1 2 3 }
20 | end
21 |
22 | it "should return a multiset" do
23 | result = scope.function_values([{'a'=>'1','b'=>'3','c'=>'3'}])
24 | result.should =~ %w{ 1 3 3 }
25 | result.should_not =~ %w{ 1 3 }
26 | end
27 |
28 | it "should raise a ParseError unless a Hash is provided" do
29 | lambda { scope.function_values([['a','b','c']]) }.should( raise_error(Puppet::ParseError))
30 | end
31 | end
32 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/member.rb:
--------------------------------------------------------------------------------
1 | #
2 | # member.rb
3 | #
4 |
5 | # TODO(Krzysztof Wilczynski): We need to add support for regular expression ...
6 | # TODO(Krzysztof Wilczynski): Support for strings and hashes too ...
7 |
8 | module Puppet::Parser::Functions
9 | newfunction(:member, :type => :rvalue, :doc => <<-EOS
10 | This function determines if a variable is a member of an array.
11 |
12 | *Examples:*
13 |
14 | member(['a','b'], 'b')
15 |
16 | Would return: true
17 |
18 | member(['a','b'], 'c')
19 |
20 | Would return: false
21 | EOS
22 | ) do |arguments|
23 |
24 | raise(Puppet::ParseError, "member(): Wrong number of arguments " +
25 | "given (#{arguments.size} for 2)") if arguments.size < 2
26 |
27 | array = arguments[0]
28 |
29 | unless array.is_a?(Array)
30 | raise(Puppet::ParseError, 'member(): Requires array to work with')
31 | end
32 |
33 | item = arguments[1]
34 |
35 | raise(Puppet::ParseError, 'member(): You must provide item ' +
36 | 'to search for within array given') if item.empty?
37 |
38 | result = array.include?(item)
39 |
40 | return result
41 | end
42 | end
43 |
44 | # vim: set ts=2 sw=2 et :
45 |
--------------------------------------------------------------------------------
/web/app_dev.php:
--------------------------------------------------------------------------------
1 | loadClassCache();
24 | $request = Request::createFromGlobals();
25 | $response = $kernel->handle($request);
26 | $response->send();
27 | $kernel->terminate($request, $response);
28 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/merge.rb:
--------------------------------------------------------------------------------
1 | module Puppet::Parser::Functions
2 | newfunction(:merge, :type => :rvalue, :doc => <<-'ENDHEREDOC') do |args|
3 | Merges two or more hashes together and returns the resulting hash.
4 |
5 | For example:
6 |
7 | $hash1 = {'one' => 1, 'two', => 2}
8 | $hash2 = {'two' => 'dos', 'three', => 'tres'}
9 | $merged_hash = merge($hash1, $hash2)
10 | # The resulting hash is equivalent to:
11 | # $merged_hash = {'one' => 1, 'two' => 'dos', 'three' => 'tres'}
12 |
13 | When there is a duplicate key, the key in the rightmost hash will "win."
14 |
15 | ENDHEREDOC
16 |
17 | if args.length < 2
18 | raise Puppet::ParseError, ("merge(): wrong number of arguments (#{args.length}; must be at least 2)")
19 | end
20 |
21 | # The hash we accumulate into
22 | accumulator = Hash.new
23 | # Merge into the accumulator hash
24 | args.each do |arg|
25 | unless arg.is_a?(Hash)
26 | raise Puppet::ParseError, "merge: unexpected argument type #{arg.class}, only expects hash arguments"
27 | end
28 | accumulator.merge!(arg)
29 | end
30 | # Return the fully merged hash
31 | accumulator
32 | end
33 | end
34 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/prefix.rb:
--------------------------------------------------------------------------------
1 | #
2 | # prefix.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:prefix, :type => :rvalue, :doc => <<-EOS
7 | This function applies a prefix to all elements in an array.
8 |
9 | *Examles:*
10 |
11 | prefix(['a','b','c'], 'p')
12 |
13 | Will return: ['pa','pb','pc']
14 | EOS
15 | ) do |arguments|
16 |
17 | # Technically we support two arguments but only first is mandatory ...
18 | raise(Puppet::ParseError, "prefix(): Wrong number of arguments " +
19 | "given (#{arguments.size} for 1)") if arguments.size < 1
20 |
21 | array = arguments[0]
22 |
23 | unless array.is_a?(Array)
24 | raise(Puppet::ParseError, 'prefix(): Requires array to work with')
25 | end
26 |
27 | prefix = arguments[1] if arguments[1]
28 |
29 | if prefix
30 | unless prefix.is_a?(String)
31 | raise(Puppet::ParseError, 'prefix(): Requires string to work with')
32 | end
33 | end
34 |
35 | # Turn everything into string same as join would do ...
36 | result = array.collect do |i|
37 | i = i.to_s
38 | prefix ? prefix + i : i
39 | end
40 |
41 | return result
42 | end
43 | end
44 |
45 | # vim: set ts=2 sw=2 et :
46 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/chop.rb:
--------------------------------------------------------------------------------
1 | #
2 | # chop.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:chop, :type => :rvalue, :doc => <<-'EOS'
7 | Returns a new string with the last character removed. If the string ends
8 | with `\r\n`, both characters are removed. Applying chop to an empty
9 | string returns an empty string. If you wish to merely remove record
10 | separators then you should use the `chomp` function.
11 | Requires a string or array of strings as input.
12 | EOS
13 | ) do |arguments|
14 |
15 | raise(Puppet::ParseError, "chop(): Wrong number of arguments " +
16 | "given (#{arguments.size} for 1)") if arguments.size < 1
17 |
18 | value = arguments[0]
19 | klass = value.class
20 |
21 | unless [Array, String].include?(klass)
22 | raise(Puppet::ParseError, 'chop(): Requires either an ' +
23 | 'array or string to work with')
24 | end
25 |
26 | if value.is_a?(Array)
27 | # Numbers in Puppet are often string-encoded which is troublesome ...
28 | result = value.collect { |i| i.is_a?(String) ? i.chop : i }
29 | else
30 | result = value.chop
31 | end
32 |
33 | return result
34 | end
35 | end
36 |
37 | # vim: set ts=2 sw=2 et :
38 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/defined_with_params.rb:
--------------------------------------------------------------------------------
1 | # Test whether a given class or definition is defined
2 | require 'puppet/parser/functions'
3 |
4 | Puppet::Parser::Functions.newfunction(:defined_with_params,
5 | :type => :rvalue,
6 | :doc => <<-'ENDOFDOC'
7 | Takes a resource reference and an optional hash of attributes.
8 |
9 | Returns true if a resource with the specified attributes has already been added
10 | to the catalog, and false otherwise.
11 |
12 | user { 'dan':
13 | ensure => present,
14 | }
15 |
16 | if ! defined_with_params(User[dan], {'ensure' => 'present' }) {
17 | user { 'dan': ensure => present, }
18 | }
19 | ENDOFDOC
20 | ) do |vals|
21 | reference, params = vals
22 | raise(ArgumentError, 'Must specify a reference') unless reference
23 | if (! params) || params == ''
24 | params = {}
25 | end
26 | ret = false
27 | if resource = findresource(reference.to_s)
28 | matches = params.collect do |key, value|
29 | resource[key] == value
30 | end
31 | ret = params.empty? || !matches.include?(false)
32 | end
33 | Puppet.debug("Resource #{reference} was not determined to be defined")
34 | ret
35 | end
36 |
--------------------------------------------------------------------------------
/vagrant/files/etc/nginx/fastcgi_params:
--------------------------------------------------------------------------------
1 |
2 | fastcgi_param QUERY_STRING $query_string;
3 | fastcgi_param REQUEST_METHOD $request_method;
4 | fastcgi_param CONTENT_TYPE $content_type;
5 | fastcgi_param CONTENT_LENGTH $content_length;
6 |
7 | # fastcgi_param SCRIPT_NAME $fastcgi_script_name;
8 | fastcgi_param REQUEST_URI $request_uri;
9 | fastcgi_param DOCUMENT_URI $document_uri;
10 | fastcgi_param DOCUMENT_ROOT $document_root;
11 | fastcgi_param SERVER_PROTOCOL $server_protocol;
12 |
13 | fastcgi_param GATEWAY_INTERFACE CGI/1.1;
14 | fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
15 |
16 | fastcgi_param REMOTE_ADDR $remote_addr;
17 | fastcgi_param REMOTE_PORT $remote_port;
18 | fastcgi_param SERVER_ADDR $server_addr;
19 | fastcgi_param SERVER_PORT $server_port;
20 | fastcgi_param SERVER_NAME $server_name;
21 |
22 | # PHP only, required if PHP was built with --enable-force-cgi-redirect
23 | fastcgi_param REDIRECT_STATUS 200;
24 |
25 | fastcgi_connect_timeout 75;
26 | fastcgi_send_timeout 240;
27 | fastcgi_read_timeout 240;
28 | fastcgi_buffer_size 4k;
29 | fastcgi_buffers 256 4k;
30 | fastcgi_busy_buffers_size 8k;
31 | fastcgi_temp_file_write_size 8k;
32 | fastcgi_intercept_errors off;
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/manifests/vhost/redirect.pp:
--------------------------------------------------------------------------------
1 | # Define: apache::vhost::redirect
2 | #
3 | # This class will create a vhost that does nothing more than redirect to a
4 | # given location
5 | #
6 | # Parameters:
7 | # $port:
8 | # Which port to list on
9 | # $dest:
10 | # Where to redirect to
11 | # - $vhost_name
12 | #
13 | # Actions:
14 | # Installs apache and creates a vhost
15 | #
16 | # Requires:
17 | #
18 | # Sample Usage:
19 | #
20 | define apache::vhost::redirect (
21 | $port,
22 | $dest,
23 | $priority = '10',
24 | $serveraliases = '',
25 | $template = 'apache/vhost-redirect.conf.erb',
26 | $vhost_name = '*'
27 | ) {
28 |
29 | include apache
30 |
31 | $srvname = $name
32 |
33 | file { "${priority}-${name}.conf":
34 | path => "${apache::params::vdir}/${priority}-${name}.conf",
35 | content => template($template),
36 | owner => 'root',
37 | group => 'root',
38 | mode => '0755',
39 | require => Package['httpd'],
40 | notify => Service['httpd'],
41 | }
42 |
43 | if ! defined(Firewall["0100-INPUT ACCEPT $port"]) {
44 | @firewall {
45 | "0100-INPUT ACCEPT $port":
46 | jump => 'ACCEPT',
47 | dport => '$port',
48 | proto => 'tcp'
49 | }
50 | }
51 | }
52 |
53 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/num2bool.rb:
--------------------------------------------------------------------------------
1 | #
2 | # num2bool.rb
3 | #
4 |
5 | # TODO(Krzysztof Wilczynski): We probably need to approach numeric values differently ...
6 |
7 | module Puppet::Parser::Functions
8 | newfunction(:num2bool, :type => :rvalue, :doc => <<-EOS
9 | This function converts a number into a true boolean. Zero becomes false. Numbers
10 | higher then 0 become true.
11 | EOS
12 | ) do |arguments|
13 |
14 | raise(Puppet::ParseError, "num2bool(): Wrong number of arguments " +
15 | "given (#{arguments.size} for 1)") if arguments.size < 1
16 |
17 | number = arguments[0]
18 |
19 | # Only numbers allowed ...
20 | unless number.match(/^\-?\d+$/)
21 | raise(Puppet::ParseError, 'num2bool(): Requires integer to work with')
22 | end
23 |
24 | result = case number
25 | when /^0$/
26 | false
27 | when /^\-?\d+$/
28 | # Numbers in Puppet are often string-encoded which is troublesome ...
29 | number = number.to_i
30 | # We yield true for any positive number and false otherwise ...
31 | number > 0 ? true : false
32 | else
33 | raise(Puppet::ParseError, 'num2bool(): Unknown numeric format given')
34 | end
35 |
36 | return result
37 | end
38 | end
39 |
40 | # vim: set ts=2 sw=2 et :
41 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/unique.rb:
--------------------------------------------------------------------------------
1 | #
2 | # unique.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:unique, :type => :rvalue, :doc => <<-EOS
7 | This function will remove duplicates from strings and arrays.
8 |
9 | *Examples:*
10 |
11 | unique("aabbcc")
12 |
13 | Will return:
14 |
15 | abc
16 |
17 | You can also use this with arrays:
18 |
19 | unique(["a","a","b","b","c","c"])
20 |
21 | This returns:
22 |
23 | ["a","b","c"]
24 | EOS
25 | ) do |arguments|
26 |
27 | raise(Puppet::ParseError, "unique(): Wrong number of arguments " +
28 | "given (#{arguments.size} for 1)") if arguments.size < 1
29 |
30 | value = arguments[0]
31 | klass = value.class
32 |
33 | unless [Array, String].include?(klass)
34 | raise(Puppet::ParseError, 'unique(): Requires either ' +
35 | 'array or string to work with')
36 | end
37 |
38 | result = value.clone
39 |
40 | string = value.is_a?(String) ? true : false
41 |
42 | # We turn any string value into an array to be able to shuffle ...
43 | result = string ? result.split('') : result
44 | result = result.uniq # Remove duplicates ...
45 | result = string ? result.join : result
46 |
47 | return result
48 | end
49 | end
50 |
51 | # vim: set ts=2 sw=2 et :
52 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/time.rb:
--------------------------------------------------------------------------------
1 | #
2 | # time.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:time, :type => :rvalue, :doc => <<-EOS
7 | This function will return the current time since epoch as an integer.
8 |
9 | *Examples:*
10 |
11 | time()
12 |
13 | Will return something like: 1311972653
14 | EOS
15 | ) do |arguments|
16 |
17 | # The Time Zone argument is optional ...
18 | time_zone = arguments[0] if arguments[0]
19 |
20 | if (arguments.size != 0) and (arguments.size != 1) then
21 | raise(Puppet::ParseError, "time(): Wrong number of arguments "+
22 | "given #{arguments.size} for 0 or 1")
23 | end
24 |
25 | time = Time.new
26 |
27 | # There is probably a better way to handle Time Zone ...
28 | if time_zone and not time_zone.empty?
29 | original_zone = ENV['TZ']
30 |
31 | local_time = time.clone
32 | local_time = local_time.utc
33 |
34 | ENV['TZ'] = time_zone
35 |
36 | time = local_time.localtime
37 |
38 | ENV['TZ'] = original_zone
39 | end
40 |
41 | # Calling Time#to_i on a receiver changes it. Trust me I am the Doctor.
42 | result = time.strftime('%s')
43 | result = result.to_i
44 |
45 | return result
46 | end
47 | end
48 |
49 | # vim: set ts=2 sw=2 et :
50 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/delete.rb:
--------------------------------------------------------------------------------
1 | #
2 | # delete.rb
3 | #
4 |
5 | # TODO(Krzysztof Wilczynski): We need to add support for regular expression ...
6 |
7 | module Puppet::Parser::Functions
8 | newfunction(:delete, :type => :rvalue, :doc => <<-EOS
9 | Deletes all instances of a given element from an array, substring from a
10 | string, or key from a hash.
11 |
12 | *Examples:*
13 |
14 | delete(['a','b','c','b'], 'b')
15 | Would return: ['a','c']
16 |
17 | delete({'a'=>1,'b'=>2,'c'=>3}, 'b')
18 | Would return: {'a'=>1,'c'=>3}
19 |
20 | delete('abracadabra', 'bra')
21 | Would return: 'acada'
22 | EOS
23 | ) do |arguments|
24 |
25 | if (arguments.size != 2) then
26 | raise(Puppet::ParseError, "delete(): Wrong number of arguments "+
27 | "given #{arguments.size} for 2.")
28 | end
29 |
30 | collection = arguments[0]
31 | item = arguments[1]
32 |
33 | case collection
34 | when Array, Hash
35 | collection.delete item
36 | when String
37 | collection.gsub! item, ''
38 | else
39 | raise(TypeError, "delete(): First argument must be an Array, " +
40 | "String, or Hash. Given an argument of class #{collection.class}.")
41 | end
42 | collection
43 | end
44 | end
45 |
46 | # vim: set ts=2 sw=2 et :
47 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/has_ip_address_spec.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe Puppet::Parser::Functions.function(:has_ip_address) do
5 |
6 | let(:scope) do
7 | PuppetlabsSpec::PuppetInternals.scope
8 | end
9 |
10 | subject do
11 | function_name = Puppet::Parser::Functions.function(:has_ip_address)
12 | scope.method(function_name)
13 | end
14 |
15 | context "On Linux Systems" do
16 | before :each do
17 | scope.stubs(:lookupvar).with('interfaces').returns('eth0,lo')
18 | scope.stubs(:lookupvar).with('ipaddress').returns('10.0.2.15')
19 | scope.stubs(:lookupvar).with('ipaddress_eth0').returns('10.0.2.15')
20 | scope.stubs(:lookupvar).with('ipaddress_lo').returns('127.0.0.1')
21 | end
22 |
23 | it 'should have primary address (10.0.2.15)' do
24 | subject.call(['10.0.2.15']).should be_true
25 | end
26 |
27 | it 'should have lookupback address (127.0.0.1)' do
28 | subject.call(['127.0.0.1']).should be_true
29 | end
30 |
31 | it 'should not have other address' do
32 | subject.call(['192.1681.1.1']).should be_false
33 | end
34 |
35 | it 'should not have "mspiggy" on an interface' do
36 | subject.call(['mspiggy']).should be_false
37 | end
38 | end
39 | end
40 |
--------------------------------------------------------------------------------
/app/config/security.yml:
--------------------------------------------------------------------------------
1 | security:
2 | encoders:
3 | Symfony\Component\Security\Core\User\User: plaintext
4 |
5 | role_hierarchy:
6 | ROLE_ADMIN: ROLE_USER
7 | ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
8 |
9 | providers:
10 | in_memory:
11 | memory:
12 | users:
13 | user: { password: userpass, roles: [ 'ROLE_USER' ] }
14 | admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] }
15 |
16 | firewalls:
17 | dev:
18 | pattern: ^/(_(profiler|wdt)|css|images|js)/
19 | security: false
20 |
21 | login:
22 | pattern: ^/demo/secured/login$
23 | security: false
24 |
25 | secured_area:
26 | pattern: ^/demo/secured/
27 | form_login:
28 | check_path: _security_check
29 | login_path: _demo_login
30 | logout:
31 | path: _demo_logout
32 | target: _demo
33 | #anonymous: ~
34 | #http_basic:
35 | # realm: "Secured Demo Area"
36 | access_control:
37 | - { path: ^/demo/secured/hello/admin/, roles: ROLE_ADMIN }
38 | #- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https }
39 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/type.rb:
--------------------------------------------------------------------------------
1 | #
2 | # type.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:type, :type => :rvalue, :doc => <<-EOS
7 | Returns the type when passed a variable. Type can be one of:
8 |
9 | * string
10 | * array
11 | * hash
12 | * float
13 | * integer
14 | * boolean
15 | EOS
16 | ) do |arguments|
17 |
18 | raise(Puppet::ParseError, "type(): Wrong number of arguments " +
19 | "given (#{arguments.size} for 1)") if arguments.size < 1
20 |
21 | value = arguments[0]
22 |
23 | klass = value.class
24 |
25 | if not [TrueClass, FalseClass, Array, Bignum, Fixnum, Float, Hash, String].include?(klass)
26 | raise(Puppet::ParseError, 'type(): Unknown type')
27 | end
28 |
29 | klass = klass.to_s # Ugly ...
30 |
31 | # We note that Integer is the parent to Bignum and Fixnum ...
32 | result = case klass
33 | when /^(?:Big|Fix)num$/ then 'integer'
34 | when /^(?:True|False)Class$/ then 'boolean'
35 | else klass
36 | end
37 |
38 | if result == "String" then
39 | if value == value.to_i.to_s then
40 | result = "Integer"
41 | elsif value == value.to_f.to_s then
42 | result = "Float"
43 | end
44 | end
45 |
46 | return result.downcase
47 | end
48 | end
49 |
50 | # vim: set ts=2 sw=2 et :
51 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/shuffle.rb:
--------------------------------------------------------------------------------
1 | #
2 | # shuffle.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:shuffle, :type => :rvalue, :doc => <<-EOS
7 | Randomizes the order of a string or array elements.
8 | EOS
9 | ) do |arguments|
10 |
11 | raise(Puppet::ParseError, "shuffle(): Wrong number of arguments " +
12 | "given (#{arguments.size} for 1)") if arguments.size < 1
13 |
14 | value = arguments[0]
15 | klass = value.class
16 |
17 | unless [Array, String].include?(klass)
18 | raise(Puppet::ParseError, 'shuffle(): Requires either ' +
19 | 'array or string to work with')
20 | end
21 |
22 | result = value.clone
23 |
24 | string = value.is_a?(String) ? true : false
25 |
26 | # Check whether it makes sense to shuffle ...
27 | return result if result.size <= 1
28 |
29 | # We turn any string value into an array to be able to shuffle ...
30 | result = string ? result.split('') : result
31 |
32 | elements = result.size
33 |
34 | # Simple implementation of Fisher–Yates in-place shuffle ...
35 | elements.times do |i|
36 | j = rand(elements - i) + i
37 | result[j], result[i] = result[i], result[j]
38 | end
39 |
40 | result = string ? result.join : result
41 |
42 | return result
43 | end
44 | end
45 |
46 | # vim: set ts=2 sw=2 et :
47 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/fqdn_rotate.rb:
--------------------------------------------------------------------------------
1 | #
2 | # fqdn_rotate.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:fqdn_rotate, :type => :rvalue, :doc => <<-EOS
7 | Rotates an array a random number of times based on a nodes fqdn.
8 | EOS
9 | ) do |arguments|
10 |
11 | raise(Puppet::ParseError, "fqdn_rotate(): Wrong number of arguments " +
12 | "given (#{arguments.size} for 1)") if arguments.size < 1
13 |
14 | value = arguments[0]
15 | klass = value.class
16 | require 'digest/md5'
17 |
18 | unless [Array, String].include?(klass)
19 | raise(Puppet::ParseError, 'fqdn_rotate(): Requires either ' +
20 | 'array or string to work with')
21 | end
22 |
23 | result = value.clone
24 |
25 | string = value.is_a?(String) ? true : false
26 |
27 | # Check whether it makes sense to rotate ...
28 | return result if result.size <= 1
29 |
30 | # We turn any string value into an array to be able to rotate ...
31 | result = string ? result.split('') : result
32 |
33 | elements = result.size
34 |
35 | srand(Digest::MD5.hexdigest([lookupvar('::fqdn'),arguments].join(':')).hex)
36 | rand(elements).times {
37 | result.push result.shift
38 | }
39 |
40 | result = string ? result.join : result
41 |
42 | return result
43 | end
44 | end
45 |
46 | # vim: set ts=2 sw=2 et :
47 |
--------------------------------------------------------------------------------
/vagrant/puppet/app/webserver/nginx.pp:
--------------------------------------------------------------------------------
1 | class app::webserver::nginx {
2 | package {"nginx":
3 | ensure => latest,
4 | }
5 |
6 | package {"httpd":
7 | ensure => purged,
8 | }
9 |
10 | service {"nginx":
11 | ensure => running,
12 | hasrestart => true,
13 | hasstatus => true,
14 | require => [Package["nginx"], Package["httpd"]],
15 | }
16 |
17 | file {"/etc/nginx/vhosts.d":
18 | ensure => directory,
19 | owner => root,
20 | group => root,
21 | recurse => true,
22 | require => Package["nginx"],
23 | }
24 |
25 | file {"/etc/nginx/fastcgi_params":
26 | owner => root,
27 | group => root,
28 | source => "/vagrant/files/etc/nginx/fastcgi_params",
29 | require => Package["nginx"],
30 | notify => Service["nginx"],
31 | }
32 |
33 | file {"/etc/nginx/nginx.conf":
34 | owner => root,
35 | group => root,
36 | source => "/vagrant/files/etc/nginx/nginx.conf",
37 | require => Package["nginx"],
38 | notify => Service["nginx"],
39 | }
40 |
41 | file {"/etc/nginx/vhosts.d/$vhost.dev.conf":
42 | owner => root,
43 | group => root,
44 | content => template("/vagrant/files/etc/nginx/vhosts.d/app.dev.conf"),
45 | require => Package["nginx"],
46 | notify => Service["nginx"],
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_ip_address_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the is_ip_address function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 |
7 | it "should exist" do
8 | Puppet::Parser::Functions.function("is_ip_address").should == "function_is_ip_address"
9 | end
10 |
11 | it "should raise a ParseError if there is less than 1 arguments" do
12 | lambda { scope.function_is_ip_address([]) }.should( raise_error(Puppet::ParseError))
13 | end
14 |
15 | it "should return true if an IPv4 address" do
16 | result = scope.function_is_ip_address(["1.2.3.4"])
17 | result.should(eq(true))
18 | end
19 |
20 | it "should return true if a full IPv6 address" do
21 | result = scope.function_is_ip_address(["fe80:0000:cd12:d123:e2f8:47ff:fe09:dd74"])
22 | result.should(eq(true))
23 | end
24 |
25 | it "should return true if a compressed IPv6 address" do
26 | result = scope.function_is_ip_address(["fe00::1"])
27 | result.should(eq(true))
28 | end
29 |
30 | it "should return false if not valid" do
31 | result = scope.function_is_ip_address(["asdf"])
32 | result.should(eq(false))
33 | end
34 |
35 | it "should return false if IP octets out of range" do
36 | result = scope.function_is_ip_address(["1.1.1.300"])
37 | result.should(eq(false))
38 | end
39 | end
40 |
--------------------------------------------------------------------------------
/UPGRADE-2.2.md:
--------------------------------------------------------------------------------
1 | UPGRADE FROM 2.1 to 2.2
2 | =======================
3 |
4 | * The [`web/.htaccess`](https://github.com/symfony/symfony-standard/blob/2.2/web/.htaccess)
5 | file has been enhanced substantially to prevent duplicate content with and
6 | without `/app.php` in the URI. It also improves functionality when using
7 | Apache aliases or when mod_rewrite is not available. So you might want to
8 | update your `.htaccess` file as well.
9 |
10 | * The ``_internal`` route is not used any more. It should then be removed
11 | from both your routing and security configurations. A ``fragments`` key has
12 | been added to the framework configuration and must be specified when ESI or
13 | Hinclude are in use. No security configuration is required for this path as
14 | by default ESI access is only permitted for trusted hosts and Hinclude
15 | access uses an URL signing mechanism.
16 |
17 | ```
18 | framework:
19 | # ...
20 | fragments: { path: /_proxy }
21 | ```
22 |
23 | Functional Tests
24 | ----------------
25 |
26 | * The profiler has been disabled by default in the test environment. You can
27 | enable it again by modifying the ``config_test.yml`` configuration file or
28 | even better, you can just enable it for the very next request by calling
29 | ``$client->enableProfiler()`` when you need the profiler in a test (that
30 | speeds up functional tests quite a bit).
31 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/str2bool.rb:
--------------------------------------------------------------------------------
1 | #
2 | # str2bool.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:str2bool, :type => :rvalue, :doc => <<-EOS
7 | This converts a string to a boolean. This attempt to convert strings that
8 | contain things like: y, 1, t, true to 'true' and strings that contain things
9 | like: 0, f, n, false, no to 'false'.
10 | EOS
11 | ) do |arguments|
12 |
13 | raise(Puppet::ParseError, "str2bool(): Wrong number of arguments " +
14 | "given (#{arguments.size} for 1)") if arguments.size < 1
15 |
16 | string = arguments[0]
17 |
18 | unless string.is_a?(String)
19 | raise(Puppet::ParseError, 'str2bool(): Requires either ' +
20 | 'string to work with')
21 | end
22 |
23 | # We consider all the yes, no, y, n and so on too ...
24 | result = case string
25 | #
26 | # This is how undef looks like in Puppet ...
27 | # We yield false in this case.
28 | #
29 | when /^$/, '' then false # Empty string will be false ...
30 | when /^(1|t|y|true|yes)$/ then true
31 | when /^(0|f|n|false|no)$/ then false
32 | when /^(undef|undefined)$/ then false # This is not likely to happen ...
33 | else
34 | raise(Puppet::ParseError, 'str2bool(): Unknown type of boolean given')
35 | end
36 |
37 | return result
38 | end
39 | end
40 |
41 | # vim: set ts=2 sw=2 et :
42 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/delete_at.rb:
--------------------------------------------------------------------------------
1 | #
2 | # delete_at.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:delete_at, :type => :rvalue, :doc => <<-EOS
7 | Deletes a determined indexed value from an array.
8 |
9 | *Examples:*
10 |
11 | delete_at(['a','b','c'], 1)
12 |
13 | Would return: ['a','c']
14 | EOS
15 | ) do |arguments|
16 |
17 | raise(Puppet::ParseError, "delete_at(): Wrong number of arguments " +
18 | "given (#{arguments.size} for 2)") if arguments.size < 2
19 |
20 | array = arguments[0]
21 |
22 | unless array.is_a?(Array)
23 | raise(Puppet::ParseError, 'delete_at(): Requires array to work with')
24 | end
25 |
26 | index = arguments[1]
27 |
28 | if index.is_a?(String) and not index.match(/^\d+$/)
29 | raise(Puppet::ParseError, 'delete_at(): You must provide ' +
30 | 'non-negative numeric index')
31 | end
32 |
33 | result = array.clone
34 |
35 | # Numbers in Puppet are often string-encoded which is troublesome ...
36 | index = index.to_i
37 |
38 | if index > result.size - 1 # First element is at index 0 is it not?
39 | raise(Puppet::ParseError, 'delete_at(): Given index ' +
40 | 'exceeds size of array given')
41 | end
42 |
43 | result.delete_at(index) # We ignore the element that got deleted ...
44 |
45 | return result
46 | end
47 | end
48 |
49 | # vim: set ts=2 sw=2 et :
50 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/size.rb:
--------------------------------------------------------------------------------
1 | #
2 | # size.rb
3 | #
4 |
5 | # TODO(Krzysztof Wilczynski): Support for hashes would be nice too ...
6 |
7 | module Puppet::Parser::Functions
8 | newfunction(:size, :type => :rvalue, :doc => <<-EOS
9 | Returns the number of elements in a string or array.
10 | EOS
11 | ) do |arguments|
12 |
13 | raise(Puppet::ParseError, "size(): Wrong number of arguments " +
14 | "given (#{arguments.size} for 1)") if arguments.size < 1
15 |
16 | item = arguments[0]
17 |
18 | if item.is_a?(String)
19 |
20 | begin
21 | #
22 | # Check whether your item is a numeric value or not ...
23 | # This will take care about positive and/or negative numbers
24 | # for both integer and floating-point values ...
25 | #
26 | # Please note that Puppet has no notion of hexadecimal
27 | # nor octal numbers for its DSL at this point in time ...
28 | #
29 | Float(item)
30 |
31 | raise(Puppet::ParseError, 'size(): Requires either ' +
32 | 'string or array to work with')
33 |
34 | rescue ArgumentError
35 | result = item.size
36 | end
37 |
38 | elsif item.is_a?(Array)
39 | result = item.size
40 | else
41 | raise(Puppet::ParseError, 'size(): Unknown type given')
42 | end
43 |
44 | return result
45 | end
46 | end
47 |
48 | # vim: set ts=2 sw=2 et :
49 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/apache/spec/classes/apache_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'apache', :type => :class do
4 | context "On a Debian OS" do
5 | let :facts do
6 | { :osfamily => 'Debian' }
7 | end
8 | it { should include_class("apache::params") }
9 | it { should contain_package("httpd") }
10 | it { should contain_service("httpd").with(
11 | 'ensure' => 'running',
12 | 'enable' => 'true',
13 | 'subscribe' => 'Package[httpd]'
14 | )
15 | }
16 | it { should contain_file("httpd_vdir").with(
17 | 'ensure' => 'directory',
18 | 'recurse' => 'true',
19 | 'purge' => 'true',
20 | 'notify' => 'Service[httpd]',
21 | 'require' => 'Package[httpd]'
22 | )
23 | }
24 | end
25 | context "On a RedHat OS" do
26 | let :facts do
27 | { :osfamily => 'RedHat' }
28 | end
29 | it { should include_class("apache::params") }
30 | it { should contain_package("httpd") }
31 | it { should contain_service("httpd").with(
32 | 'ensure' => 'running',
33 | 'enable' => 'true',
34 | 'subscribe' => 'Package[httpd]'
35 | )
36 | }
37 | it { should contain_file("httpd_vdir").with(
38 | 'ensure' => 'directory',
39 | 'recurse' => 'true',
40 | 'purge' => 'true',
41 | 'notify' => 'Service[httpd]',
42 | 'require' => 'Package[httpd]'
43 | )
44 | }
45 | end
46 | end
47 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/facter/pe_version.rb:
--------------------------------------------------------------------------------
1 | # Fact: is_pe, pe_version, pe_major_version, pe_minor_version, pe_patch_version
2 | #
3 | # Purpose: Return various facts about the PE state of the system
4 | #
5 | # Resolution: Uses a regex match against puppetversion to determine whether the
6 | # machine has Puppet Enterprise installed, and what version (overall, major,
7 | # minor, patch) is installed.
8 | #
9 | # Caveats:
10 | #
11 | Facter.add("pe_version") do
12 | setcode do
13 | pe_ver = Facter.value("puppetversion").match(/Puppet Enterprise (\d+\.\d+\.\d+)/)
14 | pe_ver[1] if pe_ver
15 | end
16 | end
17 |
18 | Facter.add("is_pe") do
19 | setcode do
20 | if Facter.value(:pe_version).to_s.empty? then
21 | false
22 | else
23 | true
24 | end
25 | end
26 | end
27 |
28 | Facter.add("pe_major_version") do
29 | confine :is_pe => true
30 | setcode do
31 | if pe_version = Facter.value(:pe_version)
32 | pe_version.to_s.split('.')[0]
33 | end
34 | end
35 | end
36 |
37 | Facter.add("pe_minor_version") do
38 | confine :is_pe => true
39 | setcode do
40 | if pe_version = Facter.value(:pe_version)
41 | pe_version.to_s.split('.')[1]
42 | end
43 | end
44 | end
45 |
46 | Facter.add("pe_patch_version") do
47 | confine :is_pe => true
48 | setcode do
49 | if pe_version = Facter.value(:pe_version)
50 | pe_version.to_s.split('.')[2]
51 | end
52 | end
53 | end
54 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/ensure_resource.rb:
--------------------------------------------------------------------------------
1 | # Test whether a given class or definition is defined
2 | require 'puppet/parser/functions'
3 |
4 | Puppet::Parser::Functions.newfunction(:ensure_resource,
5 | :type => :statement,
6 | :doc => <<-'ENDOFDOC'
7 | Takes a resource type, title, and a list of attributes that describe a
8 | resource.
9 |
10 | user { 'dan':
11 | ensure => present,
12 | }
13 |
14 | This example only creates the resource if it does not already exist:
15 |
16 | ensure_resource('user, 'dan', {'ensure' => 'present' })
17 |
18 | If the resource already exists but does not match the specified parameters,
19 | this function will attempt to recreate the resource leading to a duplicate
20 | resource definition error.
21 |
22 | ENDOFDOC
23 | ) do |vals|
24 | type, title, params = vals
25 | raise(ArgumentError, 'Must specify a type') unless type
26 | raise(ArgumentError, 'Must specify a title') unless title
27 | params ||= {}
28 | Puppet::Parser::Functions.function(:defined_with_params)
29 | if function_defined_with_params(["#{type}[#{title}]", params])
30 | Puppet.debug("Resource #{type}[#{title}] not created b/c it already exists")
31 | else
32 | Puppet::Parser::Functions.function(:create_resources)
33 | function_create_resources([type.capitalize, { title => params }])
34 | end
35 | end
36 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/is_domain_name.rb:
--------------------------------------------------------------------------------
1 | #
2 | # is_domain_name.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:is_domain_name, :type => :rvalue, :doc => <<-EOS
7 | Returns true if the string passed to this function is a syntactically correct domain name.
8 | EOS
9 | ) do |arguments|
10 |
11 | if (arguments.size != 1) then
12 | raise(Puppet::ParseError, "is_domain_name(): Wrong number of arguments "+
13 | "given #{arguments.size} for 1")
14 | end
15 |
16 | domain = arguments[0]
17 |
18 | # Limits (rfc1035, 3.1)
19 | domain_max_length=255
20 | label_min_length=1
21 | label_max_length=63
22 |
23 | # Allow ".", it is the top level domain
24 | return true if domain == '.'
25 |
26 | # Remove the final dot, if present.
27 | domain.chomp!('.')
28 |
29 | # Check the whole domain
30 | return false if domain.empty?
31 | return false if domain.length > domain_max_length
32 |
33 | # Check each label in the domain
34 | labels = domain.split('.')
35 | vlabels = labels.each do |label|
36 | break if label.length < label_min_length
37 | break if label.length > label_max_length
38 | break if label[-1..-1] == '-'
39 | break if label[0..0] == '-'
40 | break unless /^[a-z\d-]+$/i.match(label)
41 | end
42 | return vlabels == labels
43 |
44 | end
45 | end
46 |
47 | # vim: set ts=2 sw=2 et :
48 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/lib/puppet/provider/database/mysql.rb:
--------------------------------------------------------------------------------
1 | Puppet::Type.type(:database).provide(:mysql) do
2 |
3 | desc "Manages MySQL database."
4 |
5 | defaultfor :kernel => 'Linux'
6 |
7 | optional_commands :mysql => 'mysql'
8 | optional_commands :mysqladmin => 'mysqladmin'
9 |
10 | def self.instances
11 | mysql("--defaults-file=#{Facter.value(:root_home)}/.my.cnf", '-NBe', "show databases").split("\n").collect do |name|
12 | new(:name => name)
13 | end
14 | end
15 |
16 | def create
17 | mysql("--defaults-file=#{Facter.value(:root_home)}/.my.cnf", '-NBe', "create database `#{@resource[:name]}` character set #{resource[:charset]}")
18 | end
19 |
20 | def destroy
21 | mysqladmin("--defaults-file=#{Facter.value(:root_home)}/.my.cnf", '-f', 'drop', @resource[:name])
22 | end
23 |
24 | def charset
25 | mysql("--defaults-file=#{Facter.value(:root_home)}/.my.cnf", '-NBe', "show create database `#{resource[:name]}`").match(/.*?(\S+)\s\*\//)[1]
26 | end
27 |
28 | def charset=(value)
29 | mysql("--defaults-file=#{Facter.value(:root_home)}/.my.cnf", '-NBe', "alter database `#{resource[:name]}` CHARACTER SET #{value}")
30 | end
31 |
32 | def exists?
33 | begin
34 | mysql("--defaults-file=#{Facter.value(:root_home)}/.my.cnf", '-NBe', "show databases").match(/^#{@resource[:name]}$/)
35 | rescue => e
36 | debug(e.message)
37 | return nil
38 | end
39 | end
40 |
41 | end
42 |
43 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/spec/unit/puppet/parser/functions/type_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 | require 'spec_helper'
3 |
4 | describe "the type function" do
5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6 | it "should exist" do
7 | Puppet::Parser::Functions.function("type").should == "function_type"
8 | end
9 |
10 | it "should raise a ParseError if there is less than 1 arguments" do
11 | lambda { scope.function_type([]) }.should( raise_error(Puppet::ParseError))
12 | end
13 |
14 | it "should return string when given a string" do
15 | result = scope.function_type(["aaabbbbcccc"])
16 | result.should(eq('string'))
17 | end
18 |
19 | it "should return array when given an array" do
20 | result = scope.function_type([["aaabbbbcccc","asdf"]])
21 | result.should(eq('array'))
22 | end
23 |
24 | it "should return hash when given a hash" do
25 | result = scope.function_type([{"a"=>1,"b"=>2}])
26 | result.should(eq('hash'))
27 | end
28 |
29 | it "should return integer when given an integer" do
30 | result = scope.function_type(["1"])
31 | result.should(eq('integer'))
32 | end
33 |
34 | it "should return float when given a float" do
35 | result = scope.function_type(["1.34"])
36 | result.should(eq('float'))
37 | end
38 |
39 | it "should return boolean when given a boolean" do
40 | result = scope.function_type([true])
41 | result.should(eq('boolean'))
42 | end
43 | end
44 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/stdlib/lib/puppet/parser/functions/has_interface_with.rb:
--------------------------------------------------------------------------------
1 | #
2 | # has_interface_with
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:has_interface_with, :type => :rvalue, :doc => <<-EOS
7 | Returns boolean based on kind and value:
8 | * macaddress
9 | * netmask
10 | * ipaddress
11 | * network
12 |
13 | has_interface_with("macaddress", "x:x:x:x:x:x")
14 | has_interface_with("ipaddress", "127.0.0.1") => true
15 | etc.
16 |
17 | If no "kind" is given, then the presence of the interface is checked:
18 | has_interface_with("lo") => true
19 | EOS
20 | ) do |args|
21 |
22 | raise(Puppet::ParseError, "has_interface_with(): Wrong number of arguments " +
23 | "given (#{args.size} for 1 or 2)") if args.size < 1 or args.size > 2
24 |
25 | interfaces = lookupvar('interfaces')
26 |
27 | # If we do not have any interfaces, then there are no requested attributes
28 | return false if (interfaces == :undefined)
29 |
30 | interfaces = interfaces.split(',')
31 |
32 | if args.size == 1
33 | return interfaces.member?(args[0])
34 | end
35 |
36 | kind, value = args
37 |
38 | if lookupvar(kind) == value
39 | return true
40 | end
41 |
42 | result = false
43 | interfaces.each do |iface|
44 | if value == lookupvar("#{kind}_#{iface}")
45 | result = true
46 | break
47 | end
48 | end
49 |
50 | result
51 | end
52 | end
53 |
--------------------------------------------------------------------------------
/vagrant/puppet/modules/mysql/spec/classes/mysql_init_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'mysql' do
4 |
5 | describe 'on a debian based os' do
6 | let :facts do
7 | { :osfamily => 'Debian'}
8 | end
9 | it { should contain_package('mysql_client').with(
10 | :name => 'mysql-client',
11 | :ensure => 'present'
12 | )}
13 | end
14 |
15 | describe 'on a freebsd based os' do
16 | let :facts do
17 | { :osfamily => 'FreeBSD'}
18 | end
19 | it { should contain_package('mysql_client').with(
20 | :name => 'databases/mysql55-client',
21 | :ensure => 'present'
22 | )}
23 | end
24 |
25 | describe 'on a redhat based os' do
26 | let :facts do
27 | {:osfamily => 'Redhat'}
28 | end
29 | it { should contain_package('mysql_client').with(
30 | :name => 'mysql',
31 | :ensure => 'present'
32 | )}
33 | describe 'when parameters are supplied' do
34 | let :params do
35 | {:package_ensure => 'latest', :package_name => 'mysql_client'}
36 | end
37 | it { should contain_package('mysql_client').with(
38 | :name => 'mysql_client',
39 | :ensure => 'latest'
40 | )}
41 | end
42 | end
43 |
44 | describe 'on any other os' do
45 | let :facts do
46 | {:osfamily => 'foo'}
47 | end
48 |
49 | it 'should fail' do
50 | expect { subject }.to raise_error(/Unsupported osfamily: foo/)
51 | end
52 | end
53 |
54 | end
55 |
--------------------------------------------------------------------------------