├── .gitignore
├── README.md
├── Vagrantfile
├── app
├── .htaccess
├── AppCache.php
├── AppKernel.php
├── Resources
│ └── views
│ │ └── base.html.twig
├── SymfonyRequirements.php
├── autoload.php
├── check.php
├── config
│ ├── config.yml
│ ├── config_dev.yml
│ ├── config_prod.yml
│ ├── config_test.yml
│ ├── parameters.yml.dist
│ ├── routing.yml
│ ├── routing_dev.yml
│ └── security.yml
└── console
├── behat.yml
├── composer.json
├── composer.lock
├── features
├── manager_can_create_a_project.feature
├── manager_can_list_his_project_sprints.feature
├── manager_can_list_his_projects.feature
├── manager_can_schedule_a_project_sprint.feature
└── sprint_ceremonies_are_autoscheduled.feature
├── manifests
└── default.pp
├── modules
├── apache
│ ├── .fixtures.yml
│ ├── .gemfile
│ ├── .project
│ ├── .travis.yml
│ ├── Modulefile
│ ├── README.md
│ ├── Rakefile
│ ├── manifests
│ │ ├── dotconf.pp
│ │ ├── htpasswd.pp
│ │ ├── init.pp
│ │ ├── module.pp
│ │ ├── params.pp
│ │ ├── passenger.pp
│ │ ├── redhat.pp
│ │ ├── spec.pp
│ │ ├── ssl.pp
│ │ ├── vhost.pp
│ │ └── virtualhost.pp
│ ├── spec
│ │ ├── classes
│ │ │ └── apache_spec.rb
│ │ ├── defines
│ │ │ └── apache_virtualhost_spec.rb
│ │ └── spec_helper.rb
│ ├── templates
│ │ ├── 00-NameVirtualHost.conf.erb
│ │ ├── module
│ │ │ └── proxy.conf.erb
│ │ ├── spec.erb
│ │ └── virtualhost
│ │ │ ├── vhost.conf.erb
│ │ │ └── virtualhost.conf.erb
│ └── tests
│ │ └── vhost.pp
├── apt
│ ├── .fixtures.yml
│ ├── .gemfile
│ ├── .travis.yml
│ ├── CHANGELOG
│ ├── LICENSE
│ ├── Modulefile
│ ├── README.md
│ ├── Rakefile
│ ├── manifests
│ │ ├── backports.pp
│ │ ├── builddep.pp
│ │ ├── conf.pp
│ │ ├── debian
│ │ │ ├── testing.pp
│ │ │ └── unstable.pp
│ │ ├── force.pp
│ │ ├── init.pp
│ │ ├── key.pp
│ │ ├── params.pp
│ │ ├── pin.pp
│ │ ├── ppa.pp
│ │ ├── release.pp
│ │ ├── source.pp
│ │ └── update.pp
│ ├── spec
│ │ ├── classes
│ │ │ ├── apt_spec.rb
│ │ │ ├── backports_spec.rb
│ │ │ ├── debian_testing_spec.rb
│ │ │ ├── debian_unstable_spec.rb
│ │ │ ├── params_spec.rb
│ │ │ └── release_spec.rb
│ │ ├── defines
│ │ │ ├── builddep_spec.rb
│ │ │ ├── conf_spec.rb
│ │ │ ├── force_spec.rb
│ │ │ ├── key_spec.rb
│ │ │ ├── pin_spec.rb
│ │ │ ├── ppa_spec.rb
│ │ │ └── source_spec.rb
│ │ ├── fixtures
│ │ │ └── manifests
│ │ │ │ └── site.pp
│ │ └── spec_helper.rb
│ ├── templates
│ │ ├── pin.pref.erb
│ │ └── source.list.erb
│ └── tests
│ │ ├── builddep.pp
│ │ ├── debian
│ │ ├── testing.pp
│ │ └── unstable.pp
│ │ ├── force.pp
│ │ ├── init.pp
│ │ ├── key.pp
│ │ ├── params.pp
│ │ ├── pin.pp
│ │ ├── ppa.pp
│ │ ├── release.pp
│ │ └── source.pp
├── composer
│ ├── LICENSE
│ ├── README.md
│ └── manifests
│ │ ├── init.pp
│ │ ├── params.pp
│ │ └── run.pp
├── mysql
│ ├── .fixtures.yml
│ ├── .nodeset.yml
│ ├── .travis.yml
│ ├── CHANGELOG
│ ├── Gemfile
│ ├── LICENSE
│ ├── Modulefile
│ ├── README.md
│ ├── Rakefile
│ ├── TODO
│ ├── files
│ │ └── mysqltuner.pl
│ ├── lib
│ │ └── puppet
│ │ │ ├── parser
│ │ │ └── functions
│ │ │ │ └── mysql_password.rb
│ │ │ ├── provider
│ │ │ ├── database
│ │ │ │ └── mysql.rb
│ │ │ ├── database_grant
│ │ │ │ └── mysql.rb
│ │ │ └── database_user
│ │ │ │ └── mysql.rb
│ │ │ └── type
│ │ │ ├── database.rb
│ │ │ ├── database_grant.rb
│ │ │ └── database_user.rb
│ ├── manifests
│ │ ├── backup.pp
│ │ ├── config.pp
│ │ ├── db.pp
│ │ ├── init.pp
│ │ ├── java.pp
│ │ ├── params.pp
│ │ ├── perl.pp
│ │ ├── php.pp
│ │ ├── python.pp
│ │ ├── ruby.pp
│ │ ├── server.pp
│ │ └── server
│ │ │ ├── account_security.pp
│ │ │ ├── config.pp
│ │ │ ├── monitor.pp
│ │ │ └── mysqltuner.pp
│ ├── spec
│ │ ├── classes
│ │ │ ├── mysql_backup_spec.rb
│ │ │ ├── mysql_config_spec.rb
│ │ │ ├── mysql_init_spec.rb
│ │ │ ├── mysql_java_spec.rb
│ │ │ ├── mysql_perl_spec.rb
│ │ │ ├── mysql_php_spec.rb
│ │ │ ├── mysql_python_spec.rb
│ │ │ ├── mysql_ruby_spec.rb
│ │ │ ├── mysql_server_account_security_spec.rb
│ │ │ ├── mysql_server_monitor_spec.rb
│ │ │ └── mysql_server_spec.rb
│ │ ├── defines
│ │ │ ├── mysql_db_spec.rb
│ │ │ └── mysql_server_config_spec.rb
│ │ ├── spec.opts
│ │ ├── spec_helper.rb
│ │ ├── spec_helper_system.rb
│ │ ├── system
│ │ │ └── mysql_spec.rb
│ │ └── unit
│ │ │ ├── mysql_password_spec.rb
│ │ │ └── puppet
│ │ │ └── provider
│ │ │ ├── database
│ │ │ └── mysql_spec.rb
│ │ │ ├── database_grant
│ │ │ └── mysql_spec.rb
│ │ │ └── database_user
│ │ │ └── mysql_spec.rb
│ ├── templates
│ │ ├── my.cnf.erb
│ │ ├── my.cnf.pass.erb
│ │ ├── my.conf.cnf.erb
│ │ └── mysqlbackup.sh.erb
│ └── tests
│ │ ├── backup.pp
│ │ ├── init.pp
│ │ ├── java.pp
│ │ ├── mysql_database.pp
│ │ ├── mysql_grant.pp
│ │ ├── mysql_user.pp
│ │ ├── perl.pp
│ │ ├── python.pp
│ │ ├── ruby.pp
│ │ ├── server.pp
│ │ └── server
│ │ ├── account_security.pp
│ │ └── config.pp
├── php
│ ├── .fixtures.yml
│ ├── .gemfile
│ ├── .project
│ ├── .travis.yml
│ ├── Modulefile
│ ├── README.md
│ ├── Rakefile
│ ├── lib
│ │ └── facter
│ │ │ ├── php_fact_extension_dir.rb
│ │ │ └── php_fact_version.rb
│ ├── manifests
│ │ ├── augeas.pp
│ │ ├── devel.pp
│ │ ├── ini.pp
│ │ ├── init.pp
│ │ ├── module.pp
│ │ ├── params.pp
│ │ ├── pear.pp
│ │ ├── pear
│ │ │ ├── config.pp
│ │ │ └── module.pp
│ │ ├── pecl
│ │ │ └── module.pp
│ │ └── spec.pp
│ ├── spec
│ │ ├── classes
│ │ │ └── php_spec.rb
│ │ └── spec_helper.rb
│ └── templates
│ │ ├── extra-ini.erb
│ │ └── spec.erb
├── puphpet
│ ├── LICENSE
│ ├── README.md
│ ├── composer.json
│ ├── files
│ │ └── dot
│ │ │ └── .bash_aliases
│ ├── manifests
│ │ ├── dotfiles.pp
│ │ ├── ini.pp
│ │ └── ini
│ │ │ └── removeblock.pp
│ ├── templates
│ │ └── extra-ini.erb
│ └── tests
│ │ └── ini.pp
├── puppi
│ ├── .fixtures.yml
│ ├── .gemfile
│ ├── .project
│ ├── .travis.yml
│ ├── Modulefile
│ ├── README.md
│ ├── README_check.md
│ ├── README_deploy.md
│ ├── README_info.md
│ ├── README_log.md
│ ├── Rakefile
│ ├── composer.json
│ ├── files
│ │ ├── info
│ │ │ └── readme
│ │ │ │ ├── readme
│ │ │ │ └── readme-default
│ │ ├── mailpuppicheck
│ │ ├── mcollective
│ │ │ ├── mc-puppi
│ │ │ ├── puppi.ddl
│ │ │ ├── puppi.rb
│ │ │ ├── puppicheck
│ │ │ └── puppideploy
│ │ └── scripts
│ │ │ ├── archive.sh
│ │ │ ├── check_project.sh
│ │ │ ├── checkwardir.sh
│ │ │ ├── clean_filelist.sh
│ │ │ ├── database.sh
│ │ │ ├── delete.sh
│ │ │ ├── deploy.sh
│ │ │ ├── deploy_files.sh
│ │ │ ├── execute.sh
│ │ │ ├── firewall.sh
│ │ │ ├── functions
│ │ │ ├── get_file.sh
│ │ │ ├── get_filesfromlist.sh
│ │ │ ├── get_maven_files.sh
│ │ │ ├── get_metadata.sh
│ │ │ ├── git.sh
│ │ │ ├── header
│ │ │ ├── predeploy.sh
│ │ │ ├── predeploy_tar.sh
│ │ │ ├── report_mail.sh
│ │ │ ├── report_mongo.sh
│ │ │ ├── service.sh
│ │ │ ├── svn.sh
│ │ │ ├── wait.sh
│ │ │ ├── yant.sh
│ │ │ └── yum.sh
│ ├── lib
│ │ ├── facter
│ │ │ ├── last_run.rb
│ │ │ └── puppi_projects.rb
│ │ └── puppet
│ │ │ └── parser
│ │ │ └── functions
│ │ │ ├── any2bool.rb
│ │ │ ├── bool2ensure.rb
│ │ │ ├── get_class_args.rb
│ │ │ ├── get_magicvar.rb
│ │ │ ├── get_module_path.rb
│ │ │ ├── is_array.rb
│ │ │ ├── options_lookup.rb
│ │ │ ├── params_lookup.rb
│ │ │ └── url_parse.rb
│ ├── manifests
│ │ ├── check.pp
│ │ ├── dependencies.pp
│ │ ├── deploy.pp
│ │ ├── extras.pp
│ │ ├── helper.pp
│ │ ├── helpers.pp
│ │ ├── info.pp
│ │ ├── info
│ │ │ ├── instance.pp
│ │ │ ├── module.pp
│ │ │ └── readme.pp
│ │ ├── init.pp
│ │ ├── initialize.pp
│ │ ├── install_packages.pp
│ │ ├── log.pp
│ │ ├── mcollective
│ │ │ ├── client.pp
│ │ │ └── server.pp
│ │ ├── netinstall.pp
│ │ ├── one.pp
│ │ ├── params.pp
│ │ ├── project.pp
│ │ ├── project
│ │ │ ├── README
│ │ │ ├── archive.pp
│ │ │ ├── builder.pp
│ │ │ ├── dir.pp
│ │ │ ├── files.pp
│ │ │ ├── git.pp
│ │ │ ├── maven.pp
│ │ │ ├── mysql.pp
│ │ │ ├── service.pp
│ │ │ ├── svn.pp
│ │ │ ├── tar.pp
│ │ │ ├── war.pp
│ │ │ ├── y4maven.pp
│ │ │ └── yum.pp
│ │ ├── report.pp
│ │ ├── rollback.pp
│ │ ├── run.pp
│ │ ├── runscript.pp
│ │ ├── skel.pp
│ │ ├── todo.pp
│ │ ├── two.pp
│ │ └── ze.pp
│ ├── spec
│ │ ├── classes
│ │ │ └── puppi_spec.rb
│ │ ├── defines
│ │ │ ├── puppi_check_spec.rb
│ │ │ ├── puppi_deploy_spec.rb
│ │ │ ├── puppi_helper_spec.rb
│ │ │ ├── puppi_info_spec.rb
│ │ │ ├── puppi_initialize_spec.rb
│ │ │ ├── puppi_log_spec.rb
│ │ │ ├── puppi_project_spec.rb
│ │ │ ├── puppi_report_spec.rb
│ │ │ ├── puppi_rollback_spec.rb
│ │ │ ├── puppi_run_spec.rb
│ │ │ ├── puppi_todo_spec.rb
│ │ │ └── puppi_ze_spec.rb
│ │ ├── functions
│ │ │ ├── any2bool_spec.rb
│ │ │ ├── bool2ensure_spec.rb
│ │ │ └── url_parse_spec.rb
│ │ └── spec_helper.rb
│ └── templates
│ │ ├── helpers
│ │ └── standard.yml.erb
│ │ ├── info.erb
│ │ ├── info
│ │ ├── instance.erb
│ │ ├── module.erb
│ │ ├── puppet.erb
│ │ └── readme.erb
│ │ ├── install_packages.erb
│ │ ├── log.erb
│ │ ├── project
│ │ └── config.erb
│ │ ├── puppi.conf.erb
│ │ ├── puppi.erb
│ │ └── todo.erb
├── stdlib
│ ├── .rspec
│ ├── CHANGELOG
│ ├── LICENSE
│ ├── Modulefile
│ ├── README.markdown
│ ├── README_DEVELOPER.markdown
│ ├── RELEASE_PROCESS.markdown
│ ├── Rakefile
│ ├── lib
│ │ ├── facter
│ │ │ ├── facter_dot_d.rb
│ │ │ ├── pe_version.rb
│ │ │ ├── puppet_vardir.rb
│ │ │ ├── root_home.rb
│ │ │ └── util
│ │ │ │ └── puppet_settings.rb
│ │ └── puppet
│ │ │ ├── parser
│ │ │ └── functions
│ │ │ │ ├── abs.rb
│ │ │ │ ├── bool2num.rb
│ │ │ │ ├── capitalize.rb
│ │ │ │ ├── chomp.rb
│ │ │ │ ├── chop.rb
│ │ │ │ ├── defined_with_params.rb
│ │ │ │ ├── delete.rb
│ │ │ │ ├── delete_at.rb
│ │ │ │ ├── downcase.rb
│ │ │ │ ├── empty.rb
│ │ │ │ ├── ensure_packages.rb
│ │ │ │ ├── ensure_resource.rb
│ │ │ │ ├── flatten.rb
│ │ │ │ ├── fqdn_rotate.rb
│ │ │ │ ├── get_module_path.rb
│ │ │ │ ├── getvar.rb
│ │ │ │ ├── grep.rb
│ │ │ │ ├── has_interface_with.rb
│ │ │ │ ├── has_ip_address.rb
│ │ │ │ ├── has_ip_network.rb
│ │ │ │ ├── has_key.rb
│ │ │ │ ├── hash.rb
│ │ │ │ ├── is_array.rb
│ │ │ │ ├── is_domain_name.rb
│ │ │ │ ├── is_float.rb
│ │ │ │ ├── is_hash.rb
│ │ │ │ ├── is_integer.rb
│ │ │ │ ├── is_ip_address.rb
│ │ │ │ ├── is_mac_address.rb
│ │ │ │ ├── is_numeric.rb
│ │ │ │ ├── is_string.rb
│ │ │ │ ├── join.rb
│ │ │ │ ├── join_keys_to_values.rb
│ │ │ │ ├── keys.rb
│ │ │ │ ├── loadyaml.rb
│ │ │ │ ├── lstrip.rb
│ │ │ │ ├── max.rb
│ │ │ │ ├── member.rb
│ │ │ │ ├── merge.rb
│ │ │ │ ├── min.rb
│ │ │ │ ├── num2bool.rb
│ │ │ │ ├── parsejson.rb
│ │ │ │ ├── parseyaml.rb
│ │ │ │ ├── pick.rb
│ │ │ │ ├── prefix.rb
│ │ │ │ ├── range.rb
│ │ │ │ ├── reject.rb
│ │ │ │ ├── reverse.rb
│ │ │ │ ├── rstrip.rb
│ │ │ │ ├── shuffle.rb
│ │ │ │ ├── size.rb
│ │ │ │ ├── sort.rb
│ │ │ │ ├── squeeze.rb
│ │ │ │ ├── str2bool.rb
│ │ │ │ ├── str2saltedsha512.rb
│ │ │ │ ├── strftime.rb
│ │ │ │ ├── strip.rb
│ │ │ │ ├── swapcase.rb
│ │ │ │ ├── time.rb
│ │ │ │ ├── to_bytes.rb
│ │ │ │ ├── type.rb
│ │ │ │ ├── unique.rb
│ │ │ │ ├── upcase.rb
│ │ │ │ ├── uriescape.rb
│ │ │ │ ├── validate_absolute_path.rb
│ │ │ │ ├── validate_array.rb
│ │ │ │ ├── validate_bool.rb
│ │ │ │ ├── validate_hash.rb
│ │ │ │ ├── validate_re.rb
│ │ │ │ ├── validate_slength.rb
│ │ │ │ ├── validate_string.rb
│ │ │ │ ├── values.rb
│ │ │ │ ├── values_at.rb
│ │ │ │ └── zip.rb
│ │ │ ├── provider
│ │ │ └── file_line
│ │ │ │ └── ruby.rb
│ │ │ └── type
│ │ │ ├── anchor.rb
│ │ │ └── file_line.rb
│ ├── manifests
│ │ ├── init.pp
│ │ └── stages.pp
│ ├── spec
│ │ ├── functions
│ │ │ ├── defined_with_params_spec.rb
│ │ │ ├── ensure_packages_spec.rb
│ │ │ └── ensure_resource_spec.rb
│ │ ├── lib
│ │ │ └── puppet_spec
│ │ │ │ ├── files.rb
│ │ │ │ ├── fixtures.rb
│ │ │ │ ├── matchers.rb
│ │ │ │ └── verbose.rb
│ │ ├── monkey_patches
│ │ │ ├── alias_should_to_must.rb
│ │ │ └── publicize_methods.rb
│ │ ├── spec.opts
│ │ ├── spec_helper.rb
│ │ ├── unit
│ │ │ ├── facter
│ │ │ │ ├── pe_version_spec.rb
│ │ │ │ ├── root_home_spec.rb
│ │ │ │ └── util
│ │ │ │ │ └── puppet_settings_spec.rb
│ │ │ └── puppet
│ │ │ │ ├── parser
│ │ │ │ └── functions
│ │ │ │ │ ├── abs_spec.rb
│ │ │ │ │ ├── bool2num_spec.rb
│ │ │ │ │ ├── capitalize_spec.rb
│ │ │ │ │ ├── chomp_spec.rb
│ │ │ │ │ ├── chop_spec.rb
│ │ │ │ │ ├── delete_at_spec.rb
│ │ │ │ │ ├── delete_spec.rb
│ │ │ │ │ ├── downcase_spec.rb
│ │ │ │ │ ├── empty_spec.rb
│ │ │ │ │ ├── flatten_spec.rb
│ │ │ │ │ ├── fqdn_rotate_spec.rb
│ │ │ │ │ ├── get_module_path_spec.rb
│ │ │ │ │ ├── getvar_spec.rb
│ │ │ │ │ ├── grep_spec.rb
│ │ │ │ │ ├── has_interface_with_spec.rb
│ │ │ │ │ ├── has_ip_address_spec.rb
│ │ │ │ │ ├── has_ip_network_spec.rb
│ │ │ │ │ ├── has_key_spec.rb
│ │ │ │ │ ├── hash_spec.rb
│ │ │ │ │ ├── is_array_spec.rb
│ │ │ │ │ ├── is_domain_name_spec.rb
│ │ │ │ │ ├── is_float_spec.rb
│ │ │ │ │ ├── is_hash_spec.rb
│ │ │ │ │ ├── is_integer_spec.rb
│ │ │ │ │ ├── is_ip_address_spec.rb
│ │ │ │ │ ├── is_mac_address_spec.rb
│ │ │ │ │ ├── is_numeric_spec.rb
│ │ │ │ │ ├── is_string_spec.rb
│ │ │ │ │ ├── join_keys_to_values_spec.rb
│ │ │ │ │ ├── join_spec.rb
│ │ │ │ │ ├── keys_spec.rb
│ │ │ │ │ ├── lstrip_spec.rb
│ │ │ │ │ ├── max_spec.rb
│ │ │ │ │ ├── member_spec.rb
│ │ │ │ │ ├── merge_spec.rb
│ │ │ │ │ ├── min_spec.rb
│ │ │ │ │ ├── num2bool_spec.rb
│ │ │ │ │ ├── parsejson_spec.rb
│ │ │ │ │ ├── parseyaml_spec.rb
│ │ │ │ │ ├── pick_spec.rb
│ │ │ │ │ ├── prefix_spec.rb
│ │ │ │ │ ├── range_spec.rb
│ │ │ │ │ ├── reject_spec.rb
│ │ │ │ │ ├── reverse_spec.rb
│ │ │ │ │ ├── rstrip_spec.rb
│ │ │ │ │ ├── shuffle_spec.rb
│ │ │ │ │ ├── size_spec.rb
│ │ │ │ │ ├── sort_spec.rb
│ │ │ │ │ ├── squeeze_spec.rb
│ │ │ │ │ ├── str2bool_spec.rb
│ │ │ │ │ ├── str2saltedsha512_spec.rb
│ │ │ │ │ ├── strftime_spec.rb
│ │ │ │ │ ├── strip_spec.rb
│ │ │ │ │ ├── swapcase_spec.rb
│ │ │ │ │ ├── time_spec.rb
│ │ │ │ │ ├── to_bytes_spec.rb
│ │ │ │ │ ├── type_spec.rb
│ │ │ │ │ ├── unique_spec.rb
│ │ │ │ │ ├── upcase_spec.rb
│ │ │ │ │ ├── uriescape_spec.rb
│ │ │ │ │ ├── validate_absolute_path_spec.rb
│ │ │ │ │ ├── validate_array_spec.rb
│ │ │ │ │ ├── validate_bool_spec.rb
│ │ │ │ │ ├── validate_hash_spec.rb
│ │ │ │ │ ├── validate_re_spec.rb
│ │ │ │ │ ├── validate_slength_spec.rb
│ │ │ │ │ ├── validate_string_spec.rb
│ │ │ │ │ ├── values_at_spec.rb
│ │ │ │ │ ├── values_spec.rb
│ │ │ │ │ └── zip_spec.rb
│ │ │ │ ├── provider
│ │ │ │ └── file_line
│ │ │ │ │ └── ruby_spec.rb
│ │ │ │ └── type
│ │ │ │ ├── anchor_spec.rb
│ │ │ │ └── file_line_spec.rb
│ │ └── watchr.rb
│ └── tests
│ │ ├── file_line.pp
│ │ ├── has_interface_with.pp
│ │ ├── has_ip_address.pp
│ │ ├── has_ip_network.pp
│ │ └── init.pp
├── vcsrepo
│ ├── Gemfile
│ ├── Gemfile.lock
│ ├── LICENSE
│ ├── Modulefile
│ ├── README.BZR.markdown
│ ├── README.CVS.markdown
│ ├── README.GIT.markdown
│ ├── README.HG.markdown
│ ├── README.SVN.markdown
│ ├── README.markdown
│ ├── Rakefile
│ ├── examples
│ │ ├── bzr
│ │ │ ├── branch.pp
│ │ │ └── init_repo.pp
│ │ ├── cvs
│ │ │ ├── local.pp
│ │ │ └── remote.pp
│ │ ├── git
│ │ │ ├── bare_init.pp
│ │ │ ├── clone.pp
│ │ │ └── working_copy_init.pp
│ │ ├── hg
│ │ │ ├── clone.pp
│ │ │ └── init_repo.pp
│ │ └── svn
│ │ │ ├── checkout.pp
│ │ │ └── server.pp
│ ├── lib
│ │ └── puppet
│ │ │ ├── provider
│ │ │ ├── vcsrepo.rb
│ │ │ └── vcsrepo
│ │ │ │ ├── bzr.rb
│ │ │ │ ├── cvs.rb
│ │ │ │ ├── dummy.rb
│ │ │ │ ├── git.rb
│ │ │ │ ├── hg.rb
│ │ │ │ └── svn.rb
│ │ │ └── type
│ │ │ └── vcsrepo.rb
│ └── spec
│ │ ├── fixtures
│ │ ├── bzr_version_info.txt
│ │ ├── git_branch_a.txt
│ │ ├── hg_parents.txt
│ │ ├── hg_tags.txt
│ │ └── svn_info.txt
│ │ ├── spec.opts
│ │ ├── spec_helper.rb
│ │ ├── support
│ │ ├── filesystem_helpers.rb
│ │ ├── fixture_helpers.rb
│ │ └── provider_example_group.rb
│ │ └── unit
│ │ └── puppet
│ │ ├── provider
│ │ └── vcsrepo
│ │ │ ├── bzr_spec.rb
│ │ │ ├── cvs_spec.rb
│ │ │ ├── dummy_spec.rb
│ │ │ ├── git_spec.rb
│ │ │ ├── hg_spec.rb
│ │ │ └── svn_spec.rb
│ │ └── type
│ │ └── README.markdown
└── xdebug
│ ├── README.md
│ ├── files
│ └── cli_alias.erb
│ ├── manifests
│ ├── config.pp
│ ├── debian.pp
│ ├── init.pp
│ └── params.pp
│ ├── templates
│ ├── ini.erb
│ └── ini_file.erb
│ └── tests
│ └── cli.pp
├── spec
└── SensioLabs
│ ├── Ceremonies
│ ├── CeremonySpec.php
│ ├── ProjectManagerSpec.php
│ ├── ProjectSpec.php
│ ├── SpecificationSpec.php
│ └── SprintSpec.php
│ └── CeremonyTracker
│ ├── Ceremonies
│ ├── InMemoryProjectRepositorySpec.php
│ ├── InMemorySpecificationRepositorySpec.php
│ └── InMemorySprintRepositorySpec.php
│ ├── CreateProjectSpec.php
│ ├── CreateSpecificationSpec.php
│ ├── GetManagerProjectsSpec.php
│ ├── GetProjectSprintsSpec.php
│ └── ScheduleSprintSpec.php
├── src
├── .htaccess
└── SensioLabs
│ ├── Ceremonies
│ ├── Ceremony.php
│ ├── Project.php
│ ├── ProjectManager.php
│ ├── ProjectRepositoryInterface.php
│ ├── Specification.php
│ ├── SpecificationRepositoryInterface.php
│ ├── Sprint.php
│ └── SprintRepositoryInterface.php
│ ├── CeremonyTracker
│ ├── Ceremonies
│ │ ├── InMemoryProjectRepository.php
│ │ ├── InMemorySpecificationRepository.php
│ │ └── InMemorySprintRepository.php
│ ├── CreateProject.php
│ ├── CreateSpecification.php
│ ├── Event.php
│ ├── GetManagerProjects.php
│ ├── GetProjectSprints.php
│ └── ScheduleSprint.php
│ └── CeremonyTrackerBundle
│ ├── CeremonyTrackerBundle.php
│ ├── Controller
│ ├── CreateProjectController.php
│ ├── ListMyProjectsController.php
│ └── SecurityController.php
│ ├── DataFixtures
│ └── ORM
│ │ └── LoadProjectManagers.php
│ ├── DependencyInjection
│ └── CeremonyTrackerExtension.php
│ ├── Entity
│ ├── Project.php
│ ├── ProjectManager.php
│ └── ProjectRepository.php
│ ├── Form
│ └── CreateProjectType.php
│ └── Resources
│ ├── config
│ ├── doctrine
│ │ ├── Project.orm.xml
│ │ └── ProjectManager.orm.xml
│ ├── routing.yml
│ └── services.yml
│ └── views
│ ├── Projects
│ └── list.html.twig
│ └── Security
│ └── login.html.twig
├── tests
└── contexts
│ └── ProjectManagerContext.php
└── web
├── .htaccess
├── app.php
├── app_dev.php
└── robots.txt
/.gitignore:
--------------------------------------------------------------------------------
1 | vendor
2 | app/cache
3 | app/logs
4 | app/bootstrap.php.cache
5 | app/config/parameters.yml
6 | bin
7 | web/bundles
--------------------------------------------------------------------------------
/Vagrantfile:
--------------------------------------------------------------------------------
1 | Vagrant.configure("2") do |config|
2 | config.vm.box = "precise64"
3 | config.vm.box_url = "http://files.vagrantup.com/precise64.box"
4 |
5 | config.vm.network :private_network, ip: "192.168.56.101"
6 | config.ssh.forward_agent = true
7 |
8 | config.vm.provider :virtualbox do |v|
9 | v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
10 | v.customize ["modifyvm", :id, "--memory", 1024]
11 | v.customize ["modifyvm", :id, "--name", "ceremonies-tracker.dev"]
12 | end
13 |
14 | config.vm.synced_folder "./", "/var/www", id: "vagrant-root", :nfs => true
15 | config.vm.provision :shell, :inline =>
16 | "if [[ ! -f /apt-get-run ]]; then sudo apt-get update && sudo touch /apt-get-run; fi"
17 |
18 | config.vm.provision :puppet do |puppet|
19 | puppet.manifests_path = "manifests"
20 | puppet.module_path = "modules"
21 | puppet.options = ['--verbose']
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/app/.htaccess:
--------------------------------------------------------------------------------
1 | deny from all
--------------------------------------------------------------------------------
/app/AppCache.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {% block title %}Welcome!{% endblock %}
6 | {% block stylesheets %}{% endblock %}
7 |
8 |
9 |
10 | {% block body %}{% endblock %}
11 | {% block javascripts %}{% endblock %}
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/autoload.php:
--------------------------------------------------------------------------------
1 | getParameterOption(array('--env', '-e'), getenv('SYMFONY_ENV') ?: 'dev');
19 | $debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(array('--no-debug', '')) && $env !== 'prod';
20 |
21 | if ($debug) {
22 | Debug::enable();
23 | }
24 |
25 | $kernel = new AppKernel($env, $debug);
26 | $application = new Application($kernel);
27 | $application->run($input);
28 |
--------------------------------------------------------------------------------
/behat.yml:
--------------------------------------------------------------------------------
1 | default:
2 | autoload: tests/contexts
3 | suites:
4 | default:
5 | context: ProjectManagerContext
6 |
--------------------------------------------------------------------------------
/features/manager_can_create_a_project.feature:
--------------------------------------------------------------------------------
1 | Feature: Manager can create a project
2 | In order to be able to track my project ceremonies
3 | As a project manager
4 | I need to be able to create a project
5 |
6 | Scenario: Successfully creating a project with a name
7 | Given I am a project manager
8 | When I create the "Nokia" project
9 | Then the "Nokia" project should be saved
10 | And I should be notified about the project creation success
11 |
12 | Scenario: Being unable to create a project without a name
13 | Given I am a project manager
14 | When I create the project
15 | Then the project should not be saved
16 | And I should be notified about the project creation failure
17 |
--------------------------------------------------------------------------------
/features/manager_can_list_his_project_sprints.feature:
--------------------------------------------------------------------------------
1 | Feature: Manager can list his project sprints
2 | In order to track all my project sprints
3 | As a project manager
4 | I need to be able to see the list of sprints for a specific project
5 |
6 | Scenario: Getting two sprints for a project that has two
7 | Given I am a project manager
8 | And I have a "Nokia" project
9 | And I have scheduled 2 sprints for this project
10 | When I list this project sprints
11 | Then I should get a list of 2 sprints
12 |
13 | Scenario: Not getting any sprint if project doesn't have any
14 | Given I am a project manager
15 | And I have a "Nokia" project
16 | But I have not yet scheduled any sprints for this project
17 | When I list this project sprints
18 | Then I should get an empty list of sprints
19 |
--------------------------------------------------------------------------------
/features/manager_can_list_his_projects.feature:
--------------------------------------------------------------------------------
1 | Feature: Manager can list his projects
2 | In order to maintain and track my projects
3 | As a project manager
4 | I need to be able to see the list of all my projects
5 |
6 | Scenario: Getting two projects if there are two
7 | Given I am a project manager
8 | And I have 2 projects
9 | When I list my projects
10 | Then I should get a list of 2 projects
11 |
12 | Scenario: Not getting any project if there's none
13 | Given I am a project manager
14 | But I have no projects
15 | When I list my projects
16 | Then I should get an empty list of projects
17 |
--------------------------------------------------------------------------------
/modules/apache/.fixtures.yml:
--------------------------------------------------------------------------------
1 | fixtures:
2 | repositories:
3 | "puppi": "git://github.com/example42/puppi.git"
4 | "monitor": "git://github.com/example42/puppet-monitor.git"
5 | "firewall": "git://github.com/example42/puppet-firewall.git"
6 | "iptables": "git://github.com/example42/puppet-iptables.git"
7 | "concat": "git://github.com/example42/puppet-concat.git"
8 | symlinks:
9 | "apache": "#{source_dir}"
10 |
11 |
--------------------------------------------------------------------------------
/modules/apache/.gemfile:
--------------------------------------------------------------------------------
1 | source 'https://rubygems.org'
2 |
3 | puppetversion = ENV['PUPPET_VERSION']
4 | gem 'puppet', puppetversion, :require => false
5 | gem 'puppet-lint'
6 | gem 'puppetlabs_spec_helper', '>= 0.1.0'
7 |
--------------------------------------------------------------------------------
/modules/apache/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | apache
4 |
5 |
6 |
7 |
8 |
9 | org.cloudsmith.geppetto.pp.dsl.ui.modulefileBuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.xtext.ui.shared.xtextBuilder
15 |
16 |
17 |
18 |
19 |
20 | org.cloudsmith.geppetto.pp.dsl.ui.puppetNature
21 | org.eclipse.xtext.ui.shared.xtextNature
22 |
23 |
24 |
--------------------------------------------------------------------------------
/modules/apache/.travis.yml:
--------------------------------------------------------------------------------
1 | language: ruby
2 | rvm:
3 | - 1.8.7
4 | - 1.9.3
5 | script:
6 | - "rake spec SPEC_OPTS='--format documentation'"
7 | env:
8 | - PUPPET_VERSION="~> 2.6.0"
9 | - PUPPET_VERSION="~> 2.7.0"
10 | - PUPPET_VERSION="~> 3.0.0"
11 | - PUPPET_VERSION="~> 3.1.0"
12 | matrix:
13 | exclude:
14 | - rvm: 1.9.3
15 | env: PUPPET_VERSION="~> 2.6.0"
16 | gemfile: .gemfile
17 |
18 | gemfile: .gemfile
19 | notifications:
20 | email:
21 | - al@lab42.it
22 |
--------------------------------------------------------------------------------
/modules/apache/Modulefile:
--------------------------------------------------------------------------------
1 | name 'example42-apache'
2 | version '2.0.8'
3 |
4 | author 'Alessandro Franceschi'
5 | license 'Apache2'
6 | project_page 'http://www.example42.com'
7 | source 'https://github.com/example42/puppet-apache'
8 | summary 'Puppet module for apache'
9 | description 'This module installs and manages apache. Check README.rdoc for details. Puppi is required for some common functions: you can install them without using the whole module. Monitor and firewall dependencies are needed only if the relevant features are enabled'
10 | dependency 'example42/puppi', '>=2.0.0'
11 | dependency 'example42/yum', '>=2.0.0'
12 | dependency 'example42/firewall', '>=2.0.0'
13 | dependency 'example42/monitor', '>=2.0.0'
14 |
--------------------------------------------------------------------------------
/modules/apache/Rakefile:
--------------------------------------------------------------------------------
1 | require 'rubygems'
2 | require 'puppetlabs_spec_helper/rake_tasks'
3 | require 'puppet-lint'
4 | PuppetLint.configuration.send("disable_80chars")
5 | PuppetLint.configuration.send('disable_class_parameter_defaults')
6 |
--------------------------------------------------------------------------------
/modules/apache/manifests/redhat.pp:
--------------------------------------------------------------------------------
1 | # Class apache::redhat
2 | #
3 | # Apache resources specific for RedHat
4 | #
5 | class apache::redhat {
6 | apache::dotconf { '00-NameVirtualHost':
7 | content => template('apache/00-NameVirtualHost.conf.erb'),
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/modules/apache/manifests/spec.pp:
--------------------------------------------------------------------------------
1 | # Class: apache::spec
2 | #
3 | # This class is used only for rpsec-puppet tests
4 | # Can be taken as an example on how to do custom classes but should not
5 | # be modified.
6 | #
7 | # == Usage
8 | #
9 | # This class is not intended to be used directly.
10 | # Use it as reference
11 | #
12 | class apache::spec inherits apache {
13 |
14 | # This just a test to override the arguments of an existing resource
15 | # Note that you can achieve this same result with just:
16 | # class { "apache": template => "apache/spec.erb" }
17 |
18 | File['apache.conf'] {
19 | content => template('apache/spec.erb'),
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/modules/apache/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | require 'puppetlabs_spec_helper/module_spec_helper'
2 |
--------------------------------------------------------------------------------
/modules/apache/templates/00-NameVirtualHost.conf.erb:
--------------------------------------------------------------------------------
1 | # File managed by Puppet
2 |
3 | NameVirtualHost *:80
4 |
--------------------------------------------------------------------------------
/modules/apache/templates/module/proxy.conf.erb:
--------------------------------------------------------------------------------
1 | # File Managed by Puppet
2 |
3 |
4 |
5 | # This is not a forwared proxy
6 | ProxyRequests Off
7 |
8 |
9 | AddDefaultCharset off
10 | Order deny,allow
11 | Deny from all
12 | Allow from all
13 |
14 |
15 | ProxyVia On
16 |
17 |
18 |
--------------------------------------------------------------------------------
/modules/apache/templates/spec.erb:
--------------------------------------------------------------------------------
1 | # This is a template used only for rspec tests
2 |
3 | # Yaml of the whole scope
4 | <%= scope.to_hash.reject { |k,v| !( k.is_a?(String) && v.is_a?(String) ) }.to_yaml %>
5 |
6 | # Custom Options
7 | <%= @options['opt_a'] %>
8 | <%= @options['opt_b'] %>
9 |
--------------------------------------------------------------------------------
/modules/apache/templates/virtualhost/virtualhost.conf.erb:
--------------------------------------------------------------------------------
1 | # File Managed by Puppet
2 |
3 |
4 | ServerAdmin webmaster@<%= @name %>
5 | DocumentRoot <%= @real_documentroot %>
6 | ServerName <%= @name %>
7 | <% if @aliases != "" -%>
8 | <% if @aliases.is_a? Array -%>
9 | ServerAlias <%= @aliases.flatten.join(" ") %>
10 | <% else -%>
11 | ServerAlias <%= @aliases %>
12 | <% end -%>
13 | <% end -%>
14 | ErrorLog <%= scope.lookupvar('apache::log_dir')%>/<%= @name %>-error_log
15 | CustomLog <%= scope.lookupvar('apache::log_dir')%>/<%= @name %>-access_log common
16 |
17 |
--------------------------------------------------------------------------------
/modules/apache/tests/vhost.pp:
--------------------------------------------------------------------------------
1 | include apache
2 |
3 | apache::vhost { 'testsite':
4 | docroot => '/var/www/test',
5 | env_variables => ['APP_ENV dev'],
6 | }
7 |
8 |
--------------------------------------------------------------------------------
/modules/apt/.fixtures.yml:
--------------------------------------------------------------------------------
1 | fixtures:
2 | repositories:
3 | "stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git"
4 | symlinks:
5 | "apt": "#{source_dir}"
6 |
--------------------------------------------------------------------------------
/modules/apt/.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 |
--------------------------------------------------------------------------------
/modules/apt/.travis.yml:
--------------------------------------------------------------------------------
1 | language: ruby
2 | rvm:
3 | - 1.8.7
4 | before_script:
5 | after_script:
6 | script: "rake spec"
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 |
--------------------------------------------------------------------------------
/modules/apt/Modulefile:
--------------------------------------------------------------------------------
1 | name 'puppetlabs-apt'
2 | version '1.1.0'
3 | source 'https://github.com/puppetlabs/puppetlabs-apt'
4 | author 'Evolving Web / Puppet Labs'
5 | license 'Apache License 2.0'
6 | summary 'Puppet Labs Apt Module'
7 | description 'APT Module for Puppet'
8 | project_page 'https://github.com/puppetlabs/puppetlabs-apt'
9 |
10 | ## Add dependencies, if any:
11 | #dependency 'puppetlabs/stdlib', '2.x'
12 | # The dependency should be written as above but librarian-puppet
13 | # does not support the expression as the PMT does.
14 | dependency 'puppetlabs/stdlib', '>= 2.2.1'
15 |
--------------------------------------------------------------------------------
/modules/apt/Rakefile:
--------------------------------------------------------------------------------
1 | require 'puppetlabs_spec_helper/rake_tasks'
2 |
--------------------------------------------------------------------------------
/modules/apt/manifests/builddep.pp:
--------------------------------------------------------------------------------
1 | # builddep.pp
2 |
3 | define apt::builddep() {
4 | include apt::update
5 |
6 | exec { "apt-builddep-${name}":
7 | command => "/usr/bin/apt-get -y --force-yes build-dep ${name}",
8 | logoutput => 'on_failure',
9 | notify => Exec['apt_update'],
10 | }
11 |
12 | # Need anchor to provide containment for dependencies.
13 | anchor { "apt::builddep::${name}":
14 | require => Class['apt::update'],
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/modules/apt/manifests/conf.pp:
--------------------------------------------------------------------------------
1 | define apt::conf (
2 | $content,
3 | $ensure = present,
4 | $priority = '50'
5 | ) {
6 |
7 | include apt::params
8 |
9 | $apt_conf_d = $apt::params::apt_conf_d
10 |
11 | file { "${apt_conf_d}/${priority}${name}":
12 | ensure => $ensure,
13 | content => $content,
14 | owner => root,
15 | group => root,
16 | mode => '0644',
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/modules/apt/manifests/debian/testing.pp:
--------------------------------------------------------------------------------
1 | # testing.pp
2 |
3 | class apt::debian::testing {
4 | include apt
5 |
6 | # deb http://debian.mirror.iweb.ca/debian/ testing main contrib non-free
7 | # deb-src http://debian.mirror.iweb.ca/debian/ testing main contrib non-free
8 | # Key: 55BE302B Server: subkeys.pgp.net
9 | # debian-keyring
10 | # debian-archive-keyring
11 |
12 | apt::source { 'debian_testing':
13 | location => 'http://debian.mirror.iweb.ca/debian/',
14 | release => 'testing',
15 | repos => 'main contrib non-free',
16 | required_packages => 'debian-keyring debian-archive-keyring',
17 | key => '55BE302B',
18 | key_server => 'subkeys.pgp.net',
19 | pin => '-10',
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/modules/apt/manifests/debian/unstable.pp:
--------------------------------------------------------------------------------
1 | # unstable.pp
2 |
3 | class apt::debian::unstable {
4 | include apt
5 |
6 | # deb http://debian.mirror.iweb.ca/debian/ unstable main contrib non-free
7 | # deb-src http://debian.mirror.iweb.ca/debian/ unstable main contrib non-free
8 | # Key: 55BE302B Server: subkeys.pgp.net
9 | # debian-keyring
10 | # debian-archive-keyring
11 |
12 | apt::source { 'debian_unstable':
13 | location => 'http://debian.mirror.iweb.ca/debian/',
14 | release => 'unstable',
15 | repos => 'main contrib non-free',
16 | required_packages => 'debian-keyring debian-archive-keyring',
17 | key => '55BE302B',
18 | key_server => 'subkeys.pgp.net',
19 | pin => '-10',
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/modules/apt/manifests/force.pp:
--------------------------------------------------------------------------------
1 | # force.pp
2 | # force a package from a specific release
3 |
4 | define apt::force(
5 | $release = 'testing',
6 | $version = false,
7 | $timeout = 300
8 | ) {
9 |
10 | $version_string = $version ? {
11 | false => undef,
12 | default => "=${version}",
13 | }
14 |
15 | $install_check = $version ? {
16 | false => "/usr/bin/dpkg -s ${name} | grep -q 'Status: install'",
17 | default => "/usr/bin/dpkg -s ${name} | grep -q 'Version: ${version}'",
18 | }
19 | exec { "/usr/bin/aptitude -y -t ${release} install ${name}${version_string}":
20 | unless => $install_check,
21 | logoutput => 'on_failure',
22 | timeout => $timeout,
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/modules/apt/manifests/params.pp:
--------------------------------------------------------------------------------
1 | class apt::params {
2 | $root = '/etc/apt'
3 | $provider = '/usr/bin/apt-get'
4 | $sources_list_d = "${root}/sources.list.d"
5 | $apt_conf_d = "${root}/apt.conf.d"
6 | $preferences_d = "${root}/preferences.d"
7 |
8 | case $::lsbdistid {
9 | 'debian': {
10 | $backports_location = 'http://backports.debian.org/debian-backports'
11 | }
12 | 'ubuntu': {
13 | case $::lsbdistcodename {
14 | 'hardy','lucid','maverick','natty','oneiric','precise': {
15 | $backports_location = 'http://us.archive.ubuntu.com/ubuntu'
16 | }
17 | default: {
18 | $backports_location = 'http://old-releases.ubuntu.com/ubuntu'
19 | }
20 | }
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/modules/apt/manifests/release.pp:
--------------------------------------------------------------------------------
1 | # release.pp
2 |
3 | class apt::release (
4 | $release_id
5 | ) {
6 |
7 | include apt::params
8 |
9 | $root = $apt::params::root
10 |
11 | file { "${root}/apt.conf.d/01release":
12 | owner => root,
13 | group => root,
14 | mode => '0644',
15 | content => "APT::Default-Release \"${release_id}\";"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/modules/apt/manifests/update.pp:
--------------------------------------------------------------------------------
1 | class apt::update {
2 | include apt::params
3 |
4 | exec { 'apt_update':
5 | command => "${apt::params::provider} update",
6 | logoutput => 'on_failure',
7 | refreshonly => true,
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/modules/apt/spec/classes/debian_testing_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 | describe 'apt::debian::testing', :type => :class do
3 | it {
4 | should contain_apt__source("debian_testing").with({
5 | "location" => "http://debian.mirror.iweb.ca/debian/",
6 | "release" => "testing",
7 | "repos" => "main contrib non-free",
8 | "required_packages" => "debian-keyring debian-archive-keyring",
9 | "key" => "55BE302B",
10 | "key_server" => "subkeys.pgp.net",
11 | "pin" => "-10"
12 | })
13 | }
14 | end
15 |
--------------------------------------------------------------------------------
/modules/apt/spec/classes/debian_unstable_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 | describe 'apt::debian::unstable', :type => :class do
3 | it {
4 | should contain_apt__source("debian_unstable").with({
5 | "location" => "http://debian.mirror.iweb.ca/debian/",
6 | "release" => "unstable",
7 | "repos" => "main contrib non-free",
8 | "required_packages" => "debian-keyring debian-archive-keyring",
9 | "key" => "55BE302B",
10 | "key_server" => "subkeys.pgp.net",
11 | "pin" => "-10"
12 | })
13 | }
14 | end
15 |
--------------------------------------------------------------------------------
/modules/apt/spec/classes/params_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 | describe 'apt::params', :type => :class do
3 | let (:title) { 'my_package' }
4 |
5 | it { should contain_apt__params }
6 |
7 | # There are 4 resources in this class currently
8 | # there should not be any more resources because it is a params class
9 | # The resources are class[apt::params], class[main], class[settings], stage[main]
10 | it "Should not contain any resources" do
11 | subject.resources.size.should == 4
12 | end
13 | end
14 |
--------------------------------------------------------------------------------
/modules/apt/spec/classes/release_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 | describe 'apt::release', :type => :class do
3 | let (:title) { 'my_package' }
4 |
5 | let :param_set do
6 | { :release_id => 'precise' }
7 | end
8 |
9 | let (:params) { param_set }
10 |
11 | it { should include_class("apt::params") }
12 |
13 | it {
14 | should contain_file("/etc/apt/apt.conf.d/01release").with({
15 | "mode" => "0644",
16 | "owner" => "root",
17 | "group" => "root",
18 | "content" => "APT::Default-Release \"#{param_set[:release_id]}\";"
19 | })
20 | }
21 | end
22 |
23 |
--------------------------------------------------------------------------------
/modules/apt/spec/defines/builddep_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 | describe 'apt::builddep', :type => :define do
3 |
4 | let(:title) { 'my_package' }
5 |
6 | describe "should require apt-get update" do
7 | it { should contain_exec("apt_update").with({
8 | 'command' => "/usr/bin/apt-get update",
9 | 'refreshonly' => true
10 | })
11 | }
12 | it { should contain_anchor("apt::builddep::my_package").with({
13 | 'require' => 'Class[Apt::Update]',
14 | })
15 | }
16 | end
17 |
18 | end
19 |
--------------------------------------------------------------------------------
/modules/apt/spec/fixtures/manifests/site.pp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MarcelloDuarte/hexagonal-symfony/6524566160d34d4d43ec0a9acc1aff2a2451a370/modules/apt/spec/fixtures/manifests/site.pp
--------------------------------------------------------------------------------
/modules/apt/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | require 'puppetlabs_spec_helper/module_spec_helper'
2 |
--------------------------------------------------------------------------------
/modules/apt/templates/pin.pref.erb:
--------------------------------------------------------------------------------
1 | # <%= name %>
2 | Explanation: <%= explanation %>
3 | Package: <%= packages %>
4 | Pin: <%= pin %>
5 | Pin-Priority: <%= priority %>
6 |
--------------------------------------------------------------------------------
/modules/apt/templates/source.list.erb:
--------------------------------------------------------------------------------
1 | # <%= name %>
2 | deb <%= location %> <%= release_real %> <%= repos %>
3 | <%- if include_src then -%>
4 | deb-src <%= location %> <%= release_real %> <%= repos %>
5 | <%- end -%>
6 |
--------------------------------------------------------------------------------
/modules/apt/tests/builddep.pp:
--------------------------------------------------------------------------------
1 | class { 'apt': }
2 | apt::builddep{ 'glusterfs-server': }
3 |
--------------------------------------------------------------------------------
/modules/apt/tests/debian/testing.pp:
--------------------------------------------------------------------------------
1 | class { 'apt': }
2 | class { 'apt::debian::testing': }
3 |
--------------------------------------------------------------------------------
/modules/apt/tests/debian/unstable.pp:
--------------------------------------------------------------------------------
1 | class { 'apt': }
2 | class { 'apt::debian::unstable': }
3 |
--------------------------------------------------------------------------------
/modules/apt/tests/force.pp:
--------------------------------------------------------------------------------
1 | # force.pp
2 | # force a package from a specific release
3 |
4 | apt::force { 'package':
5 | release => 'testing',
6 | version => false
7 | }
8 |
--------------------------------------------------------------------------------
/modules/apt/tests/init.pp:
--------------------------------------------------------------------------------
1 | class { 'apt': }
2 |
--------------------------------------------------------------------------------
/modules/apt/tests/key.pp:
--------------------------------------------------------------------------------
1 | # Declare Apt key for apt.puppetlabs.com source
2 | apt::key { 'puppetlabs':
3 | key => '4BD6EC30',
4 | key_server => 'pgp.mit.edu',
5 | }
6 |
--------------------------------------------------------------------------------
/modules/apt/tests/params.pp:
--------------------------------------------------------------------------------
1 | include apt::params
2 |
--------------------------------------------------------------------------------
/modules/apt/tests/pin.pp:
--------------------------------------------------------------------------------
1 | # pin a release in apt, useful for unstable repositories
2 | apt::pin { 'foo':
3 | packages => '*',
4 | priority => 0,
5 | }
6 |
--------------------------------------------------------------------------------
/modules/apt/tests/ppa.pp:
--------------------------------------------------------------------------------
1 | class { 'apt': }
2 |
3 | # Example declaration of an Apt PPA
4 | apt::ppa{ 'ppa:openstack-ppa/bleeding-edge': }
5 |
--------------------------------------------------------------------------------
/modules/apt/tests/release.pp:
--------------------------------------------------------------------------------
1 | class { 'apt': }
2 | class { 'apt::release':
3 | release_id => 'karmic'
4 | }
5 |
--------------------------------------------------------------------------------
/modules/apt/tests/source.pp:
--------------------------------------------------------------------------------
1 | # Declare the apt class to manage /etc/apt/sources.list and /etc/sources.list.d
2 | class { 'apt': }
3 |
4 | # Install the puppetlabs apt source
5 | # Release is automatically obtained from lsbdistcodename fact if available.
6 | apt::source { 'puppetlabs':
7 | location => 'http://apt.puppetlabs.com',
8 | repos => 'main',
9 | key => '4BD6EC30',
10 | key_server => 'pgp.mit.edu',
11 | }
12 |
13 | # test two sources with the same key
14 | apt::source { 'debian_testing':
15 | location => 'http://debian.mirror.iweb.ca/debian/',
16 | release => 'testing',
17 | repos => 'main contrib non-free',
18 | key => '55BE302B',
19 | key_server => 'subkeys.pgp.net',
20 | pin => '-10',
21 | }
22 | apt::source { 'debian_unstable':
23 | location => 'http://debian.mirror.iweb.ca/debian/',
24 | release => 'unstable',
25 | repos => 'main contrib non-free',
26 | key => '55BE302B',
27 | key_server => 'subkeys.pgp.net',
28 | pin => '-10',
29 | }
30 |
--------------------------------------------------------------------------------
/modules/composer/README.md:
--------------------------------------------------------------------------------
1 | # Puppet module: composer
2 |
3 | This is a Puppet module for [Composer](http://getcomposer.org)
4 |
5 | Requires PHP, curl and Git
6 |
7 | ## USAGE - Basic management
8 |
9 | Install Composer and run it against a composer.json file
10 |
11 | class { 'composer': }
12 |
13 | composer::run { 'puphpet':
14 | path => '/var/www/puphpet.dev/',
15 | }
16 |
--------------------------------------------------------------------------------
/modules/composer/manifests/init.pp:
--------------------------------------------------------------------------------
1 | # Class: composer
2 | #
3 | # Installs Composer
4 | class composer (
5 | $install_location = params_lookup( 'install_location' ),
6 | $filename = params_lookup( 'filename' )
7 | ) inherits composer::params {
8 |
9 | exec { "curl -sS https://getcomposer.org/installer | php -- --install-dir=/home/vagrant && mv /home/vagrant/composer.phar ${install_location}/${filename}":
10 | path => ['/usr/bin', '/bin'],
11 | creates => "${install_location}/${filename}",
12 | require => Package['php'],
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/modules/composer/manifests/params.pp:
--------------------------------------------------------------------------------
1 | # Class: composer::params
2 | #
3 | # Configure how the puppet composer module behaves
4 |
5 | class composer::params {
6 |
7 | $install_location = '/usr/local/bin/'
8 | $filename = 'composer'
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/modules/composer/manifests/run.pp:
--------------------------------------------------------------------------------
1 | define composer::run (
2 | $path,
3 | $command = 'install'
4 | ) {
5 |
6 | include composer
7 |
8 | exec { "${composer::filename} ${command} --working-dir ${path}":
9 | environment => "COMPOSER_HOME=${composer::install_location}",
10 | path => ['/usr/bin', '/bin', $composer::install_location],
11 | require => Package['php'],
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/modules/mysql/.fixtures.yml:
--------------------------------------------------------------------------------
1 | fixtures:
2 | repositories:
3 | "stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib"
4 | symlinks:
5 | "mysql": "#{source_dir}"
6 |
--------------------------------------------------------------------------------
/modules/mysql/.nodeset.yml:
--------------------------------------------------------------------------------
1 | ---
2 | default_set: 'centos-64-x64'
3 | sets:
4 | 'centos-59-x64':
5 | nodes:
6 | "main.foo.vm":
7 | prefab: 'centos-59-x64'
8 | 'centos-64-x64':
9 | nodes:
10 | "main.foo.vm":
11 | prefab: 'centos-64-x64'
12 | 'fedora-18-x64':
13 | nodes:
14 | "main.foo.vm":
15 | prefab: 'fedora-18-x64'
16 | 'debian-607-x64':
17 | nodes:
18 | "main.foo.vm":
19 | prefab: 'debian-607-x64'
20 | 'debian-70rc1-x64':
21 | nodes:
22 | "main.foo.vm":
23 | prefab: 'debian-70rc1-x64'
24 | 'ubuntu-server-10044-x64':
25 | nodes:
26 | "main.foo.vm":
27 | prefab: 'ubuntu-server-10044-x64'
28 | 'ubuntu-server-12042-x64':
29 | nodes:
30 | "main.foo.vm":
31 | prefab: 'ubuntu-server-12042-x64'
32 |
--------------------------------------------------------------------------------
/modules/mysql/Gemfile:
--------------------------------------------------------------------------------
1 | source 'https://rubygems.org'
2 |
3 | group :development, :test do
4 | gem 'rake', :require => false
5 | gem 'rspec-puppet', :require => false
6 | gem 'puppetlabs_spec_helper', :require => false
7 | gem 'rspec-system', :require => false
8 | gem 'rspec-system-puppet', :require => false
9 | gem 'rspec-system-serverspec', :require => false
10 | gem 'serverspec', :require => false
11 | gem 'puppet-lint', :require => false
12 | end
13 |
14 | if puppetversion = ENV['PUPPET_GEM_VERSION']
15 | gem 'puppet', puppetversion, :require => false
16 | else
17 | gem 'puppet', :require => false
18 | end
19 |
20 | # vim:ft=ruby
21 |
--------------------------------------------------------------------------------
/modules/mysql/Modulefile:
--------------------------------------------------------------------------------
1 | name 'puppetlabs-mysql'
2 | version '0.8.1'
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 |
--------------------------------------------------------------------------------
/modules/mysql/Rakefile:
--------------------------------------------------------------------------------
1 | require 'puppetlabs_spec_helper/rake_tasks'
2 | require 'rspec-system/rake_task'
3 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/modules/mysql/manifests/java.pp:
--------------------------------------------------------------------------------
1 | # Class: mysql::java
2 | #
3 | # This class installs the mysql-java-connector.
4 | #
5 | # Parameters:
6 | # [*package_name*] - The name of the mysql java package.
7 | # [*package_ensure*] - Ensure state for package. Can be specified as version.
8 | # Actions:
9 | #
10 | # Requires:
11 | #
12 | # Sample Usage:
13 | #
14 | class mysql::java (
15 | $package_ensure = 'present',
16 | $package_name = $mysql::java_package_name
17 | ) inherits mysql {
18 |
19 | package { 'mysql-connector-java':
20 | ensure => $package_ensure,
21 | name => $package_name,
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/modules/mysql/manifests/perl.pp:
--------------------------------------------------------------------------------
1 | # Class: mysql::perl
2 | #
3 | # installs the perl bindings for mysql
4 | #
5 | # Parameters:
6 | # [*package_ensure*] - Ensure state for package. Can be specified as version.
7 | # [*package_name*] - name of package
8 | # [*package_provider*] - The provider to use to install the package
9 | #
10 | # Actions:
11 | #
12 | # Requires:
13 | #
14 | # Sample Usage:
15 | #
16 | class mysql::perl (
17 | $package_ensure = 'present',
18 | $package_name = $mysql::perl_package_name,
19 | $package_provider = $mysql::perl_package_provider
20 | ) inherits mysql {
21 |
22 | package{ 'perl_mysql':
23 | ensure => $package_ensure,
24 | name => $package_name,
25 | provider => $package_provider,
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/modules/mysql/manifests/php.pp:
--------------------------------------------------------------------------------
1 | # Class: mysql::php
2 | #
3 | # This class installs the php libs for mysql.
4 | #
5 | # Parameters:
6 | # [*package_ensure*] - Ensure state for package. Can be specified as version.
7 | # [*package_name*] - The name of package
8 | #
9 | class mysql::php(
10 | $package_ensure = 'present',
11 | $package_name = $mysql::php_package_name
12 | ) inherits mysql {
13 |
14 | package { 'php-mysql':
15 | ensure => $package_ensure,
16 | name => $package_name,
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/modules/mysql/manifests/python.pp:
--------------------------------------------------------------------------------
1 | # Class: mysql::python
2 | #
3 | # This class installs the python libs for mysql.
4 | #
5 | # Parameters:
6 | # [*package_ensure*] - Ensure state for package. Can be specified as version.
7 | # [*package_name*] - Name of package
8 | #
9 | # Actions:
10 | #
11 | # Requires:
12 | #
13 | # Sample Usage:
14 | #
15 | class mysql::python(
16 | $package_ensure = 'present',
17 | $package_name = $mysql::python_package_name
18 | ) inherits mysql {
19 |
20 | package { 'python-mysqldb':
21 | ensure => $package_ensure,
22 | name => $package_name,
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/modules/mysql/manifests/ruby.pp:
--------------------------------------------------------------------------------
1 | # Class: mysql::ruby
2 | #
3 | # installs the ruby bindings for mysql
4 | #
5 | # Parameters:
6 | # [*package_ensure*] - Ensure state for package. Can be specified as version.
7 | # [*package_name*] - name of package
8 | # [*package_provider*] - The provider to use to install the package
9 | #
10 | # Actions:
11 | #
12 | # Requires:
13 | #
14 | # Sample Usage:
15 | #
16 | class mysql::ruby (
17 | $package_ensure = 'present',
18 | $package_name = $mysql::ruby_package_name,
19 | $package_provider = $mysql::ruby_package_provider
20 | ) inherits mysql {
21 |
22 | package{ 'ruby_mysql':
23 | ensure => $package_ensure,
24 | name => $package_name,
25 | provider => $package_provider,
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/modules/mysql/manifests/server/account_security.pp:
--------------------------------------------------------------------------------
1 | # Some installations have some default users which are not required.
2 | # We remove them here. You can subclass this class to overwrite this behavior.
3 | class mysql::server::account_security {
4 | database_user {
5 | [ "root@${::fqdn}",
6 | 'root@127.0.0.1',
7 | 'root@::1',
8 | "@${::fqdn}",
9 | '@localhost',
10 | '@%']:
11 | ensure => 'absent',
12 | require => Class['mysql::config'],
13 | }
14 | if ($::fqdn != $::hostname) {
15 | database_user { ["root@${::hostname}", "@${::hostname}"]:
16 | ensure => 'absent',
17 | require => Class['mysql::config'],
18 | }
19 | }
20 | database { 'test':
21 | ensure => 'absent',
22 | require => Class['mysql::config'],
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/modules/mysql/manifests/server/monitor.pp:
--------------------------------------------------------------------------------
1 | #This is a helper class to add a monitoring user to the database
2 | #
3 | class mysql::server::monitor (
4 | $mysql_monitor_username,
5 | $mysql_monitor_password,
6 | $mysql_monitor_hostname
7 | ) {
8 |
9 | Class['mysql::server'] -> Class['mysql::server::monitor']
10 |
11 | database_user{ "${mysql_monitor_username}@${mysql_monitor_hostname}":
12 | ensure => present,
13 | password_hash => mysql_password($mysql_monitor_password),
14 | }
15 |
16 | database_grant { "${mysql_monitor_username}@${mysql_monitor_hostname}":
17 | privileges => [ 'process_priv', 'super_priv' ],
18 | require => Database_user["${mysql_monitor_username}@${mysql_monitor_hostname}"],
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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', :root_home => '/root' }
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 |
--------------------------------------------------------------------------------
/modules/mysql/spec/spec.opts:
--------------------------------------------------------------------------------
1 | --format
2 | s
3 | --colour
4 | --loadby
5 | mtime
6 | --backtrace
7 |
--------------------------------------------------------------------------------
/modules/mysql/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | require 'puppetlabs_spec_helper/module_spec_helper'
2 |
--------------------------------------------------------------------------------
/modules/mysql/spec/spec_helper_system.rb:
--------------------------------------------------------------------------------
1 | require 'rspec-system/spec_helper'
2 | require 'rspec-system-puppet/helpers'
3 | require 'rspec-system-serverspec/helpers'
4 |
5 | include RSpecSystemPuppet::Helpers
6 |
7 | include Serverspec::Helper::RSpecSystem
8 | include Serverspec::Helper::DetectOS
9 |
10 | RSpec.configure do |c|
11 | # Project root
12 | proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
13 |
14 | # Enable colour
15 | c.tty = true
16 |
17 | c.include RSpecSystemPuppet::Helpers
18 |
19 | # This is where we 'setup' the nodes before running our tests
20 | c.before :suite do
21 | # Install puppet
22 | puppet_install
23 |
24 | # Install modules and dependencies
25 | puppet_module_install(:source => proj_root, :module_name => 'mysql')
26 | shell('puppet module install puppetlabs-stdlib')
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/modules/mysql/spec/system/mysql_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper_system'
2 |
3 | describe 'mysql class' do
4 | describe 'running puppet code' do
5 | # Using puppet_apply as a helper
6 | it 'should work with no errors' do
7 | pp = <<-EOS
8 | class { 'mysql': }
9 | EOS
10 |
11 | # Run it twice and test for idempotency
12 | puppet_apply(pp) do |r|
13 | r.exit_code.should_not == 1
14 | r.refresh
15 | r.exit_code.should be_zero
16 | end
17 | end
18 | end
19 |
20 | describe package('mysql') do
21 | it { should be_installed }
22 | end
23 |
24 | describe service('mysql') do
25 | it { should_not be_running }
26 | it { should_not be_enabled }
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 ? '#' : '' %><%= key -%><%=
7 | case value
8 | when true, false
9 | ''
10 | else
11 | " = #{value}"
12 | end
13 | %>
14 | <% end -%>
15 | <% end -%>
16 |
17 | <% end -%>
18 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/modules/mysql/tests/init.pp:
--------------------------------------------------------------------------------
1 | include mysql
2 |
--------------------------------------------------------------------------------
/modules/mysql/tests/java.pp:
--------------------------------------------------------------------------------
1 | class { 'mysql::java':}
2 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/modules/mysql/tests/mysql_grant.pp:
--------------------------------------------------------------------------------
1 | database_grant{'test1@localhost/redmine':
2 | privileges => [update],
3 | }
4 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/modules/mysql/tests/perl.pp:
--------------------------------------------------------------------------------
1 | include mysql::perl
2 |
--------------------------------------------------------------------------------
/modules/mysql/tests/python.pp:
--------------------------------------------------------------------------------
1 | class { 'mysql::python':}
2 |
--------------------------------------------------------------------------------
/modules/mysql/tests/ruby.pp:
--------------------------------------------------------------------------------
1 | include mysql::ruby
2 |
--------------------------------------------------------------------------------
/modules/mysql/tests/server.pp:
--------------------------------------------------------------------------------
1 | class { 'mysql::server':
2 | config_hash => { 'root_password' => 'password', },
3 | }
4 |
--------------------------------------------------------------------------------
/modules/mysql/tests/server/account_security.pp:
--------------------------------------------------------------------------------
1 | class { 'mysql::server':
2 | config_hash => { 'root_password' => 'password', },
3 | }
4 | class { 'mysql::server::account_security': }
5 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/modules/php/.fixtures.yml:
--------------------------------------------------------------------------------
1 | fixtures:
2 | repositories:
3 | "puppi": "git://github.com/example42/puppi.git"
4 | "monitor": "git://github.com/example42/puppet-monitor.git"
5 | "firewall": "git://github.com/example42/puppet-firewall.git"
6 | "iptables": "git://github.com/example42/puppet-iptables.git"
7 | "concat": "git://github.com/example42/puppet-concat.git"
8 | symlinks:
9 | "php": "#{source_dir}"
10 |
11 |
--------------------------------------------------------------------------------
/modules/php/.gemfile:
--------------------------------------------------------------------------------
1 | source :rubygems
2 |
3 | puppetversion = ENV['PUPPET_VERSION']
4 | gem 'puppet', puppetversion, :require => false
5 | gem 'puppet-lint'
6 | gem 'puppetlabs_spec_helper', '>= 0.1.0'
7 |
--------------------------------------------------------------------------------
/modules/php/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | php
4 |
5 |
6 |
7 |
8 |
9 | org.cloudsmith.geppetto.pp.dsl.ui.modulefileBuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.xtext.ui.shared.xtextBuilder
15 |
16 |
17 |
18 |
19 |
20 | org.cloudsmith.geppetto.pp.dsl.ui.puppetNature
21 | org.eclipse.xtext.ui.shared.xtextNature
22 |
23 |
24 |
--------------------------------------------------------------------------------
/modules/php/.travis.yml:
--------------------------------------------------------------------------------
1 | language: ruby
2 | rvm:
3 | - 1.8.7
4 | - 1.9.3
5 | script:
6 | - "rake spec SPEC_OPTS='--format documentation'"
7 | env:
8 | - PUPPET_VERSION="~> 2.6.0"
9 | - PUPPET_VERSION="~> 2.7.0"
10 | - PUPPET_VERSION="~> 3.0.0"
11 | - PUPPET_VERSION="~> 3.1.0"
12 | matrix:
13 | exclude:
14 | - rvm: 1.9.3
15 | env: PUPPET_VERSION="~> 2.6.0"
16 | gemfile: .gemfile
17 |
18 | gemfile: .gemfile
19 | notifications:
20 | email:
21 | - al@lab42.it
22 |
--------------------------------------------------------------------------------
/modules/php/Modulefile:
--------------------------------------------------------------------------------
1 | name 'example42-php'
2 | version '2.0.8'
3 | author 'Alessandro Franceschi'
4 | license 'Apache2'
5 | project_page 'http://www.example42.com'
6 | source 'https://github.com/example42/puppet-php'
7 | summary 'Puppet module for php'
8 | description 'This module installs and manages php. Check README.rdoc for details. Puppi is required for some common functions: you can install them without using the whole module. Monitor and firewall dependencies are needed only if the relevant features are enabled'
9 | dependency 'example42/puppi', '>= 2.0.0'
10 |
--------------------------------------------------------------------------------
/modules/php/Rakefile:
--------------------------------------------------------------------------------
1 | require 'rubygems'
2 | require 'puppetlabs_spec_helper/rake_tasks'
3 | require 'puppet-lint'
4 | PuppetLint.configuration.send("disable_80chars")
5 | PuppetLint.configuration.send('disable_class_parameter_defaults')
6 |
--------------------------------------------------------------------------------
/modules/php/lib/facter/php_fact_extension_dir.rb:
--------------------------------------------------------------------------------
1 | Facter.add("php_fact_extension_dir") do
2 | setcode do
3 | Facter::Util::Resolution.exec('php-config --extension-dir') || nil
4 | end
5 | end
6 |
--------------------------------------------------------------------------------
/modules/php/lib/facter/php_fact_version.rb:
--------------------------------------------------------------------------------
1 | Facter.add("php_fact_version") do
2 | setcode do
3 | Facter::Util::Resolution.exec('php-config --version') || nil
4 | end
5 | end
6 |
--------------------------------------------------------------------------------
/modules/php/manifests/devel.pp:
--------------------------------------------------------------------------------
1 | # Class php::devel
2 | #
3 | # Installs php devel package
4 | #
5 | class php::devel {
6 |
7 | if $php::package_devel != '' {
8 | package { 'php-devel':
9 | ensure => $php::manage_package,
10 | name => $php::package_devel,
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/modules/php/manifests/ini.pp:
--------------------------------------------------------------------------------
1 | define php::ini (
2 | $value = '',
3 | $template = 'extra-ini.erb',
4 | $target = 'extra.ini',
5 | $service = $php::service
6 | ) {
7 |
8 | include php
9 |
10 | $config_dir = params_lookup( 'config_dir' )
11 |
12 | file { "${config_dir}/conf.d/${target}":
13 | ensure => 'present',
14 | content => template("php/${template}"),
15 | require => Package['php'],
16 | notify => Service[$service],
17 | }
18 |
19 | file { "${config_dir}/cli/conf.d/${target}":
20 | ensure => 'present',
21 | content => template("php/${template}"),
22 | require => Package['php'],
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/modules/php/manifests/pear.pp:
--------------------------------------------------------------------------------
1 | # Class: php::pear
2 | #
3 | # Installs Pear for PHP module
4 | #
5 | # Usage:
6 | # include php::pear
7 | #
8 | # == Parameters
9 | #
10 | # Standard class parameters
11 | # Define the general class behaviour and customizations
12 | #
13 | # [*package*]
14 | # Name of the package to install. Defaults to 'php-pear'
15 | #
16 | # [*install_package*]
17 | # Boolean. Determines if any package should be installed to support the PEAR functionality.
18 | # Can be false if PEAR was already provided by another package or module.
19 | # Default: true
20 | #
21 | class php::pear (
22 | $package = $php::package_pear,
23 | $install_package = true,
24 | $path = '/usr/bin:/usr/sbin:/bin:/sbin'
25 | ) inherits php {
26 |
27 | if ( $install_package ) {
28 | package { 'php-pear':
29 | name => $package,
30 | ensure => present,
31 | }
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/modules/php/manifests/pear/config.pp:
--------------------------------------------------------------------------------
1 | # Define: php::pear::config
2 | #
3 | # Configures pear
4 | #
5 | # Usage:
6 | # php::pear::config { http_proxy: value => "myproxy:8080" }
7 | #
8 | define php::pear::config ($value) {
9 |
10 | include php::pear
11 |
12 | exec { "pear-config-set-${name}":
13 | command => "pear config-set ${name} ${value}",
14 | path => $php::pear::path,
15 | unless => "pear config-get ${name} | grep ${value}",
16 | require => Package['php-pear'],
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/modules/php/manifests/spec.pp:
--------------------------------------------------------------------------------
1 | # Class: php::spec
2 | #
3 | # This class is used only for rpsec-puppet tests
4 | # Can be taken as an example on how to do custom classes but should not
5 | # be modified.
6 | #
7 | # == Usage
8 | #
9 | # This class is not intended to be used directly.
10 | # Use it as reference
11 | #
12 | class php::spec inherits php {
13 |
14 | # This just a test to override the arguments of an existing resource
15 | # Note that you can achieve this same result with just:
16 | # class { "php": template => "php/spec.erb" }
17 |
18 | File['php.conf'] {
19 | content => template('php/spec.erb'),
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/modules/php/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | require 'puppetlabs_spec_helper/module_spec_helper'
2 |
--------------------------------------------------------------------------------
/modules/php/templates/extra-ini.erb:
--------------------------------------------------------------------------------
1 | ; File Managed by Puppet
2 |
3 | <% if value != "" -%>
4 | <% if value.is_a? Array -%>
5 | <% value.each do |name| -%>
6 | <%= name %>
7 | <% end %>
8 | <% else -%>
9 | <%= value %>
10 | <% end -%>
11 | <% end -%>
12 |
--------------------------------------------------------------------------------
/modules/php/templates/spec.erb:
--------------------------------------------------------------------------------
1 | # This is a template used only for rspec tests
2 |
3 | # Yaml of the whole scope
4 | <%= scope.to_hash.reject { |k,v| !( k.is_a?(String) && v.is_a?(String) ) }.to_yaml %>
5 |
6 | # Custom Options
7 | <%= options['opt_a'] %>
8 | <%= options['opt_b'] %>
9 |
--------------------------------------------------------------------------------
/modules/puphpet/README.md:
--------------------------------------------------------------------------------
1 | # Puppet module: puphpet
2 |
3 | This is a Puppet module for [PuPHPet](https://puphpet.com)-related code
4 |
--------------------------------------------------------------------------------
/modules/puphpet/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "puphpet/puppet-puphpet",
3 | "type": "puphpet-module",
4 | "description": "Non-PHP! PuPHPet-specific things.",
5 | "keywords": ["puppet", "vm", "virtual machine"],
6 | "homepage": "https://github.com/puphpet/puppet-puphpet",
7 | "license": "MIT",
8 | "authors": [
9 | {
10 | "name": "PuPHPet",
11 | "homepage": "https://github.com/puphpet/puppet-puphpet"
12 | }
13 | ],
14 | "require": {
15 | "puphpet/puphpet-module-installer": "*"
16 | },
17 | "target-dir": "puphpet"
18 | }
19 |
--------------------------------------------------------------------------------
/modules/puphpet/manifests/dotfiles.pp:
--------------------------------------------------------------------------------
1 | # class puphpet::dotfiles
2 | #
3 | # copies dotfiles to vm
4 | #
5 | class puphpet::dotfiles (
6 | $match = '\.[a-zA-Z0-9]*',
7 | $source = '/vagrant/files/dot/',
8 | $target = '/home/vagrant/'
9 | ) {
10 |
11 | exec { 'dotfiles':
12 | command => "cp -r ${source}/${match} ${target}",
13 | onlyif => "test -d ${source}",
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/modules/puphpet/manifests/ini.pp:
--------------------------------------------------------------------------------
1 | # defined type puphpet::ini
2 | #
3 | # Writes custom ini files. This generation
4 | # is independent from any other resource, so you have to
5 | # notify the needed resources on your own.
6 | #
7 | # Example:
8 | # puphpet::ini { 'custom_php':
9 | # value => ['date.timezone = "America/Chicago"'],
10 | # ini => '/etc/php5/cgi/conf.d/custom_php.ini',
11 | # notify => Service['apache'],
12 | # }
13 | #
14 | define puphpet::ini (
15 | $value = '',
16 | $ini = undef,
17 | $template = 'extra-ini.erb'
18 | ) {
19 |
20 | if $ini {
21 | file { $ini:
22 | ensure => present,
23 | content => template("puphpet/${template}"),
24 | }
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/modules/puphpet/manifests/ini/removeblock.pp:
--------------------------------------------------------------------------------
1 | define puphpet::ini::removeblock (
2 | $block_name,
3 | $ini_file
4 | ) {
5 | $left_side_regex = 'perl -pi -w -e "s/^(\[?)'
6 | $right_side_regex = '(\]?)(.+\n)//"'
7 | $cmd = "${left_side_regex}${block_name}${right_side_regex}"
8 |
9 | exec { "${cmd} ${ini_file}":
10 | path => '/usr/bin/',
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/modules/puphpet/templates/extra-ini.erb:
--------------------------------------------------------------------------------
1 | ; File Managed by Puppet
2 |
3 | <% if value != "" -%>
4 | <% if value.is_a? Array -%>
5 | <% value.each do |name| -%>
6 | <%= name %>
7 | <% end %>
8 | <% else -%>
9 | <%= value %>
10 | <% end -%>
11 | <% end -%>
12 |
--------------------------------------------------------------------------------
/modules/puphpet/tests/ini.pp:
--------------------------------------------------------------------------------
1 | service { 'nginx':
2 | ensure => running,
3 | enable => true,
4 | hasrestart => true,
5 | hasstatus => true,
6 | }
7 |
8 | puphpet::ini { 'custom_php':
9 | value => ['date.timezone = "America/Chicago"'],
10 | ini => '/etc/php5/cgi/conf.d/custom_php.ini',
11 | notify => Service['nginx'],
12 | }
--------------------------------------------------------------------------------
/modules/puppi/.fixtures.yml:
--------------------------------------------------------------------------------
1 | fixtures:
2 | repositories:
3 | "concat": "git://github.com/example42/puppet-concat.git"
4 | symlinks:
5 | "puppi": "#{source_dir}"
6 |
--------------------------------------------------------------------------------
/modules/puppi/.gemfile:
--------------------------------------------------------------------------------
1 | source 'https://rubygems.org'
2 |
3 | puppetversion = ENV['PUPPET_VERSION']
4 | gem 'puppet', puppetversion, :require => false
5 | gem 'puppet-lint'
6 | gem 'puppetlabs_spec_helper', '>= 0.1.0'
7 |
--------------------------------------------------------------------------------
/modules/puppi/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | puppi
4 |
5 |
6 |
7 |
8 |
9 | org.cloudsmith.geppetto.pp.dsl.ui.modulefileBuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.xtext.ui.shared.xtextBuilder
15 |
16 |
17 |
18 |
19 |
20 | org.cloudsmith.geppetto.pp.dsl.ui.puppetNature
21 | org.eclipse.xtext.ui.shared.xtextNature
22 |
23 |
24 |
--------------------------------------------------------------------------------
/modules/puppi/.travis.yml:
--------------------------------------------------------------------------------
1 | language: ruby
2 | rvm:
3 | - 1.8.7
4 | - 1.9.3
5 | script:
6 | - "rake spec SPEC_OPTS='--format documentation'"
7 | env:
8 | - PUPPET_VERSION="~> 2.6.0"
9 | - PUPPET_VERSION="~> 2.7.0"
10 | - PUPPET_VERSION="~> 3.0.0"
11 | - PUPPET_VERSION="~> 3.1.0"
12 | matrix:
13 | exclude:
14 | - rvm: 1.9.3
15 | env: PUPPET_VERSION="~> 2.6.0"
16 | gemfile: .gemfile
17 |
18 | gemfile: .gemfile
19 | notifications:
20 | email:
21 | - al@lab42.it
22 |
--------------------------------------------------------------------------------
/modules/puppi/Modulefile:
--------------------------------------------------------------------------------
1 | name 'example42-puppi'
2 | version '2.0.8'
3 |
4 | author 'lab42'
5 | license 'Apache'
6 | project_page 'http://www.example42.com'
7 | source 'git://github.com/example42/puppi'
8 | summary 'Installs and configures Puppi'
9 | description 'This module provides the Puppi libraries required by Example42 modules and, if explicitely included, the puppi command, its working environment, the defines and procedures to deploy applications'
10 |
--------------------------------------------------------------------------------
/modules/puppi/Rakefile:
--------------------------------------------------------------------------------
1 | require 'rubygems'
2 | require 'puppetlabs_spec_helper/rake_tasks'
3 | require 'puppet-lint'
4 | PuppetLint.configuration.send("disable_80chars")
5 | PuppetLint.configuration.send('disable_class_parameter_defaults')
6 |
--------------------------------------------------------------------------------
/modules/puppi/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "example42/puppi",
3 | "description": "Puppet driven applications deployment tool",
4 | "homepage": "https://github.com/example42/puppi",
5 | "type": "library",
6 | "license": "Apache License, Version 2.0",
7 | "authors": [
8 | {
9 | "name": "Example42",
10 | "homepage": "http://www.example42.com/"
11 | }
12 | ]
13 | }
14 |
--------------------------------------------------------------------------------
/modules/puppi/files/info/readme/readme:
--------------------------------------------------------------------------------
1 | Default ReadMe File.
2 | Edit puppi/files/info/readme/readme to change this message
3 |
--------------------------------------------------------------------------------
/modules/puppi/files/info/readme/readme-default:
--------------------------------------------------------------------------------
1 | No extra node or role related info available.
2 | To have node or role specific extar info, create
3 | modules/puppi/files/info/readme/readme--$hostname or
4 | modules/puppi/files/info/readme/readme-$role
5 |
--------------------------------------------------------------------------------
/modules/puppi/files/mcollective/puppicheck:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # File Managed by Puppet
3 | PATH=$PATH:/usr/local/bin
4 |
5 | if [ ! $1 ] ; then
6 | echo "Provide at least a match pattern. For example:"
7 | echo "role=fep-pgol"
8 | exit 1
9 | fi
10 |
11 | filtered=$(echo $* | sed "s/[^a-Z0-9= _.\-]//Ig")
12 |
13 | randfile="$(mktemp)"
14 |
15 | trap "rm -f $randfile" SIGINT SIGTERM EXIT
16 |
17 | myarg=$(echo $filtered | sed -e "s/ / -F /g")
18 |
19 | mc-puppi check -F $myarg | tee $randfile
20 | grep FAILED $randfile && exit 1
21 | exit 0
22 |
23 |
--------------------------------------------------------------------------------
/modules/puppi/files/mcollective/puppideploy:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # File Managed by Puppet
3 | PATH=$PATH:/usr/local/bin
4 |
5 | if [ ! $2 ] ; then
6 | echo "Provide the hostname and the project you want to deploy:"
7 | echo "superdeploy web01.example42.com myapp"
8 | exit 1
9 | fi
10 |
11 | filtered=$(echo $* | sed "s/[^a-Z0-9= _.\-]//Ig")
12 |
13 | randfile="$(mktemp)"
14 |
15 | trap "rm -f $randfile" SIGINT SIGTERM EXIT
16 |
17 | myarg=$(echo $filtered | sed -e "s/ / -F /g")
18 |
19 | mc-puppi deploy -I $1 $2 | tee $randfile
20 | grep FAILED $randfile && exit 1
21 | exit 0
22 |
23 |
--------------------------------------------------------------------------------
/modules/puppi/files/scripts/clean_filelist.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # clean_filelist.sh - Made for Puppi
3 |
4 | # Sources common header for Puppi scripts
5 | . $(dirname $0)/header || exit 10
6 |
7 | # Show help
8 | showhelp () {
9 | echo "This script is used to cleanup a list of files to download from unwanted data"
10 | echo "It has 1 optional argument:"
11 | echo "The prefix, present in the list, to cut out when defining files to deploy"
12 | echo "The list file is defined as $downloadedfile , these variables are gathered from the Puppi runtime"
13 | echo " config file."
14 | echo
15 | echo "Example:"
16 | echo "clean_filelist.sh http://svn.example42.com/myproject"
17 | }
18 |
19 |
20 | if [ $1 ] ; then
21 | prefix=$1
22 | else
23 | prefix=""
24 | fi
25 |
26 | deployfilelist=$downloadedfile
27 |
28 | # Clean list
29 | cleanlist () {
30 |
31 | sed -i "s/^$prefix//g" $deployfilelist
32 |
33 | }
34 |
35 | cleanlist
36 |
--------------------------------------------------------------------------------
/modules/puppi/files/scripts/delete.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # delete.sh - Made for Puppi
3 |
4 | # Sources common header for Puppi scripts
5 | . $(dirname $0)/header || exit 10
6 |
7 | # Manage script variables
8 | if [ $1 ] ; then
9 | tobedeleted=$1
10 | else
11 | echo "You must provide a file or directory to delete!"
12 | exit 2
13 | fi
14 |
15 | if [ "$tobedeleted" = "/" ] ; then
16 | echo "Be Serious!"
17 | exit 2
18 | fi
19 |
20 | # Move file
21 | move () {
22 | mkdir $workdir/$project/deleted
23 | mv $tobedeleted $workdir/$project/deleted
24 | }
25 |
26 | move
27 |
--------------------------------------------------------------------------------
/modules/puppi/files/scripts/execute.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # execute.sh - Made for Puppi
3 | # This script just executes what is passed as argument
4 |
5 | # Sources common header for Puppi scripts
6 | . $(dirname $0)/header || exit 10
7 |
8 | #parse variables
9 | command=$(eval "echo "$*"")
10 |
11 | #execute command
12 | eval "${command}"
13 |
--------------------------------------------------------------------------------
/modules/puppi/files/scripts/header:
--------------------------------------------------------------------------------
1 | configfile="/etc/puppi/puppi.conf"
2 |
3 | # Load general configurations
4 | if [ ! -f $configfile ] ; then
5 | echo "Config file: $configfile not found"
6 | exit 2
7 | else
8 | . $configfile
9 | . $scriptsdir/functions
10 | fi
11 |
12 | # Load project runtime configuration
13 | projectconfigfile="$workdir/$project/config"
14 | if [ ! -f $projectconfigfile ] ; then
15 | echo "Project runtime config file: $projectconfigfile not found"
16 | exit 2
17 | else
18 | . $projectconfigfile
19 | fi
20 |
21 | # Activate debug
22 | case "$debug" in
23 | yes) set -x ;;
24 | full) set -xv ;;
25 | esac
26 |
--------------------------------------------------------------------------------
/modules/puppi/files/scripts/predeploy_tar.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # predeploy_tar.sh - Made for Puppi
3 |
4 | # Sources common header for Puppi scripts
5 | . $(dirname $0)/header || exit 10
6 |
7 | # Show help
8 | showhelp () {
9 | echo "This script unpacks (tar) file from the download dir (storedir) to the predeploydir"
10 | echo "It has the following options:"
11 | echo "\$1 (Required) - Name of the variable that identifies the tar to predeploy"
12 | echo
13 | echo "Examples:"
14 | echo "predeploy_tar.sh tarfile"
15 | }
16 |
17 | # Check Arguments
18 | if [ $1 ] ; then
19 | deployfilevar=$1
20 | deployfile="$(eval "echo \${$(echo ${deployfilevar})}")"
21 | else
22 | showhelp
23 | exit 2
24 | fi
25 |
26 | # Untar file
27 | untar () {
28 | cd $predeploydir
29 | # file $deployfile | grep gzip 2>&1>/dev/null
30 | # if [ $? == "0"] ; then
31 | tar -zxf $deployfile
32 | # else
33 | # tar -xvf $deployfile
34 | # fi
35 | }
36 |
37 | untar
38 |
--------------------------------------------------------------------------------
/modules/puppi/files/scripts/report_mail.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # report_mail.sh - Made for Puppi
3 | # This script sends a summary mail to the recipients defined in $1
4 | # Use a comma separated list for multiple emails
5 |
6 | # Sources common header for Puppi scripts
7 | . $(dirname $0)/header || exit 10
8 |
9 | # Check arguments & eventually apply runtimeconfig overwrite
10 | recipients=$1
11 | [ $report_email ] && recipients=$report_email
12 |
13 | # Main functions
14 | mail_send () {
15 | result=$(grep result $logdir/$project/$tag/summary | awk '{ print $NF }')
16 | cat $logdir/$project/$tag/summary | mail -s "[puppi] $result $action of $project on $(hostname)" $recipients
17 | }
18 |
19 | mail_send
20 |
21 | if [ "$EXITCRIT" = "1" ] ; then
22 | exit 2
23 | fi
24 |
25 | if [ "$EXITWARN" = "1" ] ; then
26 | exit 1
27 | fi
28 |
--------------------------------------------------------------------------------
/modules/puppi/files/scripts/service.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # service.sh - Made for Puppi
3 |
4 | # Sources common header for Puppi scripts
5 | . $(dirname $0)/header || exit 10
6 |
7 | # Show help
8 | showhelp () {
9 | echo "This script is used to manage one or more services"
10 | echo "It requires AT LEAST 2 arguments:"
11 | echo "First argument (\$1 - required) is the script command (stop|start|restart|reload)"
12 | echo "Second argument and following (\$2 - required) is the space separated list of sevices to manage"
13 | echo
14 | echo "Examples:"
15 | echo "service.sh stop monit puppet"
16 | }
17 |
18 | # Check arguments
19 | if [ $1 ] ; then
20 | servicecommand=$1
21 | else
22 | showhelp
23 | exit 2
24 | fi
25 |
26 |
27 | if [ $# -ge 2 ] ; then
28 | shift
29 | services=$@
30 | else
31 | showhelp
32 | exit 2
33 | fi
34 |
35 | # Manage service
36 | service () {
37 | for serv in $services ; do
38 | /etc/init.d/$serv $servicecommand
39 | done
40 | }
41 |
42 | service
43 |
--------------------------------------------------------------------------------
/modules/puppi/lib/facter/last_run.rb:
--------------------------------------------------------------------------------
1 | require 'facter'
2 | Facter.add("last_run") do
3 | confine :kernel => [ 'Linux' , 'SunOS' , 'FreeBSD' , 'Darwin' ]
4 | setcode do
5 | Facter::Util::Resolution.exec('date')
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/modules/puppi/lib/facter/puppi_projects.rb:
--------------------------------------------------------------------------------
1 | require 'facter'
2 | Facter.add("puppi_projects") do
3 | confine :kernel => [ 'Linux' , 'SunOS' , 'FreeBSD' , 'Darwin' ]
4 | setcode do
5 | Facter::Util::Resolution.exec('ls `grep projectsdir /etc/puppi/puppi.conf | sed \'s/projectsdir="\([^"]*\)"/\1/\'` | tr \'\n\' \',\' | sed \'s/,$//\'') if File.exists?("/etc/puppi/puppi.conf")
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/modules/puppi/lib/puppet/parser/functions/get_magicvar.rb:
--------------------------------------------------------------------------------
1 | #
2 | # get_magicvar.rb
3 | #
4 | # This define return the value of the the provided var name
5 | #
6 | module Puppet::Parser::Functions
7 | newfunction(:get_magicvar, :type => :rvalue, :doc => <<-EOS
8 | This returns the value of the input variable. For example if you input role
9 | it returns the value of $role'.
10 | EOS
11 | ) do |arguments|
12 |
13 | raise(Puppet::ParseError, "get_magicvar(): Wrong number of arguments " +
14 | "given (#{arguments.size} for 1)") if arguments.size < 1
15 |
16 | my_var = arguments[0]
17 | result = lookupvar("#{my_var}")
18 | result = 'all' if ( result == :undefined || result == '' )
19 | return result
20 | end
21 | end
22 |
23 | # vim: set ts=2 sw=2 et :
24 |
--------------------------------------------------------------------------------
/modules/puppi/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 |
--------------------------------------------------------------------------------
/modules/puppi/lib/puppet/parser/functions/is_array.rb:
--------------------------------------------------------------------------------
1 | #
2 | # is_array.rb
3 | #
4 | # Imported from puppetlabs-stdlib
5 |
6 | module Puppet::Parser::Functions
7 | newfunction(:is_array, :type => :rvalue, :doc => <<-EOS
8 | Returns true if the variable passed to this function is an array.
9 | EOS
10 | ) do |arguments|
11 |
12 | raise(Puppet::ParseError, "is_array(): Wrong number of arguments " +
13 | "given (#{arguments.size} for 1)") if arguments.size < 1
14 |
15 | type = arguments[0]
16 |
17 | result = type.is_a?(Array)
18 |
19 | return result
20 | end
21 | end
22 |
23 | # vim: set ts=2 sw=2 et :
24 |
--------------------------------------------------------------------------------
/modules/puppi/manifests/helper.pp:
--------------------------------------------------------------------------------
1 | # Define puppi::helper
2 | #
3 | # The Puppi 2.0 define that creates an helper file that contains
4 | # the commands to execute, for the different puppi actions, using
5 | # the variables present in the datafile
6 | #
7 | # == Usage
8 | # Basic Usage:
9 | # puppi::helper { "myhelper":
10 | # template => 'myproject/puppi/helpers/myhelper.erb',
11 | # }
12 | #
13 | define puppi::helper (
14 | $template,
15 | $ensure = 'present' ) {
16 |
17 | require puppi
18 | require puppi::params
19 |
20 | file { "puppi_helper_${name}":
21 | ensure => $ensure,
22 | path => "${puppi::params::helpersdir}/${name}.yml",
23 | mode => '0644',
24 | owner => $puppi::params::configfile_owner,
25 | group => $puppi::params::configfile_group,
26 | content => template($template),
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/modules/puppi/manifests/helpers.pp:
--------------------------------------------------------------------------------
1 | # Class puppi::helpers
2 | #
3 | # A class that defines all the default helpers used by Example42
4 | # modules
5 | #
6 | # == Usage
7 | # Automatically included by Puppi
8 | #
9 | class puppi::helpers {
10 |
11 | # Standard helper for Example42 modules
12 | puppi::helper { 'standard':
13 | template => 'puppi/helpers/standard.yml.erb',
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/modules/puppi/manifests/info/instance.pp:
--------------------------------------------------------------------------------
1 | # Define puppi::info::instance
2 | #
3 | # This is a puppi info plugin specific for the tomcat::instance define
4 | #
5 | define puppi::info::instance (
6 | $servicename = '',
7 | $processname = '',
8 | $configdir = '',
9 | $bindir = '',
10 | $pidfile = '',
11 | $datadir = '',
12 | $logdir = '',
13 | $httpport = '',
14 | $controlport = '',
15 | $ajpport = '',
16 | $description = '',
17 | $run = '',
18 | $verbose = 'no',
19 | $templatefile = 'puppi/info/instance.erb' ) {
20 |
21 | require puppi
22 | require puppi::params
23 |
24 | file { "${puppi::params::infodir}/${name}":
25 | ensure => present,
26 | mode => '0750',
27 | owner => $puppi::params::configfile_owner,
28 | group => $puppi::params::configfile_group,
29 | content => template($templatefile),
30 | tag => 'puppi_info',
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/modules/puppi/manifests/log.pp:
--------------------------------------------------------------------------------
1 | # Define puppi::log
2 | #
3 | # This define creates a basic log file that simply contains
4 | # the list of logs to show when issuing the puppi log command.
5 | #
6 | # == Usage:
7 | # puppi::log { "system":
8 | # description => "General System Logs" ,
9 | # log => [ "/var/log/syslog" , "/var/log/messages" ],
10 | # }
11 | #
12 | # :include:../README.log
13 | #
14 | define puppi::log (
15 | $log,
16 | $description = '' ) {
17 |
18 | require puppi
19 | require puppi::params
20 |
21 | $array_log = is_array($log) ? {
22 | false => split($log, ','),
23 | default => $log,
24 | }
25 |
26 | file { "${puppi::params::logsdir}/${name}":
27 | ensure => 'present',
28 | mode => '0644',
29 | owner => $puppi::params::configfile_owner,
30 | group => $puppi::params::configfile_group,
31 | require => Class['puppi'],
32 | content => template('puppi/log.erb'),
33 | tag => 'puppi_log',
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/modules/puppi/manifests/mcollective/server.pp:
--------------------------------------------------------------------------------
1 | # = Class puppi::mcollective::server
2 | #
3 | # This class installs the puppi agent on mcollective servers
4 | # (Note that in mcollective terminology a server is an host
5 | # managed by a mcollective client)
6 | #
7 | # == Usage:
8 | # include puppi::mcollective::server
9 | #
10 | # :include:../README.mcollective
11 | #
12 | class puppi::mcollective::server {
13 |
14 | require puppi::params
15 |
16 | file { "${puppi::params::mcollective}/agent/puppi.ddl":
17 | ensure => 'present',
18 | mode => '0644',
19 | owner => 'root',
20 | group => 'root',
21 | source => 'puppet:///modules/puppi/mcollective/puppi.ddl',
22 | }
23 |
24 | file { "${puppi::params::mcollective}/agent/puppi.rb":
25 | ensure => 'present',
26 | mode => '0644',
27 | owner => 'root',
28 | group => 'root',
29 | source => 'puppet:///modules/puppi/mcollective/puppi.rb',
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/modules/puppi/manifests/one.pp:
--------------------------------------------------------------------------------
1 | # Class: puppi::one
2 | #
3 | # Installs Puppi 1.0
4 | #
5 | class puppi::one {
6 |
7 | require puppi::params
8 |
9 | # Main configuration file
10 | file { 'puppi.conf':
11 | ensure => present,
12 | path => "${puppi::params::basedir}/puppi.conf",
13 | mode => '0644',
14 | owner => $puppi::params::configfile_owner,
15 | group => $puppi::params::configfile_group,
16 | content => template($puppi::template),
17 | require => File['puppi_basedir'],
18 | }
19 |
20 | # The Puppi 1.0 command
21 | file { 'puppi':
22 | ensure => present,
23 | path => '/usr/sbin/puppi.one',
24 | mode => '0750',
25 | owner => $puppi::params::configfile_owner,
26 | group => $puppi::params::configfile_group,
27 | content => template('puppi/puppi.erb'),
28 | require => File['puppi_basedir'],
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/modules/puppi/manifests/run.pp:
--------------------------------------------------------------------------------
1 | # Define puppi::run
2 | #
3 | # This define triggers a puppi deploy run directly during Puppet
4 | # execution. It can be used to automate FIRST TIME applications
5 | # deployments directly during the first Puppet execution
6 | #
7 | # == Variables
8 | #
9 | # [*name*]
10 | # The title/name you use has to be the name of an existing puppi::project
11 | # procedure define
12 | #
13 | # == Usage
14 | # Basic Usage:
15 | # puppi::run { "myapp": }
16 | #
17 | define puppi::run (
18 | $project = '',
19 | $timeout = 300) {
20 |
21 | require puppi
22 |
23 | exec { "Run_Puppi_${name}":
24 | command => "puppi deploy ${name}; [ $? -le \"1\" ] && touch ${puppi::params::archivedir}/puppirun_${name}",
25 | path => '/bin:/sbin:/usr/sbin:/usr/bin',
26 | creates => "${puppi::params::archivedir}/puppirun_${name}",
27 | timeout => $timeout,
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/modules/puppi/manifests/two.pp:
--------------------------------------------------------------------------------
1 | # Class: puppi::two
2 | #
3 | # Installs Puppi NextGen
4 | #
5 | class puppi::two {
6 |
7 | # The Puppi command
8 | package { 'puppi':
9 | ensure => present,
10 | provider => 'gem',
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/modules/puppi/spec/classes/puppi_spec.rb:
--------------------------------------------------------------------------------
1 | require "#{File.join(File.dirname(__FILE__),'..','spec_helper.rb')}"
2 |
3 | describe 'puppi' do
4 |
5 | let(:node) { 'rspec.example42.com' }
6 | let(:node) { 'rspec.example42.com' }
7 | let(:facts) { { :ipaddress => '10.42.42.42' } }
8 |
9 | describe 'Test standard installation' do
10 | it { should contain_file('puppi').with_ensure('present') }
11 | it { should contain_file('puppi.conf').with_ensure('present') }
12 | it { should contain_file('puppi.scripts').with_ensure('present') }
13 | it { should contain_file('puppi_basedir').with_ensure('directory') }
14 | it { should contain_file('puppi_datadir').with_ensure('directory') }
15 | end
16 |
17 | end
18 |
--------------------------------------------------------------------------------
/modules/puppi/spec/defines/puppi_check_spec.rb:
--------------------------------------------------------------------------------
1 | require "#{File.join(File.dirname(__FILE__),'..','spec_helper.rb')}"
2 |
3 | describe 'puppi::check' do
4 |
5 | let(:title) { 'puppi::check' }
6 | let(:node) { 'rspec.example42.com' }
7 | let(:facts) { { :arch => 'i386' } }
8 | let(:params) {
9 | { 'enable' => 'true',
10 | 'name' => 'get',
11 | 'command' => 'echo',
12 | 'priority' => '50',
13 | 'project' => 'myapp',
14 | }
15 | }
16 |
17 | describe 'Test puppi check step file creation' do
18 | it 'should create a puppi::check step file' do
19 | should contain_file('Puppi_check_myapp_50_get').with_ensure('present')
20 | end
21 | it 'should populate correctly the puppi::check step file' do
22 | content = catalogue.resource('file', 'Puppi_check_myapp_50_get').send(:parameters)[:content]
23 | content.should match "/usr/lib/nagios/plugins/echo\n"
24 | end
25 | end
26 |
27 | end
28 |
--------------------------------------------------------------------------------
/modules/puppi/spec/defines/puppi_deploy_spec.rb:
--------------------------------------------------------------------------------
1 | require "#{File.join(File.dirname(__FILE__),'..','spec_helper.rb')}"
2 |
3 | describe 'puppi::deploy' do
4 |
5 | let(:title) { 'puppi::deploy' }
6 | let(:node) { 'rspec.example42.com' }
7 | let(:params) {
8 | { 'enable' => 'true',
9 | 'name' => 'get',
10 | 'command' => 'echo',
11 | 'priority' => '50',
12 | 'project' => 'myapp',
13 | }
14 | }
15 |
16 | describe 'Test puppi deploy step file creation' do
17 | it 'should create a puppi::deploy step file' do
18 | should contain_file('/etc/puppi/projects/myapp/deploy/50-get').with_ensure('present')
19 | end
20 | it 'should populate correctly the puppi::deploy step file' do
21 | content = catalogue.resource('file', '/etc/puppi/projects/myapp/deploy/50-get').send(:parameters)[:content]
22 | content.should match "su - root -c \"export project=myapp && /etc/puppi/scripts/echo \"\n"
23 | end
24 | end
25 |
26 | end
27 |
--------------------------------------------------------------------------------
/modules/puppi/spec/defines/puppi_helper_spec.rb:
--------------------------------------------------------------------------------
1 | require "#{File.join(File.dirname(__FILE__),'..','spec_helper.rb')}"
2 |
3 | describe 'puppi::helper' do
4 |
5 | let(:title) { 'spec' }
6 | let(:node) { 'rspec.example42.com' }
7 | let(:params) {
8 | { 'template' => 'puppi/helpers/standard.yml.erb' }
9 | }
10 |
11 | describe 'Test puppi helper file creation' do
12 | it 'should create a puppi helper file' do
13 | should contain_file('puppi_helper_spec').with_ensure('present')
14 | end
15 | it 'should populate correctly the helper file' do
16 | content = catalogue.resource('file', 'puppi_helper_spec').send(:parameters)[:content]
17 | content.should match('info:')
18 | end
19 | end
20 |
21 | end
22 |
--------------------------------------------------------------------------------
/modules/puppi/spec/defines/puppi_info_spec.rb:
--------------------------------------------------------------------------------
1 | require "#{File.join(File.dirname(__FILE__),'..','spec_helper.rb')}"
2 |
3 | describe 'puppi::info' do
4 |
5 | let(:title) { 'puppi::info' }
6 | let(:node) { 'rspec.example42.com' }
7 | let(:params) {
8 | { 'name' => 'sample',
9 | 'description' => 'Sample Info',
10 | 'templatefile' => 'puppi/info.erb',
11 | 'run' => 'myownscript',
12 | }
13 | }
14 |
15 | describe 'Test puppi info step file creation' do
16 | it 'should create a puppi::info step file' do
17 | should contain_file('/etc/puppi/info/sample').with_ensure('present')
18 | end
19 | it 'should populate correctly the puppi::info step file' do
20 | content = catalogue.resource('file', '/etc/puppi/info/sample').send(:parameters)[:content]
21 | content.should match(/myownscript/)
22 | end
23 | end
24 |
25 | end
26 |
--------------------------------------------------------------------------------
/modules/puppi/spec/defines/puppi_log_spec.rb:
--------------------------------------------------------------------------------
1 | require "#{File.join(File.dirname(__FILE__),'..','spec_helper.rb')}"
2 |
3 | describe 'puppi::log' do
4 |
5 | let(:title) { 'mylog' }
6 | let(:node) { 'rspec.example42.com' }
7 | let(:params) {
8 | { 'log' => '/var/log/mylog.log',
9 | 'description' => 'My Log',
10 | }
11 | }
12 |
13 | describe 'Test puppi log file creation' do
14 | it 'should create a puppi::log file' do
15 | should contain_file('/etc/puppi/logs/mylog').with_ensure('present')
16 | end
17 | it 'should populate correctly the puppi::log step file' do
18 | content = catalogue.resource('file', '/etc/puppi/logs/mylog').send(:parameters)[:content]
19 | content.should match(/mylog.log/)
20 | end
21 | end
22 |
23 | end
24 |
--------------------------------------------------------------------------------
/modules/puppi/spec/defines/puppi_project_spec.rb:
--------------------------------------------------------------------------------
1 | require "#{File.join(File.dirname(__FILE__),'..','spec_helper.rb')}"
2 |
3 | describe 'puppi::report' do
4 |
5 | let(:title) { 'puppi::report' }
6 | let(:node) { 'rspec.example42.com' }
7 | let(:params) {
8 | { 'enable' => 'true',
9 | 'name' => 'get',
10 | 'command' => 'echo',
11 | 'priority' => '50',
12 | 'project' => 'myapp',
13 | }
14 | }
15 |
16 | describe 'Test puppi report step file creation' do
17 | it 'should create a puppi::report step file' do
18 | should contain_file('/etc/puppi/projects/myapp/report/50-get').with_ensure('present')
19 | end
20 | it 'should populate correctly the puppi::report step file' do
21 | content = catalogue.resource('file', '/etc/puppi/projects/myapp/report/50-get').send(:parameters)[:content]
22 | content.should match "su - root -c \"export project=myapp && /etc/puppi/scripts/echo \"\n"
23 | # content.should match(/myapp,get/)
24 | end
25 | end
26 |
27 | end
28 |
--------------------------------------------------------------------------------
/modules/puppi/spec/defines/puppi_report_spec.rb:
--------------------------------------------------------------------------------
1 | require "#{File.join(File.dirname(__FILE__),'..','spec_helper.rb')}"
2 |
3 | describe 'puppi::report' do
4 |
5 | let(:title) { 'puppi::report' }
6 | let(:node) { 'rspec.example42.com' }
7 | let(:params) {
8 | { 'enable' => 'true',
9 | 'name' => 'get',
10 | 'command' => 'echo',
11 | 'priority' => '50',
12 | 'project' => 'myapp',
13 | }
14 | }
15 |
16 | describe 'Test puppi report step file creation' do
17 | it 'should create a puppi::report step file' do
18 | should contain_file('/etc/puppi/projects/myapp/report/50-get').with_ensure('present')
19 | end
20 | it 'should populate correctly the puppi::report step file' do
21 | content = catalogue.resource('file', '/etc/puppi/projects/myapp/report/50-get').send(:parameters)[:content]
22 | content.should match "su - root -c \"export project=myapp && /etc/puppi/scripts/echo \"\n"
23 | # content.should match(/myapp,get/)
24 | end
25 | end
26 |
27 | end
28 |
--------------------------------------------------------------------------------
/modules/puppi/spec/defines/puppi_rollback_spec.rb:
--------------------------------------------------------------------------------
1 | require "#{File.join(File.dirname(__FILE__),'..','spec_helper.rb')}"
2 |
3 | describe 'puppi::rollback' do
4 |
5 | let(:title) { 'puppi::rollback' }
6 | let(:node) { 'rspec.example42.com' }
7 | let(:params) {
8 | { 'enable' => 'true',
9 | 'name' => 'get',
10 | 'command' => 'echo',
11 | 'priority' => '50',
12 | 'project' => 'myapp',
13 | }
14 | }
15 |
16 | describe 'Test puppi rollback step file creation' do
17 | it 'should create a puppi::rollback step file' do
18 | should contain_file('/etc/puppi/projects/myapp/rollback/50-get').with_ensure('present')
19 | end
20 | it 'should populate correctly the puppi::rollback step file' do
21 | content = catalogue.resource('file', '/etc/puppi/projects/myapp/rollback/50-get').send(:parameters)[:content]
22 | content.should match "su - root -c \"export project=myapp && /etc/puppi/scripts/echo \"\n"
23 | end
24 | end
25 |
26 | end
27 |
--------------------------------------------------------------------------------
/modules/puppi/spec/defines/puppi_run_spec.rb:
--------------------------------------------------------------------------------
1 | require "#{File.join(File.dirname(__FILE__),'..','spec_helper.rb')}"
2 |
3 | describe 'puppi::run' do
4 |
5 | let(:title) { 'myapp' }
6 | let(:node) { 'rspec.example42.com' }
7 | let(:params) {
8 | {
9 | 'project' => 'myapp',
10 | }
11 | }
12 |
13 | describe 'Test puppi run exe creation' do
14 | it 'should create a puppi::run exec' do
15 | content = catalogue.resource('exec', 'Run_Puppi_myapp').send(:parameters)[:command]
16 | content.should match /puppi deploy myapp/
17 | end
18 | end
19 |
20 | end
21 |
--------------------------------------------------------------------------------
/modules/puppi/spec/defines/puppi_todo_spec.rb:
--------------------------------------------------------------------------------
1 | require "#{File.join(File.dirname(__FILE__),'..','spec_helper.rb')}"
2 |
3 | describe 'puppi::todo' do
4 |
5 | let(:title) { 'mytodo' }
6 | let(:node) { 'rspec.example42.com' }
7 | let(:params) {
8 | { 'notes' => 'Test Notes',
9 | 'description' => 'Test Description',
10 | 'check_command' => 'check_test',
11 | 'run' => 'test',
12 | }
13 | }
14 |
15 | describe 'Test puppi todo file creation' do
16 | it 'should create a puppi::todo file' do
17 | should contain_file('/etc/puppi/todo/mytodo').with_ensure('present')
18 | end
19 | it 'should populate correctly the puppi::todo step file' do
20 | content = catalogue.resource('file', '/etc/puppi/todo/mytodo').send(:parameters)[:content]
21 | content.should match(/check_test/)
22 | end
23 | end
24 |
25 | end
26 |
--------------------------------------------------------------------------------
/modules/puppi/spec/defines/puppi_ze_spec.rb:
--------------------------------------------------------------------------------
1 | require "#{File.join(File.dirname(__FILE__),'..','spec_helper.rb')}"
2 |
3 | describe 'puppi::ze' do
4 |
5 | let(:title) { 'sample' }
6 | let(:node) { 'rspec.example42.com' }
7 | let(:params) {
8 | { 'helper' => 'mytest',
9 | 'variables' => { 'var1' => 'get', 'var2' => 'got' },
10 | 'name' => 'sample',
11 | }
12 | }
13 |
14 | describe 'Test puppi ze data file creation' do
15 | it 'should create a puppi::ze step file' do
16 | should contain_file('puppize_sample').with_ensure('present')
17 | end
18 | it 'should populate correctly the puppi::ze data file' do
19 | content = catalogue.resource('file', 'puppize_sample').send(:parameters)[:content]
20 | content.should match(/var1: get/)
21 | end
22 | end
23 |
24 | end
25 |
--------------------------------------------------------------------------------
/modules/puppi/spec/functions/any2bool_spec.rb:
--------------------------------------------------------------------------------
1 | require "#{File.join(File.dirname(__FILE__),'..','spec_helper.rb')}"
2 |
3 | describe 'any2bool' do
4 |
5 | describe 'Test Any2True' do
6 | it { should run.with_params(true).and_return(true) }
7 | it { should run.with_params('true').and_return(true) }
8 | it { should run.with_params('yes').and_return(true) }
9 | it { should run.with_params('y').and_return(true) }
10 | end
11 |
12 | describe 'Test Any2false' do
13 | it { should run.with_params(false).and_return(false) }
14 | it { should run.with_params('false').and_return(false) }
15 | it { should run.with_params('no').and_return(false) }
16 | it { should run.with_params('n').and_return(false) }
17 | end
18 |
19 |
20 | end
21 |
--------------------------------------------------------------------------------
/modules/puppi/spec/functions/bool2ensure_spec.rb:
--------------------------------------------------------------------------------
1 | require "#{File.join(File.dirname(__FILE__),'..','spec_helper.rb')}"
2 |
3 | describe 'bool2ensure' do
4 |
5 | describe 'Test true2present' do
6 | it { should run.with_params(true).and_return('present') }
7 | it { should run.with_params('true').and_return('present') }
8 | it { should run.with_params('yes').and_return('present') }
9 | it { should run.with_params('y').and_return('present') }
10 | end
11 |
12 | describe 'Test false2absent' do
13 | it { should run.with_params(false).and_return('absent') }
14 | it { should run.with_params('false').and_return('absent') }
15 | it { should run.with_params('no').and_return('absent') }
16 | it { should run.with_params('n').and_return('absent') }
17 | end
18 |
19 |
20 | end
21 |
--------------------------------------------------------------------------------
/modules/puppi/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | # Based on https://github.com/puppetlabs/puppetlabs-ntp/blob/master/spec/spec_helper.rb
2 | # Thanks to Ken Barber for advice about http://projects.puppetlabs.com/issues/11191
3 | require 'puppet'
4 | require 'rspec-puppet'
5 | require 'tmpdir'
6 |
7 | RSpec.configure do |c|
8 | c.before :each do
9 | @puppetdir = Dir.mktmpdir("puppi")
10 | manifestdir = File.join(@puppetdir, "manifests")
11 | Dir.mkdir(manifestdir)
12 | FileUtils.touch(File.join(manifestdir, "site.pp"))
13 | Puppet[:confdir] = @puppetdir
14 | end
15 |
16 | c.after :each do
17 | # FileUtils.remove_entry_secure(@puppetdir) # This breaks with multiple spec files
18 | FileUtils.rm_rf(Dir.glob('/tmp/puppi20*') , :secure => true)
19 | end
20 |
21 | c.module_path = File.join(File.dirname(__FILE__), '../../')
22 | end
23 |
--------------------------------------------------------------------------------
/modules/puppi/templates/info.erb:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # <%= @description %>
3 | # Script generated by Puppet. It's executed when you run:
4 | # puppi info <%= @name %>
5 | #
6 | # Sources common header for Puppi scripts
7 | . <%= scope.lookupvar('puppi::params::scriptsdir') %>/header || exit 10
8 |
9 | echo_title "$HOSTNAME - <%= @description %>"
10 | <% @array_run.each do |cmd| %>show_command "<%= cmd %>"
11 | <% end %>
12 |
--------------------------------------------------------------------------------
/modules/puppi/templates/info/readme.erb:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # <%= @description %>
3 | # Script generated by Puppet. It's executed when you run:
4 | # puppi info <%= @name %>
5 | #
6 | # Sources common header for Puppi scripts
7 | . <%= scope.lookupvar('puppi::params::scriptsdir') %>/header || exit 10
8 |
9 | # Show ReadMe file
10 | echo_title "$HOSTNAME - <%= @name %>: ReadMe"
11 | show_command "cat <%= scope.lookupvar('puppi::params::readmedir') %>/<%= @name %>"
12 |
13 | <% if @autoreadme = "yes" %>
14 | echo_title "$HOSTNAME - <%= @name %>: ReadMe Custom"
15 | show_command "cat <%= scope.lookupvar('puppi::params::readmedir') %>/<%= @name %>-custom"
16 | <% end %>
17 |
18 | <% if @run != "" %>
19 | echo_title "$HOSTNAME - <%= @name %>: Extra info"
20 | <% @run.each do |cmd| %>show_command "<%= cmd %>"
21 | <% end %>
22 | <% end %>
23 |
--------------------------------------------------------------------------------
/modules/puppi/templates/install_packages.erb:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # File Managed by Puppet
3 | export PATH=$PATH:/bin:/sbin:/usr/bin:usr/sbin
4 | <% if scope.lookupvar('::operatingsystem') == 'Debian' or scope.lookupvar('::operatingsystem') == 'Ubuntu' -%>
5 | apt-get update ; apt-get install -y <%= @packages %>
6 | <% elsif scope.lookupvar('::operatingsystem') == 'Centos' or scope.lookupvar('::operatingsystem') == 'RedHat' -%>
7 | yum install -y <%= @packages %>
8 | <% end -%>
9 |
--------------------------------------------------------------------------------
/modules/puppi/templates/log.erb:
--------------------------------------------------------------------------------
1 | <% @array_log.each do |path| %><%= path %>
2 | <% end %>
3 |
--------------------------------------------------------------------------------
/modules/puppi/templates/puppi.conf.erb:
--------------------------------------------------------------------------------
1 | # General configuration file for Puppi tools
2 | # This file is managed by Puppet
3 |
4 | # Directory locations
5 | basedir="<%= scope.lookupvar('puppi::params::basedir') %>"
6 | checksdir="<%= scope.lookupvar('puppi::params::checksdir') %>"
7 | workdir="<%= scope.lookupvar('puppi::params::workdir') %>"
8 | projectsdir="<%= scope.lookupvar('puppi::params::projectsdir') %>"
9 | scriptsdir="<%= scope.lookupvar('puppi::params::scriptsdir') %>"
10 | libdir="<%= scope.lookupvar('puppi::params::libdir') %>"
11 | archivedir="<%= scope.lookupvar('puppi::params::archivedir') %>"
12 | logdir="<%= scope.lookupvar('puppi::params::logdir') %>"
13 | logsdir="<%= scope.lookupvar('puppi::params::logsdir') %>"
14 | infodir="<%= scope.lookupvar('puppi::params::infodir') %>"
15 | tododir="<%= scope.lookupvar('puppi::params::tododir') %>"
16 |
--------------------------------------------------------------------------------
/modules/puppi/templates/todo.erb:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Script generated by Puppet. It's executed when you run:
3 | # puppi todo <%= name %>
4 | #
5 | # Sources common header for Puppi scripts
6 | . <%= scope.lookupvar('puppi::params::scriptsdir') %>/header || exit 10
7 |
8 | echo_title "$HOSTNAME - <%= name %>"
9 |
10 | <% if @description != "" -%>
11 | cat <
13 | EOF
14 | <% end -%>
15 |
16 | <% if @notes != "" -%>
17 | cat <
19 | EOF
20 | <% end -%>
21 |
22 | <% if @run != "" -%>
23 | <% array_run.each do |cmd| %>show_command "<%= cmd -%>"
24 | <% end -%>
25 | <% end -%>
26 |
27 | <% if @check_command != "" -%>
28 | <%= @check_command %>
29 | if [ "x$?" = "x0" ] ; then
30 | echo_success
31 | result="OK"
32 | else
33 | echo_failure
34 | result="CRITICAL"
35 | EXITCRIT="1"
36 | fi
37 | <% else -%>
38 | echo_warning
39 | result="WARNING"
40 | EXITWARN="1"
41 | <% end -%>
42 |
43 |
--------------------------------------------------------------------------------
/modules/stdlib/.rspec:
--------------------------------------------------------------------------------
1 | --color
2 | --format
3 | progress
4 | --backtrace
5 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/modules/stdlib/Modulefile:
--------------------------------------------------------------------------------
1 | name 'puppetlabs-stdlib'
2 | version '2.6.0'
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 |
--------------------------------------------------------------------------------
/modules/stdlib/Rakefile:
--------------------------------------------------------------------------------
1 | require 'rake'
2 | require 'rspec/core/rake_task'
3 |
4 | task :default => [:test]
5 |
6 | desc 'Run RSpec'
7 | RSpec::Core::RakeTask.new(:test) do |t|
8 | t.pattern = 'spec/{unit}/**/*.rb'
9 | t.rspec_opts = ['--color']
10 | end
11 |
12 | desc 'Generate code coverage'
13 | RSpec::Core::RakeTask.new(:coverage) do |t|
14 | t.rcov = true
15 | t.rcov_opts = ['--exclude', 'spec']
16 | end
17 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/modules/stdlib/lib/puppet/parser/functions/ensure_packages.rb:
--------------------------------------------------------------------------------
1 | #
2 | # ensure_packages.rb
3 | #
4 | require 'puppet/parser/functions'
5 |
6 | module Puppet::Parser::Functions
7 | newfunction(:ensure_packages, :type => :statement, :doc => <<-EOS
8 | Takes a list of packages and only installs them if they don't already exist.
9 | EOS
10 | ) do |arguments|
11 |
12 | raise(Puppet::ParseError, "ensure_packages(): Wrong number of arguments " +
13 | "given (#{arguments.size} for 1)") if arguments.size != 1
14 | raise(Puppet::ParseError, "ensure_packages(): Requires array " +
15 | "given (#{arguments[0].class})") if !arguments[0].kind_of?(Array)
16 |
17 | Puppet::Parser::Functions.function(:ensure_resource)
18 | arguments[0].each { |package_name|
19 | function_ensure_resource(['package', package_name, {'ensure' => 'present' } ])
20 | }
21 | end
22 | end
23 |
24 | # vim: set ts=2 sw=2 et :
25 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/modules/stdlib/lib/puppet/parser/functions/max.rb:
--------------------------------------------------------------------------------
1 | module Puppet::Parser::Functions
2 | newfunction(:max, :type => :rvalue, :doc => <<-EOS
3 | Returns the highest value of all arguments.
4 | Requires at least one argument.
5 | EOS
6 | ) do |args|
7 |
8 | raise(Puppet::ParseError, "max(): Wrong number of arguments " +
9 | "need at least one") if args.size == 0
10 |
11 | return args.max
12 | end
13 | end
14 |
--------------------------------------------------------------------------------
/modules/stdlib/lib/puppet/parser/functions/min.rb:
--------------------------------------------------------------------------------
1 | module Puppet::Parser::Functions
2 | newfunction(:min, :type => :rvalue, :doc => <<-EOS
3 | Returns the lowest value of all arguments.
4 | Requires at least one argument.
5 | EOS
6 | ) do |args|
7 |
8 | raise(Puppet::ParseError, "min(): Wrong number of arguments " +
9 | "need at least one") if args.size == 0
10 |
11 | return args.min
12 | end
13 | end
14 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/modules/stdlib/lib/puppet/parser/functions/reject.rb:
--------------------------------------------------------------------------------
1 | #
2 | # reject.rb
3 | #
4 |
5 | module Puppet::Parser::Functions
6 | newfunction(:reject, :type => :rvalue, :doc => <<-EOS) do |args|
7 | This function searches through an array and rejects all elements that match
8 | the provided regular expression.
9 |
10 | *Examples:*
11 |
12 | reject(['aaa','bbb','ccc','aaaddd'], 'aaa')
13 |
14 | Would return:
15 |
16 | ['bbb','ccc']
17 | EOS
18 |
19 | if (args.size != 2)
20 | raise Puppet::ParseError,
21 | "reject(): Wrong number of arguments given #{args.size} for 2"
22 | end
23 |
24 | ary = args[0]
25 | pattern = Regexp.new(args[1])
26 |
27 | ary.reject { |e| e =~ pattern }
28 | end
29 | end
30 |
31 | # vim: set ts=2 sw=2 et :
32 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/modules/stdlib/spec/lib/puppet_spec/fixtures.rb:
--------------------------------------------------------------------------------
1 | module PuppetSpec::Fixtures
2 | def fixtures(*rest)
3 | File.join(PuppetSpec::FIXTURE_DIR, *rest)
4 | end
5 | def my_fixture_dir
6 | callers = caller
7 | while line = callers.shift do
8 | next unless found = line.match(%r{/spec/(.*)_spec\.rb:})
9 | return fixtures(found[1])
10 | end
11 | fail "sorry, I couldn't work out your path from the caller stack!"
12 | end
13 | def my_fixture(name)
14 | file = File.join(my_fixture_dir, name)
15 | unless File.readable? file then
16 | fail Puppet::DevError, "fixture '#{name}' for #{my_fixture_dir} is not readable"
17 | end
18 | return file
19 | end
20 | def my_fixtures(glob = '*', flags = 0)
21 | files = Dir.glob(File.join(my_fixture_dir, glob), flags)
22 | unless files.length > 0 then
23 | fail Puppet::DevError, "fixture '#{glob}' for #{my_fixture_dir} had no files!"
24 | end
25 | block_given? and files.each do |file| yield file end
26 | files
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/modules/stdlib/spec/lib/puppet_spec/verbose.rb:
--------------------------------------------------------------------------------
1 | # Support code for running stuff with warnings disabled.
2 | module Kernel
3 | def with_verbose_disabled
4 | verbose, $VERBOSE = $VERBOSE, nil
5 | result = yield
6 | $VERBOSE = verbose
7 | return result
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
12 |
--------------------------------------------------------------------------------
/modules/stdlib/spec/spec.opts:
--------------------------------------------------------------------------------
1 | --format
2 | s
3 | --colour
4 | --loadby
5 | mtime
6 | --backtrace
7 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/modules/stdlib/spec/unit/puppet/parser/functions/max_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 |
3 | require 'spec_helper'
4 |
5 | describe "the max function" do
6 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
7 |
8 | it "should exist" do
9 | Puppet::Parser::Functions.function("max").should == "function_max"
10 | end
11 |
12 | it "should raise a ParseError if there is less than 1 arguments" do
13 | lambda { scope.function_max([]) }.should( raise_error(Puppet::ParseError))
14 | end
15 |
16 | it "should be able to compare strings" do
17 | scope.function_max(["albatross","dog","horse"]).should(eq("horse"))
18 | end
19 |
20 | it "should be able to compare numbers" do
21 | scope.function_max([6,8,4]).should(eq(8))
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/modules/stdlib/spec/unit/puppet/parser/functions/min_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby -S rspec
2 |
3 | require 'spec_helper'
4 |
5 | describe "the min function" do
6 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
7 |
8 | it "should exist" do
9 | Puppet::Parser::Functions.function("min").should == "function_min"
10 | end
11 |
12 | it "should raise a ParseError if there is less than 1 arguments" do
13 | lambda { scope.function_min([]) }.should( raise_error(Puppet::ParseError))
14 | end
15 |
16 | it "should be able to compare strings" do
17 | scope.function_min(["albatross","dog","horse"]).should(eq("albatross"))
18 | end
19 |
20 | it "should be able to compare numbers" do
21 | scope.function_min([6,8,4]).should(eq(4))
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/modules/stdlib/spec/unit/puppet/parser/functions/reject_spec.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'spec_helper'
4 |
5 | describe "the reject function" do
6 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
7 |
8 | it "should exist" do
9 | Puppet::Parser::Functions.function("reject").should == "function_reject"
10 | end
11 |
12 | it "should raise a ParseError if there is less than 1 arguments" do
13 | lambda { scope.function_reject([]) }.should( raise_error(Puppet::ParseError))
14 | end
15 |
16 | it "should reject contents from an array" do
17 | result = scope.function_reject([["1111", "aaabbb","bbbccc","dddeee"], "bbb"])
18 | result.should(eq(["1111", "dddeee"]))
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/modules/stdlib/tests/init.pp:
--------------------------------------------------------------------------------
1 | include stdlib
2 |
--------------------------------------------------------------------------------
/modules/vcsrepo/Gemfile:
--------------------------------------------------------------------------------
1 | source :rubygems
2 | gem 'rake', '~> 0.8.7'
3 | gem 'rspec', '~> 1.2.9'
4 | gem 'mocha', '~> 0.12.7', :require => false
5 | gem 'puppet', '~> 2.7'
6 |
--------------------------------------------------------------------------------
/modules/vcsrepo/Gemfile.lock:
--------------------------------------------------------------------------------
1 | GEM
2 | remote: http://rubygems.org/
3 | specs:
4 | facter (1.6.13)
5 | metaclass (0.0.1)
6 | mocha (0.12.7)
7 | metaclass (~> 0.0.1)
8 | puppet (2.7.19)
9 | facter (~> 1.5)
10 | rake (0.8.7)
11 | rspec (1.2.9)
12 |
13 | PLATFORMS
14 | ruby
15 |
16 | DEPENDENCIES
17 | mocha (~> 0.12.7)
18 | puppet (~> 2.7)
19 | rake (~> 0.8.7)
20 | rspec (~> 1.2.9)
21 |
--------------------------------------------------------------------------------
/modules/vcsrepo/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (C) 2010-2012 Puppet Labs Inc.
2 |
3 | Puppet Labs can be contacted at: info@puppetlabs.com
4 |
5 | This program and entire repository is free software; you can
6 | redistribute it and/or modify it under the terms of the GNU
7 | General Public License as published by the Free Software
8 | Foundation; either version 2 of the License, or any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 |
--------------------------------------------------------------------------------
/modules/vcsrepo/Modulefile:
--------------------------------------------------------------------------------
1 | name 'puppetlabs/vcsrepo'
2 | version '0.1.2'
3 |
--------------------------------------------------------------------------------
/modules/vcsrepo/README.markdown:
--------------------------------------------------------------------------------
1 | vcsrepo
2 | =======
3 |
4 | Purpose
5 | -------
6 |
7 | This provides a single type, `vcsrepo`.
8 |
9 | This type can be used to describe:
10 |
11 | * A working copy checked out from a (remote or local) source, at an
12 | arbitrary revision
13 | * A "blank" working copy not associated with a source (when it makes
14 | sense for the VCS being used)
15 | * A "blank" central repository (when the distinction makes sense for the VCS
16 | being used)
17 |
18 | Supported Version Control Systems
19 | ---------------------------------
20 |
21 | This module supports a wide range of VCS types, each represented by a
22 | separate provider.
23 |
24 | For information on how to use this module with a specific VCS, see
25 | `README..markdown`.
26 |
27 | License
28 | -------
29 |
30 | See LICENSE.
31 |
--------------------------------------------------------------------------------
/modules/vcsrepo/Rakefile:
--------------------------------------------------------------------------------
1 | require 'spec/rake/spectask'
2 | Spec::Rake::SpecTask.new(:spec) do |spec|
3 | spec.libs << 'lib' << 'spec'
4 | spec.spec_files = FileList['spec/**/*_spec.rb']
5 | end
6 |
7 | Spec::Rake::SpecTask.new(:rcov) do |spec|
8 | spec.libs << 'lib' << 'spec'
9 | spec.pattern = 'spec/**/*_spec.rb'
10 | spec.rcov = true
11 | end
12 |
13 | task :default => :spec
14 |
--------------------------------------------------------------------------------
/modules/vcsrepo/examples/bzr/branch.pp:
--------------------------------------------------------------------------------
1 | vcsrepo { '/tmp/vcstest-bzr-branch':
2 | ensure => present,
3 | provider => bzr,
4 | source => 'lp:do',
5 | revision => '1312',
6 | }
7 |
--------------------------------------------------------------------------------
/modules/vcsrepo/examples/bzr/init_repo.pp:
--------------------------------------------------------------------------------
1 | vcsrepo { '/tmp/vcstest-bzr-init':
2 | ensure => present,
3 | provider => bzr,
4 | }
5 |
--------------------------------------------------------------------------------
/modules/vcsrepo/examples/cvs/local.pp:
--------------------------------------------------------------------------------
1 | vcsrepo { '/tmp/vcstest-cvs-repo':
2 | ensure => present,
3 | provider => cvs,
4 | }
5 |
6 | vcsrepo { '/tmp/vcstest-cvs-workspace-local':
7 | ensure => present,
8 | provider => cvs,
9 | source => '/tmp/vcstest-cvs-repo',
10 | require => Vcsrepo['/tmp/vcstest-cvs-repo'],
11 | }
12 |
--------------------------------------------------------------------------------
/modules/vcsrepo/examples/cvs/remote.pp:
--------------------------------------------------------------------------------
1 | vcsrepo { '/tmp/vcstest-cvs-workspace-remote':
2 | ensure => present,
3 | provider => cvs,
4 | source => ':pserver:anonymous@cvs.sv.gnu.org:/sources/leetcvrt',
5 | }
6 |
--------------------------------------------------------------------------------
/modules/vcsrepo/examples/git/bare_init.pp:
--------------------------------------------------------------------------------
1 | vcsrepo { '/tmp/vcstest-git-bare':
2 | ensure => bare,
3 | provider => git,
4 | }
5 |
--------------------------------------------------------------------------------
/modules/vcsrepo/examples/git/clone.pp:
--------------------------------------------------------------------------------
1 | vcsrepo { '/tmp/vcstest-git-clone':
2 | ensure => present,
3 | provider => git,
4 | source => 'git://github.com/bruce/rtex.git',
5 | }
6 |
--------------------------------------------------------------------------------
/modules/vcsrepo/examples/git/working_copy_init.pp:
--------------------------------------------------------------------------------
1 | vcsrepo { '/tmp/vcstest-git-wc':
2 | ensure => present,
3 | provider => git,
4 | }
5 |
--------------------------------------------------------------------------------
/modules/vcsrepo/examples/hg/clone.pp:
--------------------------------------------------------------------------------
1 | vcsrepo { '/tmp/vcstest-hg-clone':
2 | ensure => present,
3 | provider => hg,
4 | source => 'http://hg.basho.com/riak',
5 | revision => 'riak-0.5.3',
6 | }
7 |
--------------------------------------------------------------------------------
/modules/vcsrepo/examples/hg/init_repo.pp:
--------------------------------------------------------------------------------
1 | vcsrepo { '/tmp/vcstest-hg-init':
2 | ensure => present,
3 | provider => hg,
4 | }
5 |
--------------------------------------------------------------------------------
/modules/vcsrepo/examples/svn/checkout.pp:
--------------------------------------------------------------------------------
1 | vcsrepo { '/tmp/vcstest-svn-checkout':
2 | ensure => present,
3 | provider => svn,
4 | source => 'http://svn.edgewall.org/repos/babel/trunk',
5 | }
6 |
--------------------------------------------------------------------------------
/modules/vcsrepo/examples/svn/server.pp:
--------------------------------------------------------------------------------
1 | vcsrepo { '/tmp/vcstest-svn-server':
2 | ensure => present,
3 | provider => svn,
4 | }
5 |
--------------------------------------------------------------------------------
/modules/vcsrepo/lib/puppet/provider/vcsrepo.rb:
--------------------------------------------------------------------------------
1 | require 'tmpdir'
2 | require 'digest/md5'
3 | require 'fileutils'
4 |
5 | # Abstract
6 | class Puppet::Provider::Vcsrepo < Puppet::Provider
7 |
8 | private
9 |
10 | def set_ownership
11 | owner = @resource.value(:owner) || nil
12 | group = @resource.value(:group) || nil
13 | FileUtils.chown_R(owner, group, @resource.value(:path))
14 | end
15 |
16 | def path_exists?
17 | File.directory?(@resource.value(:path))
18 | end
19 |
20 | # Note: We don't rely on Dir.chdir's behavior of automatically returning the
21 | # value of the last statement -- for easier stubbing.
22 | def at_path(&block) #:nodoc:
23 | value = nil
24 | Dir.chdir(@resource.value(:path)) do
25 | value = yield
26 | end
27 | value
28 | end
29 |
30 | def tempdir
31 | @tempdir ||= File.join(Dir.tmpdir, 'vcsrepo-' + Digest::MD5.hexdigest(@resource.value(:path)))
32 | end
33 |
34 | end
35 |
--------------------------------------------------------------------------------
/modules/vcsrepo/lib/puppet/provider/vcsrepo/dummy.rb:
--------------------------------------------------------------------------------
1 | require File.join(File.dirname(__FILE__), '..', 'vcsrepo')
2 |
3 | Puppet::Type.type(:vcsrepo).provide(:dummy, :parent => Puppet::Provider::Vcsrepo) do
4 | desc "Dummy default provider"
5 |
6 | defaultfor :vcsrepo => :dummy
7 |
8 | def working_copy_exists?
9 | providers = @resource.class.providers.map{|x| x.to_s}.sort.reject{|x| x == "dummy"}.join(", ") rescue "none"
10 | raise("vcsrepo resource must have a provider, available: #{providers}")
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/modules/vcsrepo/spec/fixtures/bzr_version_info.txt:
--------------------------------------------------------------------------------
1 | revision-id: menesis@pov.lt-20100309191856-4wmfqzc803fj300x
2 | date: 2010-03-09 21:18:56 +0200
3 | build-date: 2010-03-14 00:42:43 -0800
4 | revno: 2634
5 | branch-nick: mytest
6 |
--------------------------------------------------------------------------------
/modules/vcsrepo/spec/fixtures/git_branch_a.txt:
--------------------------------------------------------------------------------
1 | feature/foo
2 | feature/bar
3 | feature/baz
4 | feature/quux
5 | only/local
6 | * master
7 | refactor/foo
8 | origin/HEAD
9 | origin/feature/foo
10 | origin/feature/bar
11 | origin/feature/baz
12 | origin/feature/quux
13 | origin/only/remote
14 | origin/master
15 |
--------------------------------------------------------------------------------
/modules/vcsrepo/spec/fixtures/hg_parents.txt:
--------------------------------------------------------------------------------
1 | changeset: 3:34e6012c783a
2 | parent: 2:21ea4598c962
3 | parent: 1:9d0ff0028458
4 | user: Test User
5 | date: Fri Aug 07 13:13:02 2009 -0400
6 | summary: merge
7 |
--------------------------------------------------------------------------------
/modules/vcsrepo/spec/fixtures/hg_tags.txt:
--------------------------------------------------------------------------------
1 | tip 1019:bca3f20b249b
2 | 0.9.1 1017:76ce7cca95d8
3 | 0.9 1001:dbaa6f4ec585
4 | 0.8 839:65b66ac0fc83
5 | 0.7.1 702:e1357f00129f
6 | 0.7 561:7b2af3b4c968
7 | 0.6.3 486:e38077f4e4aa
8 | 0.6.2 405:07bb099b7b10
9 | 0.6.1 389:93750f3fbbe2
10 | 0.6 369:34e6012c783a
11 | 0.5.3 321:5ffa6ae7e699
12 | 0.5.2 318:fdc2c2e4cebe
13 | 0.5.1 315:33a5ea0cbe7a
14 | 0.5 313:47490716f4c9
15 | 0.4 240:47fa3a14cc63
16 | 0.3.1 132:bc231db18e1c
17 | 0.3 130:661615e510dd
18 | 0.2 81:f98d13b442f6
19 |
--------------------------------------------------------------------------------
/modules/vcsrepo/spec/fixtures/svn_info.txt:
--------------------------------------------------------------------------------
1 | Path: .
2 | URL: http://example.com/svn/trunk
3 | Repository Root: http://example.com/svn
4 | Repository UUID: 75246ace-e253-0410-96dd-a7613ca8dc81
5 | Revision: 4
6 | Node Kind: directory
7 | Schedule: normal
8 | Last Changed Author: jon
9 | Last Changed Rev: 3
10 | Last Changed Date: 2008-08-07 11:34:25 -0700 (Thu, 07 Aug 2008)
11 |
--------------------------------------------------------------------------------
/modules/vcsrepo/spec/spec.opts:
--------------------------------------------------------------------------------
1 | --format
2 | s
3 | --colour
4 | --loadby
5 | mtime
6 | --backtrace
7 |
--------------------------------------------------------------------------------
/modules/vcsrepo/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | require 'pathname'
2 | dir = Pathname.new(__FILE__).parent
3 | $LOAD_PATH.unshift(dir, dir + 'lib', dir + '../lib')
4 |
5 | require 'test/unit'
6 | require 'mocha'
7 | require 'puppet'
8 | gem 'rspec', '>= 1.2.9'
9 | require 'spec/autorun'
10 |
11 | Dir[File.join(File.dirname(__FILE__), 'support', '*.rb')].each do |support_file|
12 | require support_file
13 | end
14 |
15 | Spec::Runner.configure do |config|
16 | config.mock_with :mocha
17 | config.include(FixtureHelpers)
18 | config.include(FilesystemHelpers)
19 | end
20 |
21 | # We need this because the RAL uses 'should' as a method. This
22 | # allows us the same behaviour but with a different method name.
23 | class Object
24 | alias :must :should
25 | end
26 |
--------------------------------------------------------------------------------
/modules/vcsrepo/spec/support/filesystem_helpers.rb:
--------------------------------------------------------------------------------
1 | module FilesystemHelpers
2 |
3 | def expects_chdir(path = resource.value(:path))
4 | Dir.expects(:chdir).with(path).at_least_once.yields
5 | end
6 |
7 | def expects_mkdir(path = resource.value(:path))
8 | Dir.expects(:mkdir).with(path).at_least_once
9 | end
10 |
11 | def expects_rm_rf(path = resource.value(:path))
12 | FileUtils.expects(:rm_rf).with(path)
13 | end
14 |
15 | def expects_directory?(returns = true, path = resource.value(:path))
16 | File.expects(:directory?).with(path).returns(returns)
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/modules/vcsrepo/spec/support/fixture_helpers.rb:
--------------------------------------------------------------------------------
1 | module FixtureHelpers
2 |
3 | def fixture(name, ext = '.txt')
4 | File.read(File.join(File.dirname(__FILE__), '..', 'fixtures', name.to_s + ext))
5 | end
6 |
7 | end
8 |
--------------------------------------------------------------------------------
/modules/vcsrepo/spec/unit/puppet/provider/vcsrepo/dummy_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe_provider :vcsrepo, :dummy, :resource => {:path => '/tmp/vcsrepo'} do
4 |
5 | context 'dummy' do
6 | resource_with :source do
7 | resource_with :ensure => :present do
8 | context "with nothing doing", :resource => {:revision => 'foo'} do
9 | it "should raise an exception" do
10 | proc { provider.working_copy_exists? }.should raise_error(RuntimeError)
11 | end
12 | end
13 | end
14 | end
15 | end
16 |
17 | end
18 |
--------------------------------------------------------------------------------
/modules/vcsrepo/spec/unit/puppet/type/README.markdown:
--------------------------------------------------------------------------------
1 | Resource Type Specs
2 | ===================
3 |
4 | Define specs for your resource types in this directory.
5 |
--------------------------------------------------------------------------------
/modules/xdebug/README.md:
--------------------------------------------------------------------------------
1 | puphpet-xdebug
2 | =============
3 |
4 | Puppet module for installing XDEBUG PHP Extension
5 |
6 | Installs XDEBUG Support.
7 | Depends on (tested with)
8 | - https://github.com/puphpet/puppet-php.git
9 |
10 | Example usage:
11 |
12 | class { 'xdebug': }
13 |
14 | To set up CGI/CLI specific INI files:
15 |
16 | xdebug::config { 'cgi': }
17 | xdebug::config { 'cli': }
18 |
19 | Maintained by: PuPHPet
20 |
21 | GitHub: git@github.com:puphpet/puphpet-xdebug.git
22 |
23 | Original Author: Stefan Kögel
24 |
25 | GitHub: git@github.com:stkoegel/puppet-xdebug.git
26 |
--------------------------------------------------------------------------------
/modules/xdebug/files/cli_alias.erb:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | XDEBUG_CONFIG="idekey=xdebug" php -dxdebug.remote_host=`echo $SSH_CLIENT | cut -d "=" -f 2 | awk '{print $1}'` "$@"
3 |
--------------------------------------------------------------------------------
/modules/xdebug/manifests/debian.pp:
--------------------------------------------------------------------------------
1 | class xdebug::debian {
2 |
3 | include xdebug::params
4 |
5 | package { 'xdebug':
6 | name => $xdebug::params::pkg,
7 | ensure => installed,
8 | require => Class['php'],
9 | }
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/modules/xdebug/manifests/init.pp:
--------------------------------------------------------------------------------
1 | class xdebug (
2 | $service = 'apache'
3 | ){
4 |
5 | package { 'xdebug':
6 | name => 'php5-xdebug',
7 | ensure => installed,
8 | require => Package['php'],
9 | notify => Service[$service],
10 | }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/modules/xdebug/manifests/params.pp:
--------------------------------------------------------------------------------
1 | class xdebug::params {
2 |
3 | $pkg = $operatingsystem ? {
4 | /Debian|Ubuntu/ => 'php5-xdebug',
5 | }
6 |
7 | $php = $operatingsystem ? {
8 | /Debian|Ubuntu/ => 'php5-cli',
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/modules/xdebug/templates/ini.erb:
--------------------------------------------------------------------------------
1 | [xdebug]
2 | xdebug.remote_enable = <%= remote_enable %>
3 | xdebug.remote_mode = <%= remote_mode %>
4 | xdebug.remote_port = <%= remote_port %>
5 | xdebug.default_enable = <%= default_enable %>
6 | xdebug.show_local_vars = <%= show_local_vars %>
7 | xdebug.var_display_max_data = <%= var_display_max_data %>
8 | xdebug.ini = <%= ini_file_real %>
9 | xdebug.remote_host = <%= remote_host %>
10 | xdebug.show_exception_trace = <%= show_exception_trace %>
11 | xdebug.remote_handler = <%= remote_handler %>
12 | xdebug.var_display_max_depth = <%= var_display_max_depth %>
13 | xdebug.remote_autostart = <%= remote_autostart %>
14 | xdebug.remote_connect_back = <%= remote_connect_back %>
15 |
--------------------------------------------------------------------------------
/modules/xdebug/templates/ini_file.erb:
--------------------------------------------------------------------------------
1 | [xdebug]
2 | <% if vars.is_a? Hash -%>
3 | <% vars.each do |name,value| -%>
4 | xdebug.<%= name %> = <%= value %>
5 | <% end %>
6 | <% end -%>
7 |
--------------------------------------------------------------------------------
/modules/xdebug/tests/cli.pp:
--------------------------------------------------------------------------------
1 | xdebug::config { 'cli':
2 | remote_autostart => '0',
3 | remote_port => '9000',
4 | ini_file => '/etc/php5/cli/php.ini'
5 | }
6 |
7 |
8 |
--------------------------------------------------------------------------------
/spec/SensioLabs/Ceremonies/CeremonySpec.php:
--------------------------------------------------------------------------------
1 | shouldHaveType('SensioLabs\Ceremonies\Ceremony');
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/spec/SensioLabs/Ceremonies/ProjectManagerSpec.php:
--------------------------------------------------------------------------------
1 | beConstructedWith('a name');
13 | }
14 |
15 | function it_has_a_name()
16 | {
17 | $this->getName()->shouldReturn('a name');
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/spec/SensioLabs/Ceremonies/ProjectSpec.php:
--------------------------------------------------------------------------------
1 | beConstructedWith('a project name', $manager);
15 | }
16 |
17 | function it_has_a_name()
18 | {
19 | $this->getName()->shouldReturn('a project name');
20 | }
21 |
22 | function it_has_a_link_to_a_manager(ProjectManager $manager)
23 | {
24 | $this->getManager()->shouldReturn($manager);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/spec/SensioLabs/Ceremonies/SpecificationSpec.php:
--------------------------------------------------------------------------------
1 | beConstructedWith(15, [$ceremony1, $ceremony2]);
14 | }
15 |
16 | function it_has_a_sprint_length()
17 | {
18 | $this->getSprintLength()->shouldReturn(15);
19 | }
20 |
21 | function it_stores_list_of_predefined_ceremonies($ceremony1, $ceremony2)
22 | {
23 | $this->getCeremonies()->shouldReturn([$ceremony1, $ceremony2]);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/spec/SensioLabs/CeremonyTracker/GetManagerProjectsSpec.php:
--------------------------------------------------------------------------------
1 | beConstructedWith($repository);
17 | }
18 |
19 | function it_retrieves_manager_projects_using_repository(
20 | Project $project1,
21 | Project $project2,
22 | ProjectManager $manager,
23 | $repository
24 | )
25 | {
26 | $repository->getManagerProjects($manager)->willReturn([$project1, $project2]);
27 |
28 | $this->getManagerProjects($manager)->shouldReturn([$project1, $project2]);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/spec/SensioLabs/CeremonyTracker/GetProjectSprintsSpec.php:
--------------------------------------------------------------------------------
1 | beConstructedWith($repository);
16 | }
17 |
18 | function it_retrieves_project_sprints_using_repository(
19 | Sprint $sprint1,
20 | Sprint $sprint2,
21 | Project $project,
22 | $repository
23 | )
24 | {
25 | $repository->getProjectSprints($project)->willReturn([$sprint1, $sprint2]);
26 |
27 | $this->getProjectSprints($project)->shouldReturn([$sprint1, $sprint2]);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/.htaccess:
--------------------------------------------------------------------------------
1 | deny from all
--------------------------------------------------------------------------------
/src/SensioLabs/Ceremonies/Ceremony.php:
--------------------------------------------------------------------------------
1 | name = $name;
13 | $this->manager = $manager;
14 | }
15 |
16 | public function getName()
17 | {
18 | return $this->name;
19 | }
20 |
21 | public function getManager()
22 | {
23 | return $this->manager;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/SensioLabs/Ceremonies/ProjectManager.php:
--------------------------------------------------------------------------------
1 | name = $name;
12 | }
13 |
14 | public function getName()
15 | {
16 | return $this->name;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/SensioLabs/Ceremonies/ProjectRepositoryInterface.php:
--------------------------------------------------------------------------------
1 | sprintLength = $sprintLength;
13 | $this->ceremonies = $ceremonies;
14 | }
15 |
16 | public function getSprintLength()
17 | {
18 | return $this->sprintLength;
19 | }
20 |
21 | public function getCeremonies()
22 | {
23 | return $this->ceremonies;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/SensioLabs/Ceremonies/SpecificationRepositoryInterface.php:
--------------------------------------------------------------------------------
1 | getManager();
16 |
17 | if (!isset($this->projects[$manager->getName()])) {
18 | $this->projects[$manager->getName()] = [];
19 | }
20 |
21 | $this->projects[$manager->getName()][] = $project;
22 | }
23 |
24 | public function getManagerProjects(ProjectManager $manager)
25 | {
26 | if (!isset($this->projects[$manager->getName()])) {
27 | return [];
28 | }
29 |
30 | return $this->projects[$manager->getName()];
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/SensioLabs/CeremonyTracker/Ceremonies/InMemorySpecificationRepository.php:
--------------------------------------------------------------------------------
1 | specifications[$specification->getSprintLength()] = $specification;
15 | }
16 |
17 | public function getSpecificationForSprintLength($sprintLength)
18 | {
19 | if (isset($this->specifications[$sprintLength])) {
20 | return $this->specifications[$sprintLength];
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/SensioLabs/CeremonyTracker/Ceremonies/InMemorySprintRepository.php:
--------------------------------------------------------------------------------
1 | getProject();
16 |
17 | if (!isset($this->sprints[$project->getName()])) {
18 | $this->sprints[$project->getName()] = [];
19 | }
20 |
21 | $this->sprints[$project->getName()][] = $sprint;
22 | }
23 |
24 | public function getProjectSprints(Project $project)
25 | {
26 | if (!isset($this->sprints[$project->getName()])) {
27 | return [];
28 | }
29 |
30 | return $this->sprints[$project->getName()];
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/SensioLabs/CeremonyTracker/Event.php:
--------------------------------------------------------------------------------
1 | data = $data;
14 | }
15 |
16 | public function get($key)
17 | {
18 | return isset($this->data[$key]) ? $this->data[$key] : null;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/SensioLabs/CeremonyTracker/GetManagerProjects.php:
--------------------------------------------------------------------------------
1 | repository = $repository;
15 | }
16 |
17 | public function getManagerProjects(ProjectManager $manager)
18 | {
19 | return $this->repository->getManagerProjects($manager);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/SensioLabs/CeremonyTracker/GetProjectSprints.php:
--------------------------------------------------------------------------------
1 | repository = $repository;
15 | }
16 |
17 | public function getProjectSprints(Project $project)
18 | {
19 | return $this->repository->getProjectSprints($project);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/SensioLabs/CeremonyTrackerBundle/CeremonyTrackerBundle.php:
--------------------------------------------------------------------------------
1 | load('services.yml');
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/SensioLabs/CeremonyTrackerBundle/Entity/Project.php:
--------------------------------------------------------------------------------
1 | _em->persist($project);
15 | $this->_em->flush();
16 | }
17 |
18 | public function getManagerProjects(BaseProjectManager $manager)
19 | {
20 | return $this->findBy(['manager' => $manager]);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/SensioLabs/CeremonyTrackerBundle/Form/CreateProjectType.php:
--------------------------------------------------------------------------------
1 | add('name', 'text', ['constraints' => [
15 | new NotBlank(),
16 | new Length(['min' => 3, 'max' => 255])
17 | ]]);
18 | }
19 |
20 | public function getName()
21 | {
22 | return 'create_project';
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/SensioLabs/CeremonyTrackerBundle/Resources/config/doctrine/Project.orm.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/SensioLabs/CeremonyTrackerBundle/Resources/config/doctrine/ProjectManager.orm.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/SensioLabs/CeremonyTrackerBundle/Resources/config/routing.yml:
--------------------------------------------------------------------------------
1 | login:
2 | path: /login
3 | defaults: { _controller: controllers.security:loginAction }
4 |
5 | login_check:
6 | path: /login_check
7 |
8 | logout:
9 | path: /logout
10 |
11 | list_my_projects:
12 | path: /
13 | defaults: { _controller: controllers.list_my_projects:listAction }
14 | requirements:
15 | _method: GET
16 |
17 | create_project:
18 | path: /
19 | defaults: { _controller: controllers.create_project:createAction }
20 | requirements:
21 | _method: POST
22 |
--------------------------------------------------------------------------------
/src/SensioLabs/CeremonyTrackerBundle/Resources/views/Projects/list.html.twig:
--------------------------------------------------------------------------------
1 | {% extends '::base.html.twig' %}
2 |
3 | {% block body %}
4 | {% for flashMessage in app.session.flashbag.get('success') %}
5 |
6 | {{ flashMessage }}
7 |
8 | {% endfor %}
9 |
10 | My projects:
11 |
12 | {% for project in projects %}
13 | - {{ project.name }}
14 | {% endfor %}
15 |
16 |
17 |
18 | Create new project:
19 |
22 | {% endblock body %}
23 |
--------------------------------------------------------------------------------
/src/SensioLabs/CeremonyTrackerBundle/Resources/views/Security/login.html.twig:
--------------------------------------------------------------------------------
1 | {% extends '::base.html.twig' %}
2 |
3 | {% block body %}
4 | {% if error %}
5 | {{ error.message }}
6 | {% endif %}
7 |
8 |
17 | {% endblock body %}
18 |
--------------------------------------------------------------------------------
/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::enableHttpMethodParameterOverride();
23 | $request = Request::createFromGlobals();
24 | $response = $kernel->handle($request);
25 | $response->send();
26 | $kernel->terminate($request, $response);
27 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------