├── .gitignore ├── .version.txt ├── README.md ├── Vagrantfile ├── data └── import.xml ├── misc └── qs-config.php ├── puppet ├── default.pp ├── manifests │ ├── env.pp │ ├── mysql.pp │ ├── nginx.pp │ ├── php.pp │ └── wordpress.pp └── modules │ ├── apt │ ├── .fixtures.yml │ ├── .gitignore │ ├── .project │ ├── .puppet-lint.rc │ ├── .sync.yml │ ├── .travis.yml │ ├── CHANGELOG.md │ ├── CONTRIBUTING.md │ ├── Gemfile │ ├── LICENSE │ ├── README.md │ ├── Rakefile │ ├── lib │ │ ├── facter │ │ │ ├── apt_update_last_success.rb │ │ │ └── apt_updates.rb │ │ ├── puppet │ │ │ ├── provider │ │ │ │ └── apt_key │ │ │ │ │ └── apt_key.rb │ │ │ └── type │ │ │ │ └── apt_key.rb │ │ └── puppet_x │ │ │ └── apt_key │ │ │ └── patch_openuri.rb │ ├── manifests │ │ ├── backports.pp │ │ ├── builddep.pp │ │ ├── conf.pp │ │ ├── debian │ │ │ ├── testing.pp │ │ │ └── unstable.pp │ │ ├── force.pp │ │ ├── hold.pp │ │ ├── init.pp │ │ ├── key.pp │ │ ├── params.pp │ │ ├── pin.pp │ │ ├── ppa.pp │ │ ├── release.pp │ │ ├── source.pp │ │ ├── unattended_upgrades.pp │ │ └── update.pp │ ├── metadata.json │ ├── spec │ │ ├── acceptance │ │ │ ├── apt_key_provider_spec.rb │ │ │ ├── apt_spec.rb │ │ │ ├── class_spec.rb │ │ │ └── nodesets │ │ │ │ ├── centos-59-x64.yml │ │ │ │ ├── centos-64-x64-pe.yml │ │ │ │ ├── centos-65-x64.yml │ │ │ │ ├── debian-70rc1-x64.yml │ │ │ │ ├── debian-73-x64.yml │ │ │ │ ├── default.yml │ │ │ │ ├── ubuntu-server-10044-x64.yml │ │ │ │ ├── ubuntu-server-12042-x64.yml │ │ │ │ └── ubuntu-server-1404-x64.yml │ │ ├── classes │ │ │ ├── apt_spec.rb │ │ │ ├── apt_update_spec.rb │ │ │ ├── backports_spec.rb │ │ │ ├── debian_testing_spec.rb │ │ │ ├── debian_unstable_spec.rb │ │ │ ├── params_spec.rb │ │ │ ├── release_spec.rb │ │ │ └── unattended_upgrades_spec.rb │ │ ├── defines │ │ │ ├── builddep_spec.rb │ │ │ ├── conf_spec.rb │ │ │ ├── force_spec.rb │ │ │ ├── hold_spec.rb │ │ │ ├── key_spec.rb │ │ │ ├── pin_spec.rb │ │ │ ├── ppa_spec.rb │ │ │ └── source_spec.rb │ │ ├── spec.opts │ │ ├── spec_helper.rb │ │ ├── spec_helper_acceptance.rb │ │ └── unit │ │ │ ├── facter │ │ │ ├── apt_has_updates_spec.rb │ │ │ ├── apt_package_updates_spec.rb │ │ │ ├── apt_security_updates_spec.rb │ │ │ ├── apt_update_last_success_spec.rb │ │ │ └── apt_updates_spec.rb │ │ │ └── puppet │ │ │ └── type │ │ │ └── apt_key_spec.rb │ ├── templates │ │ ├── 10periodic.erb │ │ ├── 15update-stamp.erb │ │ ├── 50unattended-upgrades.erb │ │ ├── _header.erb │ │ ├── conf.erb │ │ ├── pin.pref.erb │ │ ├── progressbar.erb │ │ ├── proxy.erb │ │ ├── release.erb │ │ ├── source.list.erb │ │ └── unauth.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 │ │ └── unattended_upgrades.pp │ ├── concat │ ├── .fixtures.yml │ ├── .gitattributes │ ├── .gitignore │ ├── .sync.yml │ ├── .travis.yml │ ├── CHANGELOG.md │ ├── CONTRIBUTING.md │ ├── Gemfile │ ├── LICENSE │ ├── README.md │ ├── Rakefile │ ├── files │ │ ├── concatfragments.rb │ │ └── concatfragments.sh │ ├── lib │ │ ├── facter │ │ │ └── concat_basedir.rb │ │ └── puppet │ │ │ └── parser │ │ │ └── functions │ │ │ ├── concat_getparam.rb │ │ │ └── concat_is_bool.rb │ ├── manifests │ │ ├── fragment.pp │ │ ├── init.pp │ │ └── setup.pp │ ├── metadata.json │ ├── spec │ │ ├── acceptance │ │ │ ├── backup_spec.rb │ │ │ ├── concat_spec.rb │ │ │ ├── deprecation_warnings_spec.rb │ │ │ ├── empty_spec.rb │ │ │ ├── fragment_source_spec.rb │ │ │ ├── fragments_are_always_replaced_spec.rb │ │ │ ├── newline_spec.rb │ │ │ ├── nodesets │ │ │ │ ├── aix-71-vcloud.yml │ │ │ │ ├── centos-59-x64.yml │ │ │ │ ├── centos-64-x64-pe.yml │ │ │ │ ├── centos-64-x64.yml │ │ │ │ ├── centos-65-x64.yml │ │ │ │ ├── debian-607-x64.yml │ │ │ │ ├── debian-70rc1-x64.yml │ │ │ │ ├── debian-73-x64.yml │ │ │ │ ├── default.yml │ │ │ │ ├── fedora-18-x64.yml │ │ │ │ ├── sles-11-x64.yml │ │ │ │ ├── sles-11sp1-x64.yml │ │ │ │ ├── ubuntu-server-10044-x64.yml │ │ │ │ ├── ubuntu-server-12042-x64.yml │ │ │ │ └── ubuntu-server-1404-x64.yml │ │ │ ├── order_spec.rb │ │ │ ├── quoted_paths_spec.rb │ │ │ ├── replace_spec.rb │ │ │ ├── specinfra_stubs.rb │ │ │ ├── symbolic_name_spec.rb │ │ │ ├── validation_spec.rb │ │ │ └── warn_spec.rb │ │ ├── spec.opts │ │ ├── spec_helper.rb │ │ ├── spec_helper_acceptance.rb │ │ └── unit │ │ │ ├── classes │ │ │ └── concat_setup_spec.rb │ │ │ ├── defines │ │ │ ├── concat_fragment_spec.rb │ │ │ └── concat_spec.rb │ │ │ └── facts │ │ │ └── concat_basedir_spec.rb │ └── tests │ │ ├── fragment.pp │ │ └── init.pp │ ├── mysql │ ├── .fixtures.yml │ ├── .geppetto-rc.json │ ├── .gitignore │ ├── .nodeset.yml │ ├── .sync.yml │ ├── .travis.yml │ ├── CHANGELOG.md │ ├── CONTRIBUTING.md │ ├── Gemfile │ ├── LICENSE │ ├── README.md │ ├── Rakefile │ ├── TODO │ ├── examples │ │ ├── backup.pp │ │ ├── bindings.pp │ │ ├── java.pp │ │ ├── mysql_database.pp │ │ ├── mysql_db.pp │ │ ├── mysql_grant.pp │ │ ├── mysql_plugin.pp │ │ ├── mysql_user.pp │ │ ├── perl.pp │ │ ├── python.pp │ │ ├── ruby.pp │ │ ├── server.pp │ │ └── server │ │ │ ├── account_security.pp │ │ │ └── config.pp │ ├── lib │ │ └── puppet │ │ │ ├── parser │ │ │ └── functions │ │ │ │ ├── mysql_deepmerge.rb │ │ │ │ ├── mysql_dirname.rb │ │ │ │ ├── mysql_password.rb │ │ │ │ └── mysql_strip_hash.rb │ │ │ ├── provider │ │ │ ├── mysql.rb │ │ │ ├── mysql_database │ │ │ │ └── mysql.rb │ │ │ ├── mysql_grant │ │ │ │ └── mysql.rb │ │ │ ├── mysql_plugin │ │ │ │ └── mysql.rb │ │ │ └── mysql_user │ │ │ │ └── mysql.rb │ │ │ └── type │ │ │ ├── mysql_database.rb │ │ │ ├── mysql_grant.rb │ │ │ ├── mysql_plugin.rb │ │ │ └── mysql_user.rb │ ├── manifests │ │ ├── bindings.pp │ │ ├── bindings │ │ │ ├── client_dev.pp │ │ │ ├── daemon_dev.pp │ │ │ ├── java.pp │ │ │ ├── perl.pp │ │ │ ├── php.pp │ │ │ ├── python.pp │ │ │ └── ruby.pp │ │ ├── client.pp │ │ ├── client │ │ │ └── install.pp │ │ ├── db.pp │ │ ├── params.pp │ │ ├── server.pp │ │ └── server │ │ │ ├── account_security.pp │ │ │ ├── backup.pp │ │ │ ├── config.pp │ │ │ ├── install.pp │ │ │ ├── monitor.pp │ │ │ ├── mysqltuner.pp │ │ │ ├── providers.pp │ │ │ ├── root_password.pp │ │ │ └── service.pp │ ├── metadata.json │ ├── spec │ │ ├── acceptance │ │ │ ├── mysql_backup_spec.rb │ │ │ ├── mysql_db_spec.rb │ │ │ ├── mysql_server_spec.rb │ │ │ ├── nodesets │ │ │ │ ├── centos-510-x64.yml │ │ │ │ ├── centos-59-x64.yml │ │ │ │ ├── centos-64-x64-pe.yml │ │ │ │ ├── centos-65-x64.yml │ │ │ │ ├── default.yml │ │ │ │ ├── fedora-18-x64.yml │ │ │ │ ├── sles-11-x64.yml │ │ │ │ ├── ubuntu-server-10044-x64.yml │ │ │ │ ├── ubuntu-server-12042-x64.yml │ │ │ │ └── ubuntu-server-1404-x64.yml │ │ │ └── types │ │ │ │ ├── mysql_database_spec.rb │ │ │ │ ├── mysql_grant_spec.rb │ │ │ │ ├── mysql_plugin_spec.rb │ │ │ │ └── mysql_user_spec.rb │ │ ├── classes │ │ │ ├── graceful_failures_spec.rb │ │ │ ├── mycnf_template_spec.rb │ │ │ ├── mysql_bindings_spec.rb │ │ │ ├── mysql_client_spec.rb │ │ │ ├── mysql_server_account_security_spec.rb │ │ │ ├── mysql_server_backup_spec.rb │ │ │ ├── mysql_server_monitor_spec.rb │ │ │ ├── mysql_server_mysqltuner_spec.rb │ │ │ └── mysql_server_spec.rb │ │ ├── defines │ │ │ └── mysql_db_spec.rb │ │ ├── spec.opts │ │ ├── spec_helper.rb │ │ ├── spec_helper_acceptance.rb │ │ └── unit │ │ │ └── puppet │ │ │ ├── functions │ │ │ ├── mysql_deepmerge_spec.rb │ │ │ └── mysql_password_spec.rb │ │ │ ├── provider │ │ │ ├── mysql_database │ │ │ │ └── mysql_spec.rb │ │ │ ├── mysql_plugin │ │ │ │ └── mysql_spec.rb │ │ │ └── mysql_user │ │ │ │ └── mysql_spec.rb │ │ │ └── type │ │ │ ├── mysql_database_spec.rb │ │ │ ├── mysql_grant_spec.rb │ │ │ ├── mysql_plugin_spec.rb │ │ │ └── mysql_user_spec.rb │ └── templates │ │ ├── my.cnf.erb │ │ ├── my.cnf.pass.erb │ │ └── mysqlbackup.sh.erb │ ├── nginx │ ├── .fixtures.yml │ ├── .gitignore │ ├── .nodeset.yml │ ├── .travis.yml │ ├── CONTRIBUTING.md │ ├── Gemfile │ ├── LICENSE.md │ ├── README.markdown │ ├── Rakefile │ ├── composer.json │ ├── docs │ │ └── hiera.md │ ├── manifests │ │ ├── config.pp │ │ ├── init.pp │ │ ├── notice │ │ │ └── config.pp │ │ ├── package.pp │ │ ├── package │ │ │ ├── debian.pp │ │ │ └── redhat.pp │ │ ├── params.pp │ │ ├── resource │ │ │ ├── geo.pp │ │ │ ├── location.pp │ │ │ ├── mailhost.pp │ │ │ ├── map.pp │ │ │ ├── upstream.pp │ │ │ ├── upstream │ │ │ │ └── member.pp │ │ │ └── vhost.pp │ │ └── service.pp │ ├── metadata.json │ ├── spec │ │ ├── classes │ │ │ ├── config_spec.rb │ │ │ ├── nginx_spec.rb │ │ │ ├── package_spec.rb │ │ │ └── service_spec.rb │ │ ├── defines │ │ │ ├── resource_geo_spec.rb │ │ │ ├── resource_location_spec.rb │ │ │ ├── resource_mailhost_spec.rb │ │ │ ├── resource_map_spec.rb │ │ │ ├── resource_upstream_spec.rb │ │ │ └── resource_vhost_spec.rb │ │ ├── spec_helper.rb │ │ ├── spec_helper_system.rb │ │ └── system │ │ │ ├── basic_spec.rb │ │ │ ├── class_spec.rb │ │ │ ├── nginx_mail_spec.rb │ │ │ ├── nginx_proxy_spec.rb │ │ │ └── nginx_vhost_spec.rb │ ├── templates │ │ ├── conf.d │ │ │ ├── geo.erb │ │ │ ├── map.erb │ │ │ ├── nginx.conf.erb │ │ │ ├── proxy.conf.erb │ │ │ ├── upstream_header.erb │ │ │ ├── upstream_member.erb │ │ │ └── upstream_members.erb │ │ ├── mailhost │ │ │ ├── mailhost.erb │ │ │ └── mailhost_ssl.erb │ │ └── vhost │ │ │ ├── fastcgi_params.erb │ │ │ ├── location_footer.erb │ │ │ ├── location_header.erb │ │ │ ├── locations │ │ │ ├── alias.erb │ │ │ ├── directory.erb │ │ │ ├── empty.erb │ │ │ ├── fastcgi.erb │ │ │ ├── proxy.erb │ │ │ └── stub_status.erb │ │ │ ├── vhost_footer.erb │ │ │ ├── vhost_header.erb │ │ │ ├── vhost_ssl_footer.erb │ │ │ └── vhost_ssl_header.erb │ └── tests │ │ ├── init.pp │ │ ├── location_alias.pp │ │ ├── location_params.pp │ │ ├── upstream.pp │ │ ├── vhost.pp │ │ └── vhost_ssl.pp │ ├── php │ ├── .fixtures.yml │ ├── .gemfile │ ├── .gitignore │ ├── .project │ ├── .travis.yml │ ├── LICENSE │ ├── Modulefile │ ├── README.md │ ├── Rakefile │ ├── lib │ │ └── facter │ │ │ ├── php_fact_extension_dir.rb │ │ │ └── php_fact_version.rb │ ├── manifests │ │ ├── augeas.pp │ │ ├── conf.pp │ │ ├── devel.pp │ │ ├── ini.pp │ │ ├── init.pp │ │ ├── mod.pp │ │ ├── module.pp │ │ ├── params.pp │ │ ├── pear.pp │ │ ├── pear │ │ │ ├── config.pp │ │ │ └── module.pp │ │ ├── pecl │ │ │ ├── config.pp │ │ │ └── module.pp │ │ └── spec.pp │ ├── spec │ │ ├── classes │ │ │ └── php_spec.rb │ │ ├── defines │ │ │ ├── php_module_spec.rb │ │ │ └── php_pear_module_spec.rb │ │ └── spec_helper.rb │ └── templates │ │ ├── extra-ini.erb │ │ └── spec.erb │ ├── puppi │ ├── .fixtures.yml │ ├── .gemfile │ ├── .gitignore │ ├── .project │ ├── .travis.yml │ ├── LICENSE │ ├── 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 │ │ │ ├── hg.sh │ │ │ ├── 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 │ │ │ └── windows_common_appdata.rb │ │ └── puppet │ │ │ └── parser │ │ │ └── functions │ │ │ ├── any2bool.rb │ │ │ ├── bool2ensure.rb │ │ │ ├── get_class_args.rb │ │ │ ├── get_magicvar.rb │ │ │ ├── get_module_path.rb │ │ │ ├── nslookup.rb │ │ │ ├── options_lookup.rb │ │ │ ├── params_lookup.rb │ │ │ └── url_parse.rb │ ├── manifests │ │ ├── check.pp │ │ ├── configure.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 │ │ │ ├── hg.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 │ │ ├── puppi_clean.erb │ │ └── todo.erb │ ├── stdlib │ ├── .fixtures.yml │ ├── .gemspec │ ├── .gitignore │ ├── .project │ ├── .rspec │ ├── .sync.yml │ ├── .travis.yml │ ├── CHANGELOG.md │ ├── CONTRIBUTING.md │ ├── Gemfile │ ├── LICENSE │ ├── README.markdown │ ├── README_DEVELOPER.markdown │ ├── README_SPECS.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 │ │ │ ├── functions │ │ │ └── type_of.rb │ │ │ ├── parser │ │ │ └── functions │ │ │ │ ├── abs.rb │ │ │ │ ├── any2array.rb │ │ │ │ ├── base64.rb │ │ │ │ ├── basename.rb │ │ │ │ ├── bool2num.rb │ │ │ │ ├── bool2str.rb │ │ │ │ ├── camelcase.rb │ │ │ │ ├── capitalize.rb │ │ │ │ ├── chomp.rb │ │ │ │ ├── chop.rb │ │ │ │ ├── concat.rb │ │ │ │ ├── count.rb │ │ │ │ ├── deep_merge.rb │ │ │ │ ├── defined_with_params.rb │ │ │ │ ├── delete.rb │ │ │ │ ├── delete_at.rb │ │ │ │ ├── delete_undef_values.rb │ │ │ │ ├── delete_values.rb │ │ │ │ ├── difference.rb │ │ │ │ ├── dirname.rb │ │ │ │ ├── downcase.rb │ │ │ │ ├── empty.rb │ │ │ │ ├── ensure_packages.rb │ │ │ │ ├── ensure_resource.rb │ │ │ │ ├── flatten.rb │ │ │ │ ├── floor.rb │ │ │ │ ├── fqdn_rotate.rb │ │ │ │ ├── get_module_path.rb │ │ │ │ ├── getparam.rb │ │ │ │ ├── getvar.rb │ │ │ │ ├── grep.rb │ │ │ │ ├── has_interface_with.rb │ │ │ │ ├── has_ip_address.rb │ │ │ │ ├── has_ip_network.rb │ │ │ │ ├── has_key.rb │ │ │ │ ├── hash.rb │ │ │ │ ├── intersection.rb │ │ │ │ ├── is_array.rb │ │ │ │ ├── is_bool.rb │ │ │ │ ├── is_domain_name.rb │ │ │ │ ├── is_float.rb │ │ │ │ ├── is_function_available.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 │ │ │ │ ├── pick_default.rb │ │ │ │ ├── prefix.rb │ │ │ │ ├── private.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 │ │ │ │ ├── suffix.rb │ │ │ │ ├── swapcase.rb │ │ │ │ ├── time.rb │ │ │ │ ├── to_bytes.rb │ │ │ │ ├── type.rb │ │ │ │ ├── type3x.rb │ │ │ │ ├── union.rb │ │ │ │ ├── unique.rb │ │ │ │ ├── upcase.rb │ │ │ │ ├── uriescape.rb │ │ │ │ ├── validate_absolute_path.rb │ │ │ │ ├── validate_array.rb │ │ │ │ ├── validate_augeas.rb │ │ │ │ ├── validate_bool.rb │ │ │ │ ├── validate_cmd.rb │ │ │ │ ├── validate_hash.rb │ │ │ │ ├── validate_ipv4_address.rb │ │ │ │ ├── validate_ipv6_address.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 │ ├── metadata.json │ ├── spec │ │ ├── acceptance │ │ │ ├── abs_spec.rb │ │ │ ├── any2array_spec.rb │ │ │ ├── base64_spec.rb │ │ │ ├── bool2num_spec.rb │ │ │ ├── build_csv.rb │ │ │ ├── capitalize_spec.rb │ │ │ ├── chomp_spec.rb │ │ │ ├── chop_spec.rb │ │ │ ├── concat_spec.rb │ │ │ ├── count_spec.rb │ │ │ ├── deep_merge_spec.rb │ │ │ ├── defined_with_params_spec.rb │ │ │ ├── delete_at_spec.rb │ │ │ ├── delete_spec.rb │ │ │ ├── delete_undef_values_spec.rb │ │ │ ├── delete_values_spec.rb │ │ │ ├── difference_spec.rb │ │ │ ├── dirname_spec.rb │ │ │ ├── downcase_spec.rb │ │ │ ├── empty_spec.rb │ │ │ ├── ensure_packages_spec.rb │ │ │ ├── ensure_resource_spec.rb │ │ │ ├── flatten_spec.rb │ │ │ ├── floor_spec.rb │ │ │ ├── fqdn_rotate_spec.rb │ │ │ ├── get_module_path_spec.rb │ │ │ ├── getparam_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 │ │ │ ├── intersection_spec.rb │ │ │ ├── is_array_spec.rb │ │ │ ├── is_bool_spec.rb │ │ │ ├── is_domain_name_spec.rb │ │ │ ├── is_float_spec.rb │ │ │ ├── is_function_available_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 │ │ │ ├── loadyaml_spec.rb │ │ │ ├── lstrip_spec.rb │ │ │ ├── max_spec.rb │ │ │ ├── member_spec.rb │ │ │ ├── merge_spec.rb │ │ │ ├── min_spec.rb │ │ │ ├── nodesets │ │ │ │ ├── centos-59-x64.yml │ │ │ │ ├── centos-6-vcloud.yml │ │ │ │ ├── centos-64-x64-pe.yml │ │ │ │ ├── centos-64-x64.yml │ │ │ │ ├── centos-65-x64.yml │ │ │ │ ├── default.yml │ │ │ │ ├── fedora-18-x64.yml │ │ │ │ ├── sles-11-x64.yml │ │ │ │ ├── ubuntu-server-10044-x64.yml │ │ │ │ ├── ubuntu-server-12042-x64.yml │ │ │ │ ├── ubuntu-server-1404-x64.yml │ │ │ │ ├── windows-2003-i386.yml │ │ │ │ ├── windows-2003-x86_64.yml │ │ │ │ ├── windows-2008-x86_64.yml │ │ │ │ ├── windows-2008r2-x86_64.yml │ │ │ │ ├── windows-2012-x86_64.yml │ │ │ │ └── windows-2012r2-x86_64.yml │ │ │ ├── num2bool_spec.rb │ │ │ ├── parsejson_spec.rb │ │ │ ├── parseyaml_spec.rb │ │ │ ├── pick_default_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 │ │ │ ├── suffix_spec.rb │ │ │ ├── swapcase_spec.rb │ │ │ ├── time_spec.rb │ │ │ ├── to_bytes_spec.rb │ │ │ ├── type_spec.rb │ │ │ ├── union_spec.rb │ │ │ ├── unique_spec.rb │ │ │ ├── unsupported_spec.rb │ │ │ ├── upcase_spec.rb │ │ │ ├── uriescape_spec.rb │ │ │ ├── validate_absolute_path_spec.rb │ │ │ ├── validate_array_spec.rb │ │ │ ├── validate_augeas_spec.rb │ │ │ ├── validate_bool_spec.rb │ │ │ ├── validate_cmd_spec.rb │ │ │ ├── validate_hash_spec.rb │ │ │ ├── validate_ipv4_address_spec.rb │ │ │ ├── validate_ipv6_address_spec.rb │ │ │ ├── validate_re_spec.rb │ │ │ ├── validate_slength_spec.rb │ │ │ ├── validate_string_spec.rb │ │ │ ├── values_at_spec.rb │ │ │ ├── values_spec.rb │ │ │ └── zip_spec.rb │ │ ├── classes │ │ │ └── anchor_spec.rb │ │ ├── functions │ │ │ ├── abs_spec.rb │ │ │ ├── any2array_spec.rb │ │ │ ├── base64_spec.rb │ │ │ ├── bool2num_spec.rb │ │ │ ├── capitalize_spec.rb │ │ │ ├── chomp_spec.rb │ │ │ ├── chop_spec.rb │ │ │ ├── concat_spec.rb │ │ │ ├── count_spec.rb │ │ │ ├── deep_merge_spec.rb │ │ │ ├── defined_with_params_spec.rb │ │ │ ├── delete_at_spec.rb │ │ │ ├── delete_spec.rb │ │ │ ├── delete_undef_values_spec.rb │ │ │ ├── delete_values_spec.rb │ │ │ ├── difference_spec.rb │ │ │ ├── dirname_spec.rb │ │ │ ├── downcase_spec.rb │ │ │ ├── empty_spec.rb │ │ │ ├── ensure_packages_spec.rb │ │ │ ├── ensure_resource_spec.rb │ │ │ ├── flatten_spec.rb │ │ │ ├── floor_spec.rb │ │ │ ├── fqdn_rotate_spec.rb │ │ │ ├── get_module_path_spec.rb │ │ │ ├── getparam_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 │ │ │ ├── intersection_spec.rb │ │ │ ├── is_array_spec.rb │ │ │ ├── is_bool_spec.rb │ │ │ ├── is_domain_name_spec.rb │ │ │ ├── is_float_spec.rb │ │ │ ├── is_function_available.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 │ │ │ ├── loadyaml_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_default_spec.rb │ │ │ ├── pick_spec.rb │ │ │ ├── prefix_spec.rb │ │ │ ├── private_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 │ │ │ ├── suffix_spec.rb │ │ │ ├── swapcase_spec.rb │ │ │ ├── time_spec.rb │ │ │ ├── to_bytes_spec.rb │ │ │ ├── type3x_spec.rb │ │ │ ├── type_spec.rb │ │ │ ├── union_spec.rb │ │ │ ├── unique_spec.rb │ │ │ ├── upcase_spec.rb │ │ │ ├── uriescape_spec.rb │ │ │ ├── validate_absolute_path_spec.rb │ │ │ ├── validate_array_spec.rb │ │ │ ├── validate_augeas_spec.rb │ │ │ ├── validate_bool_spec.rb │ │ │ ├── validate_cmd_spec.rb │ │ │ ├── validate_hash_spec.rb │ │ │ ├── validate_ipv4_address_spec.rb │ │ │ ├── validate_ipv6_address_spec.rb │ │ │ ├── validate_re_spec.rb │ │ │ ├── validate_slength_spec.rb │ │ │ ├── validate_string_spec.rb │ │ │ ├── values_at_spec.rb │ │ │ ├── values_spec.rb │ │ │ └── zip_spec.rb │ │ ├── lib │ │ │ └── puppet_spec │ │ │ │ ├── compiler.rb │ │ │ │ ├── database.rb │ │ │ │ ├── files.rb │ │ │ │ ├── fixtures.rb │ │ │ │ ├── matchers.rb │ │ │ │ ├── modules.rb │ │ │ │ ├── pops.rb │ │ │ │ ├── scope.rb │ │ │ │ ├── settings.rb │ │ │ │ └── verbose.rb │ │ ├── monkey_patches │ │ │ ├── alias_should_to_must.rb │ │ │ └── publicize_methods.rb │ │ ├── spec.opts │ │ ├── spec_helper.rb │ │ ├── spec_helper_acceptance.rb │ │ └── unit │ │ │ ├── facter │ │ │ ├── facter_dot_d_spec.rb │ │ │ ├── pe_version_spec.rb │ │ │ ├── root_home_spec.rb │ │ │ └── util │ │ │ │ └── puppet_settings_spec.rb │ │ │ └── puppet │ │ │ ├── functions │ │ │ └── type_of_spec.rb │ │ │ ├── parser │ │ │ └── functions │ │ │ │ ├── basename_spec.rb │ │ │ │ ├── bool2str_spec.rb │ │ │ │ └── camelcase_spec.rb │ │ │ ├── provider │ │ │ └── file_line │ │ │ │ └── ruby_spec.rb │ │ │ └── type │ │ │ ├── anchor_spec.rb │ │ │ └── file_line_spec.rb │ └── tests │ │ ├── file_line.pp │ │ ├── has_interface_with.pp │ │ ├── has_ip_address.pp │ │ ├── has_ip_network.pp │ │ └── init.pp │ └── wp │ ├── Modulefile │ ├── README.md │ └── manifests │ ├── cli.pp │ ├── command.pp │ ├── init.pp │ ├── option.pp │ ├── params.pp │ ├── plugin.pp │ ├── rewrite.pp │ ├── site.pp │ └── theme.pp └── qs-init.sh /.gitignore: -------------------------------------------------------------------------------- 1 | .vagrant 2 | .version-current.txt 3 | go-client-repo 4 | -------------------------------------------------------------------------------- /.version.txt: -------------------------------------------------------------------------------- 1 | 1 -------------------------------------------------------------------------------- /misc/qs-config.php: -------------------------------------------------------------------------------- 1 | '/bin:/usr/bin:/usr/local/bin:/usr/sbin:/sbin' } 2 | 3 | import 'manifests/*.pp' 4 | 5 | include apt 6 | include apt::update 7 | include apt::backports 8 | 9 | # Make sure apt-get is up-to-date before we do anything else 10 | stage { 'updates': before => Stage['main'] } 11 | class { 'updates': stage => updates } 12 | 13 | # updates 14 | class updates { 15 | exec { 'apt-get update': 16 | command => 'apt-get update --quiet --yes', 17 | timeout => 0 18 | } 19 | } 20 | 21 | host { 'vip-go': 22 | name => $hostname, 23 | ensure => 'present', 24 | ip => '127.0.0.1', 25 | } 26 | 27 | package { ['git']: 28 | ensure => present, 29 | } 30 | -------------------------------------------------------------------------------- /puppet/manifests/env.pp: -------------------------------------------------------------------------------- 1 | 2 | # Set up Zeroconf (Bonjour) 3 | package { 'libnss-mdns': ensure => present } -------------------------------------------------------------------------------- /puppet/manifests/mysql.pp: -------------------------------------------------------------------------------- 1 | class { 'mysql::server': } 2 | 3 | mysql::db { $client: 4 | user => 'wordpress', 5 | password => 'wordpress', 6 | } 7 | -------------------------------------------------------------------------------- /puppet/manifests/nginx.pp: -------------------------------------------------------------------------------- 1 | class { nginx: } 2 | 3 | nginx::resource::vhost { $client: 4 | www_root => '/var/www', 5 | server_name => [$fqdn], 6 | index_files => ['index.php'], 7 | raw_prepend => 'try_files $uri $uri/ /index.php?$query_string;', 8 | use_default_location => false, 9 | } 10 | 11 | nginx::resource::location { 'php': 12 | location => '~ \.php$', 13 | vhost => $client, 14 | fastcgi => 'unix:/var/run/php/php7.0-fpm.sock', 15 | fastcgi_param => { 16 | 'SCRIPT_FILENAME' => '$document_root$fastcgi_script_name', 17 | } 18 | } 19 | 20 | nginx::resource::location { '/_static/': 21 | vhost => $client, 22 | fastcgi => 'unix:/var/run/php/php7.0-fpm.sock', 23 | fastcgi_param => { 24 | 'SCRIPT_FILENAME' => '$document_root/wp-content/mu-plugins/http-concat/ngx-http-concat.php', 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /puppet/manifests/php.pp: -------------------------------------------------------------------------------- 1 | apt::ppa { 'ppa:ondrej/php': } -> 2 | class { 'php': 3 | package => 'php7.0', 4 | service => 'nginx', 5 | config_dir => '/etc/php/7.0', 6 | config_file => '/etc/php/7.0/apache2/php.ini', 7 | } 8 | 9 | service { 'php7.0-fpm': 10 | ensure => running, 11 | enable => true, 12 | } 13 | 14 | php::module { ['fpm','cli','mysql']: 15 | module_prefix => 'php7.0-' 16 | } -> 17 | file { '/var/log/php/' : 18 | ensure => directory, 19 | owner => www-data, group => www-data, mode => 444, 20 | } -> 21 | file { '/var/log/php/error.log' : 22 | ensure => present, 23 | owner => www-data, group => www-data, mode => 644, 24 | } -> 25 | file { '/etc/php/7.0/fpm/conf.d/error.ini' : 26 | ensure => present, 27 | notify => Service['php7.0-fpm'], 28 | owner => root, group => root, mode => 644, 29 | content => "error_log = /var/log/php/error.log\n", 30 | } 31 | -------------------------------------------------------------------------------- /puppet/modules/apt/.fixtures.yml: -------------------------------------------------------------------------------- 1 | fixtures: 2 | repositories: 3 | "stdlib": 4 | "repo": "git://github.com/puppetlabs/puppetlabs-stdlib.git" 5 | "ref": "v2.2.1" 6 | symlinks: 7 | "apt": "#{source_dir}" 8 | -------------------------------------------------------------------------------- /puppet/modules/apt/.gitignore: -------------------------------------------------------------------------------- 1 | pkg/ 2 | Gemfile.lock 3 | vendor/ 4 | spec/fixtures/ 5 | .vagrant/ 6 | .bundle/ 7 | coverage/ 8 | .idea/ 9 | *.iml 10 | -------------------------------------------------------------------------------- /puppet/modules/apt/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | apt 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 | -------------------------------------------------------------------------------- /puppet/modules/apt/.puppet-lint.rc: -------------------------------------------------------------------------------- 1 | --no-single_quote_string_with_variables-check 2 | -------------------------------------------------------------------------------- /puppet/modules/apt/.sync.yml: -------------------------------------------------------------------------------- 1 | --- 2 | .travis.yml: 3 | includes: 4 | - rvm: 1.8.7 5 | env: PUPPET_GEM_VERSION="~> 3.0" 6 | - rvm: 1.9.3 7 | env: PUPPET_GEM_VERSION="~> 3.0" 8 | - rvm: 2.0.0 9 | env: PUPPET_GEM_VERSION="~> 3.0" 10 | -------------------------------------------------------------------------------- /puppet/modules/apt/.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | language: ruby 3 | bundler_args: --without system_tests 4 | script: "bundle exec rake validate && bundle exec rake lint && bundle exec rake spec SPEC_OPTS='--format documentation'" 5 | matrix: 6 | fast_finish: true 7 | include: 8 | - rvm: 1.8.7 9 | env: PUPPET_GEM_VERSION="~> 3.0" 10 | - rvm: 1.9.3 11 | env: PUPPET_GEM_VERSION="~> 3.0" 12 | - rvm: 2.0.0 13 | env: PUPPET_GEM_VERSION="~> 3.0" 14 | notifications: 15 | email: false 16 | -------------------------------------------------------------------------------- /puppet/modules/apt/Rakefile: -------------------------------------------------------------------------------- 1 | require 'puppetlabs_spec_helper/rake_tasks' 2 | require 'puppet-lint/tasks/puppet-lint' 3 | 4 | PuppetLint.configuration.fail_on_warnings = true 5 | PuppetLint.configuration.send('relative') 6 | PuppetLint.configuration.send('disable_80chars') 7 | PuppetLint.configuration.send('disable_class_inherits_from_params_class') 8 | PuppetLint.configuration.send('disable_documentation') 9 | PuppetLint.configuration.send('disable_single_quote_string_with_variables') 10 | PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"] 11 | -------------------------------------------------------------------------------- /puppet/modules/apt/lib/facter/apt_update_last_success.rb: -------------------------------------------------------------------------------- 1 | require 'facter' 2 | 3 | #This is derived from the file /var/lib/apt/periodic/update-success-stamp 4 | # This is generated upon a successful apt-get update run natively in ubuntu. 5 | # the Puppetlabs-apt module deploys this same functionality for other debian-ish OSes 6 | Facter.add('apt_update_last_success') do 7 | confine :osfamily => 'Debian' 8 | setcode do 9 | if File.exists?('/var/lib/apt/periodic/update-success-stamp') 10 | #get epoch time 11 | lastsuccess = File.mtime('/var/lib/apt/periodic/update-success-stamp').to_i 12 | lastsuccess 13 | else 14 | lastsuccess = -1 15 | lastsuccess 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /puppet/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 | require => 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 | -------------------------------------------------------------------------------- /puppet/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 => template('apt/_header.erb', 'apt/conf.erb'), 14 | owner => root, 15 | group => root, 16 | mode => '0644', 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /puppet/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: 46925553 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 => '46925553', 18 | key_server => 'subkeys.pgp.net', 19 | pin => '-10', 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /puppet/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: 46925553 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 => '46925553', 18 | key_server => 'subkeys.pgp.net', 19 | pin => '-10', 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /puppet/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 => template('apt/_header.erb', 'apt/release.erb'), 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /puppet/modules/apt/spec/acceptance/class_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper_acceptance' 2 | 3 | describe 'apt class' do 4 | 5 | context 'default parameters' do 6 | # Using puppet_apply as a helper 7 | it 'should work with no errors' do 8 | pp = <<-EOS 9 | class { 'apt': } 10 | EOS 11 | 12 | # Run it twice and test for idempotency 13 | apply_manifest(pp, :catch_failures => true) 14 | apply_manifest(pp, :catch_failures => true) 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /puppet/modules/apt/spec/acceptance/nodesets/centos-59-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | centos-59-x64: 3 | roles: 4 | - master 5 | platform: el-5-x86_64 6 | box : centos-59-x64-vbox4210-nocm 7 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-59-x64-vbox4210-nocm.box 8 | hypervisor : vagrant 9 | CONFIG: 10 | type: git 11 | -------------------------------------------------------------------------------- /puppet/modules/apt/spec/acceptance/nodesets/centos-64-x64-pe.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | centos-64-x64: 3 | roles: 4 | - master 5 | - database 6 | - dashboard 7 | platform: el-6-x86_64 8 | box : centos-64-x64-vbox4210-nocm 9 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box 10 | hypervisor : vagrant 11 | CONFIG: 12 | type: pe 13 | -------------------------------------------------------------------------------- /puppet/modules/apt/spec/acceptance/nodesets/centos-65-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | centos-65-x64: 3 | roles: 4 | - master 5 | platform: el-6-x86_64 6 | box : centos-65-x64-vbox436-nocm 7 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box 8 | hypervisor : vagrant 9 | CONFIG: 10 | type: foss 11 | -------------------------------------------------------------------------------- /puppet/modules/apt/spec/acceptance/nodesets/debian-70rc1-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | debian-70rc1-x64: 3 | roles: 4 | - master 5 | platform: debian-70rc1-x64 6 | box : debian-70rc1-x64-vbox4210-nocm 7 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/debian-70rc1-x64-vbox4210-nocm.box 8 | hypervisor : vagrant 9 | CONFIG: 10 | type: foss 11 | -------------------------------------------------------------------------------- /puppet/modules/apt/spec/acceptance/nodesets/debian-73-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | debian-73-x64: 3 | roles: 4 | - master 5 | platform: debian-7-amd64 6 | box : debian-73-x64-virtualbox-nocm 7 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/debian-73-x64-virtualbox-nocm.box 8 | hypervisor : vagrant 9 | CONFIG: 10 | log_level: debug 11 | type: git -------------------------------------------------------------------------------- /puppet/modules/apt/spec/acceptance/nodesets/default.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | ubuntu-server-12042-x64: 3 | roles: 4 | - master 5 | platform: ubuntu-server-12.04-amd64 6 | box : ubuntu-server-12042-x64-vbox4210-nocm 7 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box 8 | hypervisor : vagrant 9 | CONFIG: 10 | type: foss 11 | vagrant_ssh_port_random: true 12 | -------------------------------------------------------------------------------- /puppet/modules/apt/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | ubuntu-server-10044-x64: 3 | roles: 4 | - master 5 | platform: ubuntu-10.04-amd64 6 | box : ubuntu-server-10044-x64-vbox4210-nocm 7 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-10044-x64-vbox4210-nocm.box 8 | hypervisor : vagrant 9 | CONFIG: 10 | type: foss 11 | -------------------------------------------------------------------------------- /puppet/modules/apt/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | ubuntu-server-12042-x64: 3 | roles: 4 | - master 5 | platform: ubuntu-12.04-amd64 6 | box : ubuntu-server-12042-x64-vbox4210-nocm 7 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box 8 | hypervisor : vagrant 9 | CONFIG: 10 | type: foss 11 | -------------------------------------------------------------------------------- /puppet/modules/apt/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | ubuntu-server-1404-x64: 3 | roles: 4 | - master 5 | platform: ubuntu-14.04-amd64 6 | box : puppetlabs/ubuntu-14.04-64-nocm 7 | box_url : https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm 8 | hypervisor : vagrant 9 | CONFIG: 10 | log_level : debug 11 | type: git 12 | -------------------------------------------------------------------------------- /puppet/modules/apt/spec/classes/debian_testing_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | describe 'apt::debian::testing', :type => :class do 3 | let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian' } } 4 | it { 5 | should contain_apt__source("debian_testing").with({ 6 | "location" => "http://debian.mirror.iweb.ca/debian/", 7 | "release" => "testing", 8 | "repos" => "main contrib non-free", 9 | "required_packages" => "debian-keyring debian-archive-keyring", 10 | "key" => "46925553", 11 | "key_server" => "subkeys.pgp.net", 12 | "pin" => "-10" 13 | }) 14 | } 15 | end 16 | -------------------------------------------------------------------------------- /puppet/modules/apt/spec/classes/debian_unstable_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | describe 'apt::debian::unstable', :type => :class do 3 | let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian' } } 4 | it { 5 | should contain_apt__source("debian_unstable").with({ 6 | "location" => "http://debian.mirror.iweb.ca/debian/", 7 | "release" => "unstable", 8 | "repos" => "main contrib non-free", 9 | "required_packages" => "debian-keyring debian-archive-keyring", 10 | "key" => "46925553", 11 | "key_server" => "subkeys.pgp.net", 12 | "pin" => "-10" 13 | }) 14 | } 15 | end 16 | -------------------------------------------------------------------------------- /puppet/modules/apt/spec/classes/release_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | describe 'apt::release', :type => :class do 3 | let(:facts) { { :lsbdistid => 'Debian' } } 4 | let (:title) { 'my_package' } 5 | 6 | let :param_set do 7 | { :release_id => 'precise' } 8 | end 9 | 10 | let (:params) { param_set } 11 | 12 | it { should contain_class("apt::params") } 13 | 14 | it { 15 | should contain_file("/etc/apt/apt.conf.d/01release").with({ 16 | "mode" => "0644", 17 | "owner" => "root", 18 | "group" => "root", 19 | "content" => /APT::Default-Release "#{param_set[:release_id]}";/ 20 | }) 21 | } 22 | end 23 | 24 | -------------------------------------------------------------------------------- /puppet/modules/apt/spec/defines/builddep_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | describe 'apt::builddep', :type => :define do 3 | 4 | let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian' } } 5 | let(:title) { 'my_package' } 6 | 7 | describe "defaults" do 8 | it { should contain_exec("apt-builddep-my_package").that_requires('Exec[apt_update]').with({ 9 | 'command' => "/usr/bin/apt-get -y --force-yes build-dep my_package", 10 | 'logoutput' => 'on_failure' 11 | }) 12 | } 13 | it { should contain_anchor("apt::builddep::my_package").with({ 14 | 'require' => 'Class[Apt::Update]', 15 | }) 16 | } 17 | end 18 | 19 | end 20 | -------------------------------------------------------------------------------- /puppet/modules/apt/spec/spec.opts: -------------------------------------------------------------------------------- 1 | --format 2 | s 3 | --colour 4 | --loadby 5 | mtime 6 | --backtrace 7 | -------------------------------------------------------------------------------- /puppet/modules/apt/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'puppetlabs_spec_helper/module_spec_helper' 2 | -------------------------------------------------------------------------------- /puppet/modules/apt/templates/10periodic.erb: -------------------------------------------------------------------------------- 1 | APT::Periodic::Enable "<%= @enable %>"; 2 | APT::Periodic::BackUpArchiveInterval "<%= @backup_interval %>"; 3 | APT::Periodic::BackUpLevel "<%= @backup_level %>"; 4 | APT::Periodic::MaxAge "<%= @max_age %>"; 5 | APT::Periodic::MinAge "<%= @min_age %>"; 6 | APT::Periodic::MaxSize "<%= @max_size %>"; 7 | APT::Periodic::Update-Package-Lists "<%= @update %>"; 8 | APT::Periodic::Download-Upgradeable-Packages "<%= @download %>"; 9 | APT::Periodic::Download-Upgradeable-Packages-Debdelta "<%= @download_delta %>"; 10 | APT::Periodic::Unattended-Upgrade "<%= @upgrade %>"; 11 | APT::Periodic::AutocleanInterval "<%= @autoclean %>"; 12 | APT::Periodic::Verbose "<%= @verbose %>"; 13 | <%- unless @randomsleep.nil? -%> 14 | APT::Periodic::RandomSleep "<%= @randomsleep %>"; 15 | <%- end -%> 16 | -------------------------------------------------------------------------------- /puppet/modules/apt/templates/15update-stamp.erb: -------------------------------------------------------------------------------- 1 | APT::Update::Post-Invoke-Success {"touch /var/lib/apt/periodic/update-success-stamp 2>/dev/null || true";}; 2 | -------------------------------------------------------------------------------- /puppet/modules/apt/templates/_header.erb: -------------------------------------------------------------------------------- 1 | # This file is managed by Puppet. DO NOT EDIT. 2 | -------------------------------------------------------------------------------- /puppet/modules/apt/templates/conf.erb: -------------------------------------------------------------------------------- 1 | <%= @content -%> 2 | -------------------------------------------------------------------------------- /puppet/modules/apt/templates/pin.pref.erb: -------------------------------------------------------------------------------- 1 | <%- 2 | @pin = "release a=#{@name}" # default value 3 | if @pin_release.length > 0 4 | options = [] 5 | options.push("a=#{@release}") if @release.length > 0 6 | options.push("n=#{@codename}") if @codename.length > 0 7 | options.push("v=#{@release_version}") if @release_version.length > 0 8 | options.push("c=#{@component}") if @component.length > 0 9 | options.push("o=#{@originator}") if @originator.length > 0 10 | options.push("l=#{@label}") if @label.length > 0 11 | @pin = "release #{options.join(', ')}" 12 | elsif @version.length > 0 13 | @pin = "version #{@version}" 14 | elsif @origin.length > 0 15 | @pin = "origin #{@origin}" 16 | end 17 | -%> 18 | Explanation: <%= @explanation %> 19 | Package: <%= @packages_string %> 20 | Pin: <%= @pin %> 21 | Pin-Priority: <%= @priority %> 22 | -------------------------------------------------------------------------------- /puppet/modules/apt/templates/progressbar.erb: -------------------------------------------------------------------------------- 1 | Dpkg::Progress-Fancy "1"; 2 | -------------------------------------------------------------------------------- /puppet/modules/apt/templates/proxy.erb: -------------------------------------------------------------------------------- 1 | Acquire::http::Proxy "http://<%= @proxy_host %>:<%= @proxy_port %>"; 2 | -------------------------------------------------------------------------------- /puppet/modules/apt/templates/release.erb: -------------------------------------------------------------------------------- 1 | APT::Default-Release "<%= @release_id %>"; 2 | -------------------------------------------------------------------------------- /puppet/modules/apt/templates/source.list.erb: -------------------------------------------------------------------------------- 1 | # <%= @comment %> 2 | <%- if @include_deb then -%> 3 | deb <%- if @architecture or @trusted_source -%> 4 | [<%- if @architecture %>arch=<%= @architecture %> <% end %><% if @trusted_source %>trusted=yes<% end -%> 5 | ] <%- end %><%= @location %> <%= @release_real %> <%= @repos %> 6 | <%- end -%> 7 | <%- if @include_src then -%> 8 | deb-src <%- if @architecture or @trusted_source -%> 9 | [<%- if @architecture %>arch=<%= @architecture %> <% end %><% if @trusted_source %>trusted=yes<% end -%> 10 | ] <%- end %><%= @location %> <%= @release_real %> <%= @repos %> 11 | <%- end -%> 12 | -------------------------------------------------------------------------------- /puppet/modules/apt/templates/unauth.erb: -------------------------------------------------------------------------------- 1 | APT::Get::AllowUnauthenticated 1; 2 | -------------------------------------------------------------------------------- /puppet/modules/apt/tests/builddep.pp: -------------------------------------------------------------------------------- 1 | class { 'apt': } 2 | apt::builddep{ 'glusterfs-server': } 3 | -------------------------------------------------------------------------------- /puppet/modules/apt/tests/debian/testing.pp: -------------------------------------------------------------------------------- 1 | class { 'apt': } 2 | class { 'apt::debian::testing': } 3 | -------------------------------------------------------------------------------- /puppet/modules/apt/tests/debian/unstable.pp: -------------------------------------------------------------------------------- 1 | class { 'apt': } 2 | class { 'apt::debian::unstable': } 3 | -------------------------------------------------------------------------------- /puppet/modules/apt/tests/force.pp: -------------------------------------------------------------------------------- 1 | # force.pp 2 | 3 | # force a package from a specific release 4 | apt::force { 'package1': 5 | release => 'backports', 6 | } 7 | 8 | # force a package to be a specific version 9 | apt::force { 'package2': 10 | version => '1.0.0-1', 11 | } 12 | 13 | # force a package from a specific release to be a specific version 14 | apt::force { 'package3': 15 | release => 'sid', 16 | version => '2.0.0-1', 17 | } 18 | -------------------------------------------------------------------------------- /puppet/modules/apt/tests/init.pp: -------------------------------------------------------------------------------- 1 | class { 'apt': } 2 | -------------------------------------------------------------------------------- /puppet/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 | key_options => 'http-proxy="http://proxyuser:proxypass@example.org:3128"', 6 | } 7 | -------------------------------------------------------------------------------- /puppet/modules/apt/tests/params.pp: -------------------------------------------------------------------------------- 1 | include apt::params 2 | -------------------------------------------------------------------------------- /puppet/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 | -------------------------------------------------------------------------------- /puppet/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 | -------------------------------------------------------------------------------- /puppet/modules/apt/tests/release.pp: -------------------------------------------------------------------------------- 1 | class { 'apt': } 2 | class { 'apt::release': 3 | release_id => 'karmic' 4 | } 5 | -------------------------------------------------------------------------------- /puppet/modules/apt/tests/unattended_upgrades.pp: -------------------------------------------------------------------------------- 1 | include apt::unattended_upgrades 2 | -------------------------------------------------------------------------------- /puppet/modules/concat/.fixtures.yml: -------------------------------------------------------------------------------- 1 | fixtures: 2 | repositories: 3 | 'stdlib': 4 | repo: 'git://github.com/puppetlabs/puppetlabs-stdlib.git' 5 | ref: '4.2.0' 6 | symlinks: 7 | 'concat': '#{source_dir}' 8 | -------------------------------------------------------------------------------- /puppet/modules/concat/.gitattributes: -------------------------------------------------------------------------------- 1 | *.sh eol=lf 2 | -------------------------------------------------------------------------------- /puppet/modules/concat/.gitignore: -------------------------------------------------------------------------------- 1 | pkg/ 2 | Gemfile.lock 3 | vendor/ 4 | spec/fixtures/ 5 | .vagrant/ 6 | .bundle/ 7 | coverage/ 8 | .idea/ 9 | *.iml 10 | -------------------------------------------------------------------------------- /puppet/modules/concat/.sync.yml: -------------------------------------------------------------------------------- 1 | --- 2 | .travis.yml: 3 | includes: 4 | - rvm: 1.8.7 5 | env: PUPPET_GEM_VERSION="~> 3.0" 6 | - rvm: 1.9.3 7 | env: PUPPET_GEM_VERSION="~> 3.0" 8 | - rvm: 2.0.0 9 | env: PUPPET_GEM_VERSION="~> 3.0" 10 | -------------------------------------------------------------------------------- /puppet/modules/concat/.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | language: ruby 3 | bundler_args: --without system_tests 4 | script: "bundle exec rake validate && bundle exec rake lint && bundle exec rake spec SPEC_OPTS='--format documentation'" 5 | matrix: 6 | fast_finish: true 7 | include: 8 | - rvm: 1.8.7 9 | env: PUPPET_GEM_VERSION="~> 3.0" 10 | - rvm: 1.9.3 11 | env: PUPPET_GEM_VERSION="~> 3.0" 12 | - rvm: 2.0.0 13 | env: PUPPET_GEM_VERSION="~> 3.0" 14 | notifications: 15 | email: false 16 | -------------------------------------------------------------------------------- /puppet/modules/concat/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2012 R.I.Pienaar 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of 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, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | 15 | -------------------------------------------------------------------------------- /puppet/modules/concat/Rakefile: -------------------------------------------------------------------------------- 1 | require 'puppetlabs_spec_helper/rake_tasks' 2 | require 'puppet-lint/tasks/puppet-lint' 3 | 4 | PuppetLint.configuration.fail_on_warnings 5 | PuppetLint.configuration.send('relative') 6 | PuppetLint.configuration.send('disable_80chars') 7 | PuppetLint.configuration.send('disable_class_inherits_from_params_class') 8 | PuppetLint.configuration.send('disable_documentation') 9 | PuppetLint.configuration.send('disable_single_quote_string_with_variables') 10 | PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"] 11 | -------------------------------------------------------------------------------- /puppet/modules/concat/lib/facter/concat_basedir.rb: -------------------------------------------------------------------------------- 1 | # == Fact: concat_basedir 2 | # 3 | # A custom fact that sets the default location for fragments 4 | # 5 | # "${::vardir}/concat/" 6 | # 7 | Facter.add("concat_basedir") do 8 | setcode do 9 | File.join(Puppet[:vardir],"concat") 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /puppet/modules/concat/lib/puppet/parser/functions/concat_is_bool.rb: -------------------------------------------------------------------------------- 1 | # 2 | # concat_is_bool.rb 3 | # 4 | 5 | module Puppet::Parser::Functions 6 | newfunction(:concat_is_bool, :type => :rvalue, :doc => <<-EOS 7 | Returns true if the variable passed to this function is a boolean. 8 | EOS 9 | ) do |arguments| 10 | 11 | raise(Puppet::ParseError, "concat_is_bool(): 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?(TrueClass) || type.is_a?(FalseClass) 17 | 18 | return result 19 | end 20 | end 21 | 22 | # vim: set ts=2 sw=2 et : 23 | -------------------------------------------------------------------------------- /puppet/modules/concat/spec/acceptance/empty_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper_acceptance' 2 | 3 | describe 'concat force empty parameter' do 4 | basedir = default.tmpdir('concat') 5 | context 'should run successfully' do 6 | pp = <<-EOS 7 | concat { '#{basedir}/file': 8 | mode => '0644', 9 | force => true, 10 | } 11 | EOS 12 | 13 | it 'applies the manifest twice with no stderr' do 14 | apply_manifest(pp, :catch_failures => true) 15 | apply_manifest(pp, :catch_changes => true) 16 | end 17 | 18 | describe file("#{basedir}/file") do 19 | it { should be_file } 20 | its(:content) { should_not match /1\n2/ } 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /puppet/modules/concat/spec/acceptance/nodesets/aix-71-vcloud.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | pe-aix-71-acceptance: 3 | roles: 4 | - master 5 | - dashboard 6 | - database 7 | - agent 8 | - default 9 | platform: aix-7.1-power 10 | hypervisor: aix 11 | ip: pe-aix-71-acceptance.delivery.puppetlabs.net 12 | CONFIG: 13 | type: pe 14 | nfs_server: NONE 15 | consoleport: 443 16 | datastore: instance0 17 | folder: Delivery/Quality Assurance/Enterprise/Dynamic 18 | resourcepool: delivery/Quality Assurance/Enterprise/Dynamic 19 | pooling_api: http://vcloud.delivery.puppetlabs.net/ 20 | -------------------------------------------------------------------------------- /puppet/modules/concat/spec/acceptance/nodesets/centos-59-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | centos-59-x64: 3 | roles: 4 | - master 5 | platform: el-5-x86_64 6 | box : centos-59-x64-vbox4210-nocm 7 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-59-x64-vbox4210-nocm.box 8 | hypervisor : vagrant 9 | CONFIG: 10 | type: git 11 | -------------------------------------------------------------------------------- /puppet/modules/concat/spec/acceptance/nodesets/centos-64-x64-pe.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | centos-64-x64: 3 | roles: 4 | - master 5 | - database 6 | - dashboard 7 | platform: el-6-x86_64 8 | box : centos-64-x64-vbox4210-nocm 9 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box 10 | hypervisor : vagrant 11 | CONFIG: 12 | type: pe 13 | -------------------------------------------------------------------------------- /puppet/modules/concat/spec/acceptance/nodesets/centos-64-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | centos-64-x64: 3 | roles: 4 | - master 5 | platform: el-6-x86_64 6 | box : centos-64-x64-vbox4210-nocm 7 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box 8 | hypervisor : vagrant 9 | CONFIG: 10 | type: git 11 | -------------------------------------------------------------------------------- /puppet/modules/concat/spec/acceptance/nodesets/centos-65-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | centos-65-x64: 3 | roles: 4 | - master 5 | platform: el-6-x86_64 6 | box : centos-65-x64-vbox436-nocm 7 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box 8 | hypervisor : vagrant 9 | CONFIG: 10 | type: foss 11 | -------------------------------------------------------------------------------- /puppet/modules/concat/spec/acceptance/nodesets/debian-607-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | debian-607-x64: 3 | roles: 4 | - master 5 | platform: debian-6-amd64 6 | box : debian-607-x64-vbox4210-nocm 7 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/debian-607-x64-vbox4210-nocm.box 8 | hypervisor : vagrant 9 | CONFIG: 10 | type: git 11 | -------------------------------------------------------------------------------- /puppet/modules/concat/spec/acceptance/nodesets/debian-70rc1-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | debian-70rc1-x64: 3 | roles: 4 | - master 5 | platform: debian-7-amd64 6 | box : debian-70rc1-x64-vbox4210-nocm 7 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/debian-70rc1-x64-vbox4210-nocm.box 8 | hypervisor : vagrant 9 | CONFIG: 10 | type: git 11 | -------------------------------------------------------------------------------- /puppet/modules/concat/spec/acceptance/nodesets/debian-73-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | debian-73-x64.localhost: 3 | roles: 4 | - master 5 | platform: debian-7-amd64 6 | box : debian-73-x64-virtualbox-nocm 7 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/debian-73-x64-virtualbox-nocm.box 8 | hypervisor : vagrant 9 | CONFIG: 10 | log_level: debug 11 | type: foss 12 | -------------------------------------------------------------------------------- /puppet/modules/concat/spec/acceptance/nodesets/default.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | centos-64-x64: 3 | roles: 4 | - master 5 | platform: el-6-x86_64 6 | box : centos-64-x64-vbox4210-nocm 7 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box 8 | hypervisor : vagrant 9 | CONFIG: 10 | type: git 11 | -------------------------------------------------------------------------------- /puppet/modules/concat/spec/acceptance/nodesets/fedora-18-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | fedora-18-x64: 3 | roles: 4 | - master 5 | platform: fedora-18-x86_64 6 | box : fedora-18-x64-vbox4210-nocm 7 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/fedora-18-x64-vbox4210-nocm.box 8 | hypervisor : vagrant 9 | CONFIG: 10 | type: git 11 | -------------------------------------------------------------------------------- /puppet/modules/concat/spec/acceptance/nodesets/sles-11-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | sles-11-x64.local: 3 | roles: 4 | - master 5 | platform: sles-11-x64 6 | box : sles-11sp1-x64-vbox4210-nocm 7 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/sles-11sp1-x64-vbox4210-nocm.box 8 | hypervisor : vagrant 9 | CONFIG: 10 | type: foss 11 | -------------------------------------------------------------------------------- /puppet/modules/concat/spec/acceptance/nodesets/sles-11sp1-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | sles-11sp1-x64: 3 | roles: 4 | - master 5 | platform: sles-11-x86_64 6 | box : sles-11sp1-x64-vbox4210-nocm 7 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/sles-11sp1-x64-vbox4210-nocm.box 8 | hypervisor : vagrant 9 | CONFIG: 10 | type: git 11 | -------------------------------------------------------------------------------- /puppet/modules/concat/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | ubuntu-server-10044-x64: 3 | roles: 4 | - master 5 | platform: ubuntu-10.04-amd64 6 | box : ubuntu-server-10044-x64-vbox4210-nocm 7 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-10044-x64-vbox4210-nocm.box 8 | hypervisor : vagrant 9 | CONFIG: 10 | type: foss 11 | -------------------------------------------------------------------------------- /puppet/modules/concat/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | ubuntu-server-12042-x64: 3 | roles: 4 | - master 5 | platform: ubuntu-12.04-amd64 6 | box : ubuntu-server-12042-x64-vbox4210-nocm 7 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box 8 | hypervisor : vagrant 9 | CONFIG: 10 | type: foss 11 | -------------------------------------------------------------------------------- /puppet/modules/concat/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | ubuntu-server-1404-x64: 3 | roles: 4 | - master 5 | platform: ubuntu-14.04-amd64 6 | box : puppetlabs/ubuntu-14.04-64-nocm 7 | box_url : https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm 8 | hypervisor : vagrant 9 | CONFIG: 10 | log_level : debug 11 | type: git 12 | -------------------------------------------------------------------------------- /puppet/modules/concat/spec/acceptance/specinfra_stubs.rb: -------------------------------------------------------------------------------- 1 | class Specinfra::Command::Windows::Base::File < Specinfra::Command::Windows::Base 2 | class << self 3 | def check_is_owned_by(file, owner) 4 | Backend::PowerShell::Command.new do 5 | exec "if((Get-Item '#{file}').GetAccessControl().Owner -match '#{owner}' 6 | -or ((Get-Item '#{file}').GetAccessControl().Owner -match '#{owner}').Length -gt 0){ exit 0 } else { exit 1 }" 7 | end 8 | end 9 | end 10 | end 11 | 12 | 13 | class Specinfra::Command::Base::File < Specinfra::Command::Base 14 | class << self 15 | def get_content(file) 16 | "cat '#{file}' 2> /dev/null || echo -n" 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /puppet/modules/concat/spec/spec.opts: -------------------------------------------------------------------------------- 1 | --format 2 | s 3 | --colour 4 | --loadby 5 | mtime 6 | --backtrace 7 | -------------------------------------------------------------------------------- /puppet/modules/concat/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'puppetlabs_spec_helper/module_spec_helper' 2 | -------------------------------------------------------------------------------- /puppet/modules/concat/spec/unit/facts/concat_basedir_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'concat_basedir', :type => :fact do 4 | before(:each) { Facter.clear } 5 | 6 | context 'Puppet[:vardir] ==' do 7 | it '/var/lib/puppet' do 8 | Puppet.stubs(:[]).with(:vardir).returns('/var/lib/puppet') 9 | Facter.fact(:concat_basedir).value.should == '/var/lib/puppet/concat' 10 | end 11 | 12 | it '/home/apenny/.puppet/var' do 13 | Puppet.stubs(:[]).with(:vardir).returns('/home/apenny/.puppet/var') 14 | Facter.fact(:concat_basedir).value.should == '/home/apenny/.puppet/var/concat' 15 | end 16 | end 17 | 18 | end 19 | -------------------------------------------------------------------------------- /puppet/modules/concat/tests/fragment.pp: -------------------------------------------------------------------------------- 1 | concat { 'testconcat': 2 | ensure => present, 3 | path => '/tmp/concat', 4 | owner => 'root', 5 | group => 'root', 6 | mode => '0664', 7 | } 8 | 9 | concat::fragment { '1': 10 | target => 'testconcat', 11 | content => '1', 12 | order => '01', 13 | } 14 | 15 | concat::fragment { '2': 16 | target => 'testconcat', 17 | content => '2', 18 | order => '02', 19 | } 20 | -------------------------------------------------------------------------------- /puppet/modules/concat/tests/init.pp: -------------------------------------------------------------------------------- 1 | concat { '/tmp/concat': 2 | ensure => present, 3 | force => true, 4 | owner => 'root', 5 | group => 'root', 6 | mode => '0644', 7 | } 8 | -------------------------------------------------------------------------------- /puppet/modules/mysql/.fixtures.yml: -------------------------------------------------------------------------------- 1 | fixtures: 2 | repositories: 3 | "stdlib": "https://github.com/puppetlabs/puppetlabs-stdlib" 4 | "staging": "https://github.com/nanliu/puppet-staging" 5 | symlinks: 6 | "mysql": "#{source_dir}" 7 | -------------------------------------------------------------------------------- /puppet/modules/mysql/.geppetto-rc.json: -------------------------------------------------------------------------------- 1 | { 2 | "excludes": [ 3 | "**/contrib/**", 4 | "**/examples/**", 5 | "**/tests/**", 6 | "**/spec/**", 7 | "**/pkg/**" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /puppet/modules/mysql/.gitignore: -------------------------------------------------------------------------------- 1 | pkg/ 2 | Gemfile.lock 3 | vendor/ 4 | spec/fixtures/ 5 | .vagrant/ 6 | .bundle/ 7 | coverage/ 8 | .idea/ 9 | *.iml 10 | -------------------------------------------------------------------------------- /puppet/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 | -------------------------------------------------------------------------------- /puppet/modules/mysql/.sync.yml: -------------------------------------------------------------------------------- 1 | --- 2 | spec/spec_helper.rb: 3 | unmanaged: true 4 | -------------------------------------------------------------------------------- /puppet/modules/mysql/.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | language: ruby 3 | bundler_args: --without system_tests 4 | script: "bundle exec rake validate && bundle exec rake lint && bundle exec rake spec SPEC_OPTS='--format documentation'" 5 | matrix: 6 | fast_finish: true 7 | include: 8 | - rvm: 1.8.7 9 | env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0" 10 | - rvm: 1.8.7 11 | env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0" 12 | - rvm: 1.9.3 13 | env: PUPPET_GEM_VERSION="~> 3.0" 14 | - rvm: 2.0.0 15 | env: PUPPET_GEM_VERSION="~> 3.0" 16 | notifications: 17 | email: false 18 | -------------------------------------------------------------------------------- /puppet/modules/mysql/Rakefile: -------------------------------------------------------------------------------- 1 | require 'puppetlabs_spec_helper/rake_tasks' 2 | require 'puppet-lint/tasks/puppet-lint' 3 | 4 | PuppetLint.configuration.fail_on_warnings = true 5 | PuppetLint.configuration.send('relative') 6 | PuppetLint.configuration.send('disable_80chars') 7 | PuppetLint.configuration.send('disable_class_inherits_from_params_class') 8 | PuppetLint.configuration.send('disable_documentation') 9 | PuppetLint.configuration.send('disable_single_quote_string_with_variables') 10 | PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"] 11 | -------------------------------------------------------------------------------- /puppet/modules/mysql/TODO: -------------------------------------------------------------------------------- 1 | The best that I can tell is that this code traces back to David Schmitt. It has been forked many times since then :) 2 | 3 | 1. you cannot add databases to an instance that has a root password 4 | 2. you have to specify username as USER@BLAH or it cannot be found 5 | 3. mysql_grant does not complain if user does not exist 6 | 4. Needs support for pre-seeding on debian 7 | 5. the types may need to take user/password 8 | 6. rather or not to configure /etc/.my.cnf should be configurable 9 | -------------------------------------------------------------------------------- /puppet/modules/mysql/examples/backup.pp: -------------------------------------------------------------------------------- 1 | class { 'mysql::server': 2 | root_password => 'password' 3 | } 4 | 5 | class { 'mysql::server::backup': 6 | backupuser => 'myuser', 7 | backuppassword => 'mypassword', 8 | backupdir => '/tmp/backups', 9 | } 10 | -------------------------------------------------------------------------------- /puppet/modules/mysql/examples/bindings.pp: -------------------------------------------------------------------------------- 1 | class { 'mysql::bindings': 2 | php_enable => true, 3 | } 4 | -------------------------------------------------------------------------------- /puppet/modules/mysql/examples/java.pp: -------------------------------------------------------------------------------- 1 | class { 'mysql::java':} 2 | -------------------------------------------------------------------------------- /puppet/modules/mysql/examples/mysql_database.pp: -------------------------------------------------------------------------------- 1 | class { 'mysql::server': 2 | root_password => 'password' 3 | } 4 | mysql::db{ ['test1', 'test2', 'test3']: 5 | ensure => present, 6 | charset => 'utf8', 7 | require => Class['mysql::server'], 8 | } 9 | mysql::db{ 'test4': 10 | ensure => present, 11 | charset => 'latin1', 12 | } 13 | mysql::db{ 'test5': 14 | ensure => present, 15 | charset => 'binary', 16 | collate => 'binary', 17 | } 18 | -------------------------------------------------------------------------------- /puppet/modules/mysql/examples/mysql_db.pp: -------------------------------------------------------------------------------- 1 | class { 'mysql::server': 2 | root_password => 'password' 3 | } 4 | mysql::db { 'mydb': 5 | user => 'myuser', 6 | password => 'mypass', 7 | host => 'localhost', 8 | grant => ['SELECT', 'UPDATE'], 9 | } 10 | mysql::db { "mydb_${fqdn}": 11 | user => 'myuser', 12 | password => 'mypass', 13 | dbname => 'mydb', 14 | host => $::fqdn, 15 | grant => ['SELECT', 'UPDATE'], 16 | tag => $domain, 17 | } 18 | -------------------------------------------------------------------------------- /puppet/modules/mysql/examples/mysql_grant.pp: -------------------------------------------------------------------------------- 1 | mysql_grant{'test1@localhost/redmine.*': 2 | user => 'test1@localhost', 3 | table => 'redmine.*', 4 | privileges => ['UPDATE'], 5 | } 6 | -------------------------------------------------------------------------------- /puppet/modules/mysql/examples/mysql_plugin.pp: -------------------------------------------------------------------------------- 1 | class { 'mysql::server': 2 | root_password => 'password' 3 | } 4 | 5 | $validate_password_soname = $::osfamily ? { 6 | windows => 'validate_password.dll', 7 | default => 'validate_password.so' 8 | } 9 | 10 | mysql::plugin { 'validate_password': 11 | ensure => present, 12 | soname => $validate_password_soname, 13 | } 14 | 15 | $auth_socket_soname = $::osfamily ? { 16 | windows => 'auth_socket.dll', 17 | default => 'auth_socket.so' 18 | } 19 | 20 | mysql::plugin { 'auth_socket': 21 | ensure => present, 22 | soname => $auth_socket_soname, 23 | } 24 | -------------------------------------------------------------------------------- /puppet/modules/mysql/examples/mysql_user.pp: -------------------------------------------------------------------------------- 1 | $mysql_root_pw = 'password' 2 | 3 | class { 'mysql::server': 4 | root_password => 'password', 5 | } 6 | 7 | mysql_user{ 'redmine@localhost': 8 | ensure => present, 9 | password_hash => mysql_password('redmine'), 10 | require => Class['mysql::server'], 11 | } 12 | 13 | mysql_user{ 'dan@localhost': 14 | ensure => present, 15 | password_hash => mysql_password('blah') 16 | } 17 | 18 | mysql_user{ 'dan@%': 19 | ensure => present, 20 | password_hash => mysql_password('blah'), 21 | } 22 | 23 | mysql_user{ 'socketplugin@%': 24 | ensure => present, 25 | plugin => 'unix_socket', 26 | } 27 | 28 | mysql_user{ 'socketplugin@%': 29 | ensure => present, 30 | password_hash => mysql_password('blah'), 31 | plugin => 'mysql_native_password', 32 | } 33 | -------------------------------------------------------------------------------- /puppet/modules/mysql/examples/perl.pp: -------------------------------------------------------------------------------- 1 | include mysql::bindings::perl 2 | -------------------------------------------------------------------------------- /puppet/modules/mysql/examples/python.pp: -------------------------------------------------------------------------------- 1 | class { 'mysql::bindings::python':} 2 | -------------------------------------------------------------------------------- /puppet/modules/mysql/examples/ruby.pp: -------------------------------------------------------------------------------- 1 | include mysql::bindings::ruby 2 | -------------------------------------------------------------------------------- /puppet/modules/mysql/examples/server.pp: -------------------------------------------------------------------------------- 1 | class { 'mysql::server': 2 | root_password => 'password', 3 | } 4 | -------------------------------------------------------------------------------- /puppet/modules/mysql/examples/server/account_security.pp: -------------------------------------------------------------------------------- 1 | class { 'mysql::server': 2 | root_password => 'password', 3 | } 4 | class { 'mysql::server::account_security': } 5 | -------------------------------------------------------------------------------- /puppet/modules/mysql/examples/server/config.pp: -------------------------------------------------------------------------------- 1 | mysql::server::config { 'testfile': 2 | 3 | } 4 | -------------------------------------------------------------------------------- /puppet/modules/mysql/lib/puppet/parser/functions/mysql_dirname.rb: -------------------------------------------------------------------------------- 1 | module Puppet::Parser::Functions 2 | newfunction(:mysql_dirname, :type => :rvalue, :doc => <<-EOS 3 | Returns the dirname of a path. 4 | EOS 5 | ) do |arguments| 6 | 7 | raise(Puppet::ParseError, "mysql_dirname(): Wrong number of arguments " + 8 | "given (#{arguments.size} for 1)") if arguments.size < 1 9 | 10 | path = arguments[0] 11 | return File.dirname(path) 12 | end 13 | end 14 | 15 | # vim: set ts=2 sw=2 et : 16 | -------------------------------------------------------------------------------- /puppet/modules/mysql/lib/puppet/parser/functions/mysql_password.rb: -------------------------------------------------------------------------------- 1 | # hash a string as mysql's "PASSWORD()" function would do it 2 | require 'digest/sha1' 3 | 4 | module Puppet::Parser::Functions 5 | newfunction(:mysql_password, :type => :rvalue, :doc => <<-EOS 6 | Returns the mysql password hash from the clear text password. 7 | EOS 8 | ) do |args| 9 | 10 | raise(Puppet::ParseError, 'mysql_password(): Wrong number of arguments ' + 11 | "given (#{args.size} for 1)") if args.size != 1 12 | 13 | return '' if args[0].empty? 14 | '*' + Digest::SHA1.hexdigest(Digest::SHA1.digest(args[0])).upcase 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /puppet/modules/mysql/lib/puppet/parser/functions/mysql_strip_hash.rb: -------------------------------------------------------------------------------- 1 | module Puppet::Parser::Functions 2 | newfunction(:mysql_strip_hash, :type => :rvalue, :arity => 1, :doc => <<-EOS 3 | TEMPORARY FUNCTION: EXPIRES 2014-03-10 4 | When given a hash this function strips out all blank entries. 5 | EOS 6 | ) do |args| 7 | 8 | hash = args[0] 9 | unless hash.is_a?(Hash) 10 | raise(Puppet::ParseError, 'mysql_strip_hash(): Requires hash to work with') 11 | end 12 | 13 | # Filter out all the top level blanks. 14 | hash.reject{|k,v| v == ''}.each do |k,v| 15 | if v.is_a?(Hash) 16 | v.reject!{|ki,vi| vi == '' } 17 | end 18 | end 19 | 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /puppet/modules/mysql/lib/puppet/type/mysql_database.rb: -------------------------------------------------------------------------------- 1 | Puppet::Type.newtype(:mysql_database) do 2 | @doc = 'Manage MySQL databases.' 3 | 4 | ensurable 5 | 6 | autorequire(:file) { '/root/.my.cnf' } 7 | 8 | newparam(:name, :namevar => true) do 9 | desc 'The name of the MySQL database to manage.' 10 | end 11 | 12 | newproperty(:charset) do 13 | desc 'The CHARACTER SET setting for the database' 14 | defaultto :utf8 15 | newvalue(/^\S+$/) 16 | end 17 | 18 | newproperty(:collate) do 19 | desc 'The COLLATE setting for the database' 20 | defaultto :utf8_general_ci 21 | newvalue(/^\S+$/) 22 | end 23 | 24 | end 25 | -------------------------------------------------------------------------------- /puppet/modules/mysql/lib/puppet/type/mysql_plugin.rb: -------------------------------------------------------------------------------- 1 | Puppet::Type.newtype(:mysql_plugin) do 2 | @doc = 'Manage MySQL plugins.' 3 | 4 | ensurable 5 | 6 | autorequire(:file) { '/root/.my.cnf' } 7 | 8 | newparam(:name, :namevar => true) do 9 | desc 'The name of the MySQL plugin to manage.' 10 | end 11 | 12 | newproperty(:soname) do 13 | desc 'The name of the library' 14 | newvalue(/^\w+\.\w+$/) 15 | end 16 | 17 | end 18 | -------------------------------------------------------------------------------- /puppet/modules/mysql/manifests/bindings/client_dev.pp: -------------------------------------------------------------------------------- 1 | # Private class 2 | class mysql::bindings::client_dev { 3 | 4 | if $mysql::bindings::client_dev_package_name { 5 | package { 'mysql-client_dev': 6 | ensure => $mysql::bindings::client_dev_package_ensure, 7 | install_options => $mysql::bindings::install_options, 8 | name => $mysql::bindings::client_dev_package_name, 9 | provider => $mysql::bindings::client_dev_package_provider, 10 | } 11 | } else { 12 | warning("No MySQL client development package configured for ${::operatingsystem}.") 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /puppet/modules/mysql/manifests/bindings/daemon_dev.pp: -------------------------------------------------------------------------------- 1 | # Private class 2 | class mysql::bindings::daemon_dev { 3 | 4 | if $mysql::bindings::daemon_dev_package_name { 5 | package { 'mysql-daemon_dev': 6 | ensure => $mysql::bindings::daemon_dev_package_ensure, 7 | install_options => $mysql::bindings::install_options, 8 | name => $mysql::bindings::daemon_dev_package_name, 9 | provider => $mysql::bindings::daemon_dev_package_provider, 10 | } 11 | } else { 12 | warning("No MySQL daemon development package configured for ${::operatingsystem}.") 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /puppet/modules/mysql/manifests/bindings/java.pp: -------------------------------------------------------------------------------- 1 | # Private class 2 | class mysql::bindings::java { 3 | 4 | package { 'mysql-connector-java': 5 | ensure => $mysql::bindings::java_package_ensure, 6 | install_options => $mysql::bindings::install_options, 7 | name => $mysql::bindings::java_package_name, 8 | provider => $mysql::bindings::java_package_provider, 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /puppet/modules/mysql/manifests/bindings/perl.pp: -------------------------------------------------------------------------------- 1 | # Private class 2 | class mysql::bindings::perl { 3 | 4 | package{ 'perl_mysql': 5 | ensure => $mysql::bindings::perl_package_ensure, 6 | install_options => $mysql::bindings::install_options, 7 | name => $mysql::bindings::perl_package_name, 8 | provider => $mysql::bindings::perl_package_provider, 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /puppet/modules/mysql/manifests/bindings/php.pp: -------------------------------------------------------------------------------- 1 | # Private class: See README.md 2 | class mysql::bindings::php { 3 | 4 | package { 'php-mysql': 5 | ensure => $mysql::bindings::php_package_ensure, 6 | install_options => $mysql::bindings::install_options, 7 | name => $mysql::bindings::php_package_name, 8 | provider => $mysql::bindings::php_package_provider, 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /puppet/modules/mysql/manifests/bindings/python.pp: -------------------------------------------------------------------------------- 1 | # Private class 2 | class mysql::bindings::python { 3 | 4 | package { 'python-mysqldb': 5 | ensure => $mysql::bindings::python_package_ensure, 6 | install_options => $mysql::bindings::install_options, 7 | name => $mysql::bindings::python_package_name, 8 | provider => $mysql::bindings::python_package_provider, 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /puppet/modules/mysql/manifests/bindings/ruby.pp: -------------------------------------------------------------------------------- 1 | # Private class 2 | class mysql::bindings::ruby { 3 | 4 | package{ 'ruby_mysql': 5 | ensure => $mysql::bindings::ruby_package_ensure, 6 | install_options => $mysql::bindings::install_options, 7 | name => $mysql::bindings::ruby_package_name, 8 | provider => $mysql::bindings::ruby_package_provider, 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /puppet/modules/mysql/manifests/client.pp: -------------------------------------------------------------------------------- 1 | # 2 | class mysql::client ( 3 | $bindings_enable = $mysql::params::bindings_enable, 4 | $install_options = undef, 5 | $package_ensure = $mysql::params::client_package_ensure, 6 | $package_name = $mysql::params::client_package_name, 7 | ) inherits mysql::params { 8 | 9 | include '::mysql::client::install' 10 | 11 | if $bindings_enable { 12 | class { 'mysql::bindings': 13 | java_enable => true, 14 | perl_enable => true, 15 | php_enable => true, 16 | python_enable => true, 17 | ruby_enable => true, 18 | } 19 | } 20 | 21 | 22 | # Anchor pattern workaround to avoid resources of mysql::client::install to 23 | # "float off" outside mysql::client 24 | anchor { 'mysql::client::start': } -> 25 | Class['mysql::client::install'] -> 26 | anchor { 'mysql::client::end': } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /puppet/modules/mysql/manifests/client/install.pp: -------------------------------------------------------------------------------- 1 | class mysql::client::install { 2 | 3 | package { 'mysql_client': 4 | ensure => $mysql::client::package_ensure, 5 | install_options => $mysql::client::install_options, 6 | name => $mysql::client::package_name, 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /puppet/modules/mysql/manifests/server/mysqltuner.pp: -------------------------------------------------------------------------------- 1 | # 2 | class mysql::server::mysqltuner( 3 | $ensure = 'present', 4 | $version = 'v1.3.0', 5 | $source = undef, 6 | ) { 7 | 8 | if $source { 9 | $_version = $source 10 | $_source = $source 11 | } else { 12 | $_version = $version 13 | $_source = "https://github.com/major/MySQLTuner-perl/raw/${version}/mysqltuner.pl" 14 | } 15 | 16 | if $ensure == 'present' { 17 | class { 'staging': } 18 | staging::file { "mysqltuner-${_version}": 19 | source => $_source, 20 | } 21 | file { '/usr/local/bin/mysqltuner': 22 | ensure => $ensure, 23 | mode => '0550', 24 | source => "${::staging::path}/mysql/mysqltuner-${_version}", 25 | } 26 | } else { 27 | file { '/usr/local/bin/mysqltuner': 28 | ensure => $ensure, 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /puppet/modules/mysql/manifests/server/providers.pp: -------------------------------------------------------------------------------- 1 | # Convenience class to call each of the three providers with the corresponding 2 | # hashes provided in mysql::server. 3 | # See README.md for details. 4 | class mysql::server::providers { 5 | create_resources('mysql_user', $mysql::server::users) 6 | create_resources('mysql_grant', $mysql::server::grants) 7 | create_resources('mysql_database', $mysql::server::databases) 8 | } 9 | -------------------------------------------------------------------------------- /puppet/modules/mysql/manifests/server/root_password.pp: -------------------------------------------------------------------------------- 1 | # 2 | class mysql::server::root_password { 3 | 4 | $options = $mysql::server::options 5 | 6 | # manage root password if it is set 7 | if $mysql::server::create_root_user == true and $mysql::server::root_password != 'UNSET' { 8 | mysql_user { 'root@localhost': 9 | ensure => present, 10 | password_hash => mysql_password($mysql::server::root_password), 11 | } 12 | } 13 | 14 | if $mysql::server::create_root_my_cnf == true and $mysql::server::root_password != 'UNSET' { 15 | file { "${::root_home}/.my.cnf": 16 | content => template('mysql/my.cnf.pass.erb'), 17 | owner => 'root', 18 | mode => '0600', 19 | } 20 | if $mysql::server::create_root_user == true { 21 | Mysql_user['root@localhost'] -> File["${::root_home}/.my.cnf"] 22 | } 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /puppet/modules/mysql/manifests/server/service.pp: -------------------------------------------------------------------------------- 1 | # 2 | class mysql::server::service { 3 | 4 | if $mysql::server::real_service_manage { 5 | if $mysql::server::real_service_enabled { 6 | $service_ensure = 'running' 7 | } else { 8 | $service_ensure = 'stopped' 9 | } 10 | } 11 | 12 | file { $mysql::params::log_error: 13 | ensure => present, 14 | owner => 'mysql', 15 | group => 'mysql', 16 | } 17 | 18 | service { 'mysqld': 19 | ensure => $service_ensure, 20 | name => $mysql::server::service_name, 21 | enable => $mysql::server::real_service_enabled, 22 | provider => $mysql::server::service_provider, 23 | require => [ File['mysql-config-file'], Package['mysql-server'] ] 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /puppet/modules/mysql/spec/acceptance/nodesets/centos-510-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | centos-510-x64: 3 | roles: 4 | - master 5 | platform: el-5-x86_64 6 | box : centos-510-x64-virtualbox-nocm 7 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-510-x64-virtualbox-nocm.box 8 | hypervisor : vagrant 9 | CONFIG: 10 | type: git 11 | -------------------------------------------------------------------------------- /puppet/modules/mysql/spec/acceptance/nodesets/centos-59-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | centos-59-x64: 3 | roles: 4 | - master 5 | platform: el-5-x86_64 6 | box : centos-59-x64-vbox4210-nocm 7 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-59-x64-vbox4210-nocm.box 8 | hypervisor : vagrant 9 | CONFIG: 10 | type: git 11 | -------------------------------------------------------------------------------- /puppet/modules/mysql/spec/acceptance/nodesets/centos-64-x64-pe.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | centos-64-x64: 3 | roles: 4 | - master 5 | - database 6 | - dashboard 7 | platform: el-6-x86_64 8 | box : centos-64-x64-vbox4210-nocm 9 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box 10 | hypervisor : vagrant 11 | CONFIG: 12 | type: pe 13 | -------------------------------------------------------------------------------- /puppet/modules/mysql/spec/acceptance/nodesets/centos-65-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | centos-65-x64: 3 | roles: 4 | - master 5 | platform: el-6-x86_64 6 | box : centos-65-x64-vbox436-nocm 7 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box 8 | hypervisor : vagrant 9 | CONFIG: 10 | type: foss 11 | -------------------------------------------------------------------------------- /puppet/modules/mysql/spec/acceptance/nodesets/default.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | centos-64-x64: 3 | roles: 4 | - master 5 | - default 6 | platform: el-6-x86_64 7 | box : centos-64-x64-vbox4210-nocm 8 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box 9 | hypervisor : vagrant 10 | CONFIG: 11 | type: foss 12 | -------------------------------------------------------------------------------- /puppet/modules/mysql/spec/acceptance/nodesets/fedora-18-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | fedora-18-x64: 3 | roles: 4 | - master 5 | platform: fedora-18-x86_64 6 | box : fedora-18-x64-vbox4210-nocm 7 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/fedora-18-x64-vbox4210-nocm.box 8 | hypervisor : vagrant 9 | CONFIG: 10 | type: foss 11 | -------------------------------------------------------------------------------- /puppet/modules/mysql/spec/acceptance/nodesets/sles-11-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | sles-11-x64.local: 3 | roles: 4 | - master 5 | platform: sles-11-x64 6 | box : sles-11sp1-x64-vbox4210-nocm 7 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/sles-11sp1-x64-vbox4210-nocm.box 8 | hypervisor : vagrant 9 | CONFIG: 10 | type: foss 11 | -------------------------------------------------------------------------------- /puppet/modules/mysql/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | ubuntu-server-10044-x64: 3 | roles: 4 | - master 5 | platform: ubuntu-10.04-amd64 6 | box : ubuntu-server-10044-x64-vbox4210-nocm 7 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-10044-x64-vbox4210-nocm.box 8 | hypervisor : vagrant 9 | CONFIG: 10 | type: foss 11 | -------------------------------------------------------------------------------- /puppet/modules/mysql/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | ubuntu-server-12042-x64: 3 | roles: 4 | - master 5 | platform: ubuntu-12.04-amd64 6 | box : ubuntu-server-12042-x64-vbox4210-nocm 7 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box 8 | hypervisor : vagrant 9 | CONFIG: 10 | type: foss 11 | -------------------------------------------------------------------------------- /puppet/modules/mysql/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | ubuntu-server-1404-x64: 3 | roles: 4 | - master 5 | platform: ubuntu-14.04-amd64 6 | box : puppetlabs/ubuntu-14.04-64-nocm 7 | box_url : https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm 8 | hypervisor : vagrant 9 | CONFIG: 10 | log_level : debug 11 | type: git 12 | -------------------------------------------------------------------------------- /puppet/modules/mysql/spec/classes/graceful_failures_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'mysql::server' do 4 | on_pe_unsupported_platforms.each do |pe_version,pe_platforms| 5 | pe_platforms.each do |pe_platform,facts| 6 | describe "on #{pe_version} #{pe_platform}" do 7 | let(:facts) { facts } 8 | 9 | context 'should gracefully fail' do 10 | it { expect { is_expected.to compile}.to raise_error(Puppet::Error, /Unsupported platform:/) } 11 | end 12 | end 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /puppet/modules/mysql/spec/classes/mysql_client_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'mysql::client' do 4 | on_pe_supported_platforms(PLATFORMS).each do |pe_version,pe_platforms| 5 | pe_platforms.each do |pe_platform,facts| 6 | describe "on #{pe_version} #{pe_platform}" do 7 | let(:facts) { facts } 8 | 9 | context 'with defaults' do 10 | it { is_expected.not_to contain_class('mysql::bindings') } 11 | it { is_expected.to contain_package('mysql_client') } 12 | end 13 | 14 | context 'with bindings enabled' do 15 | let(:params) {{ :bindings_enable => true }} 16 | 17 | it { is_expected.to contain_class('mysql::bindings') } 18 | it { is_expected.to contain_package('mysql_client') } 19 | end 20 | end 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /puppet/modules/mysql/spec/spec.opts: -------------------------------------------------------------------------------- 1 | --format 2 | s 3 | --colour 4 | --loadby 5 | mtime 6 | --backtrace 7 | -------------------------------------------------------------------------------- /puppet/modules/mysql/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'puppetlabs_spec_helper/module_spec_helper' 2 | require 'puppet_facts' 3 | include PuppetFacts 4 | RSpec.configure do |c| 5 | c.formatter = :documentation 6 | end 7 | 8 | # The default set of platforms to test again. 9 | ENV['UNIT_TEST_PLATFORMS'] = 'centos-6-x86_64 ubuntu-1404-x86_64' 10 | PLATFORMS = ENV['UNIT_TEST_PLATFORMS'].split(' ') 11 | -------------------------------------------------------------------------------- /puppet/modules/mysql/spec/unit/puppet/type/mysql_plugin_spec.rb: -------------------------------------------------------------------------------- 1 | require 'puppet' 2 | require 'puppet/type/mysql_plugin' 3 | describe Puppet::Type.type(:mysql_plugin) do 4 | 5 | before :each do 6 | @plugin = Puppet::Type.type(:mysql_plugin).new(:name => 'test', :soname => 'test.so') 7 | end 8 | 9 | it 'should accept a plugin name' do 10 | expect(@plugin[:name]).to eq('test') 11 | end 12 | 13 | it 'should accept a library name' do 14 | @plugin[:soname] = 'test.so' 15 | expect(@plugin[:soname]).to eq('test.so') 16 | end 17 | 18 | it 'should require a name' do 19 | expect { 20 | Puppet::Type.type(:mysql_plugin).new({}) 21 | }.to raise_error(Puppet::Error, 'Title or name must be provided') 22 | end 23 | 24 | end 25 | -------------------------------------------------------------------------------- /puppet/modules/mysql/templates/my.cnf.erb: -------------------------------------------------------------------------------- 1 | ### MANAGED BY PUPPET ### 2 | 3 | <% @options.sort.map do |k,v| -%> 4 | <% if v.is_a?(Hash) -%> 5 | [<%= k %>] 6 | <% v.sort.map do |ki, vi| -%> 7 | <% if ki == 'ssl-disable' or (ki =~ /^ssl/ and v['ssl-disable'] == true) -%> 8 | <% next %> 9 | <% elsif vi == true or v == '' -%> 10 | <%= ki %> 11 | <% elsif vi.is_a?(Array) -%> 12 | <% vi.each do |vii| -%> 13 | <%= ki %> = <%= vii %> 14 | <% end -%> 15 | <% elsif ![nil, '', :undef].include?(vi) -%> 16 | <%= ki %> = <%= vi %> 17 | <% end -%> 18 | <% end -%> 19 | <% end %> 20 | <% end -%> 21 | 22 | <% if @includedir and @includedir != '' %> 23 | !includedir <%= @includedir %> 24 | <% end %> 25 | -------------------------------------------------------------------------------- /puppet/modules/mysql/templates/my.cnf.pass.erb: -------------------------------------------------------------------------------- 1 | [client] 2 | user=root 3 | host=localhost 4 | <% unless scope.lookupvar('mysql::server::root_password') == 'UNSET' -%> 5 | password='<%= scope.lookupvar('mysql::server::root_password') %>' 6 | <% end -%> 7 | socket=<%= @options['client']['socket'] -%> 8 | -------------------------------------------------------------------------------- /puppet/modules/nginx/.fixtures.yml: -------------------------------------------------------------------------------- 1 | fixtures: 2 | symlinks: 3 | nginx: "#{source_dir}" 4 | forge_modules: 5 | apt: "puppetlabs/apt" 6 | concat: "puppetlabs/concat" 7 | stdlib: "puppetlabs/stdlib" 8 | -------------------------------------------------------------------------------- /puppet/modules/nginx/.gitignore: -------------------------------------------------------------------------------- 1 | files/server_test.crt 2 | files/server_test.pem 3 | pkg/ 4 | pkg/ 5 | Gemfile.lock 6 | spec/fixtures/modules 7 | spec/fixtures/manifests 8 | vendor 9 | .ruby-version 10 | -------------------------------------------------------------------------------- /puppet/modules/nginx/.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 | -------------------------------------------------------------------------------- /puppet/modules/nginx/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | group :test do 4 | gem 'rest-client', '~> 1.6.8', :require => false, :platforms => :ruby_18 5 | end 6 | 7 | group :rake, :test do 8 | gem 'puppetlabs_spec_helper', '>=0.8.2', :require => false 9 | gem 'puppet-blacksmith', :require => false 10 | gem 'rspec-system-puppet', :require => false 11 | end 12 | 13 | group :rake do 14 | gem 'rspec-puppet', '~>1.0' 15 | gem 'rake', '>=0.9.2.2' 16 | gem 'puppet-lint', '>=1.0.1' 17 | gem 'rspec-system-serverspec', :require => false 18 | end 19 | 20 | if puppetversion = ENV['PUPPET_GEM_VERSION'] 21 | gem 'puppet', puppetversion, :require => false 22 | else 23 | gem 'puppet', :require => false 24 | end 25 | -------------------------------------------------------------------------------- /puppet/modules/nginx/Rakefile: -------------------------------------------------------------------------------- 1 | require 'bundler' 2 | Bundler.require(:rake) 3 | require 'rake/clean' 4 | 5 | CLEAN.include('spec/fixtures/', 'doc', 'pkg') 6 | CLOBBER.include('.tmp', '.librarian') 7 | 8 | require 'puppetlabs_spec_helper/rake_tasks' 9 | require 'puppet_blacksmith/rake_tasks' 10 | require 'rspec-system/rake_task' 11 | 12 | task :default => [:clean, :spec] 13 | 14 | PuppetLint.configuration.fail_on_warnings 15 | PuppetLint.configuration.send('relative') 16 | PuppetLint.configuration.send('disable_80chars') 17 | PuppetLint.configuration.send('disable_class_inherits_from_params_class') 18 | PuppetLint.configuration.send('disable_class_parameter_defaults') 19 | PuppetLint.configuration.send('disable_documentation') 20 | PuppetLint.configuration.send('disable_single_quote_string_with_variables') 21 | PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"] 22 | -------------------------------------------------------------------------------- /puppet/modules/nginx/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jfryman/puppet-nginx", 3 | "type": "project", 4 | "description": "Puppet module for nginx installation", 5 | "keywords": ["puppet", "nginx"], 6 | "license": "Apache-2.0", 7 | "require": { 8 | }, 9 | "extra": { 10 | "branch-alias": { 11 | "dev-master": "1.x-dev" 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /puppet/modules/nginx/manifests/notice/config.pp: -------------------------------------------------------------------------------- 1 | class nginx::notice::config { 2 | $message = "[nginx] *** DEPRECATION WARNING***: HI! I notice that you're declaring some attributes in Class[nginx]. It is highly recommended to set these values via Hiera going forward. This will become mandatory in the near future. Please check out https://github.com/jfryman/puppet-nginx/blob/master/docs/hiera.md for more information." 3 | 4 | notify { $message: } 5 | } 6 | -------------------------------------------------------------------------------- /puppet/modules/nginx/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'puppetlabs_spec_helper/module_spec_helper' 2 | 3 | RSpec.configure do |c| 4 | c.default_facts = { 5 | :concat_basedir => '/var/lib/puppet/concat', 6 | } 7 | end 8 | -------------------------------------------------------------------------------- /puppet/modules/nginx/spec/system/class_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper_system' 2 | 3 | describe "nginx class:" do 4 | case node.facts['osfamily'] 5 | when 'RedHat' 6 | package_name = 'nginx' 7 | when 'Debian' 8 | package_name = 'nginx' 9 | when 'Suse' 10 | package_name = 'nginx-0.8' 11 | end 12 | 13 | context 'should run successfully' do 14 | it 'should run successfully' do 15 | pp = "class { 'nginx': }" 16 | 17 | puppet_apply(pp) do |r| 18 | #r.stderr.should be_empty 19 | [0,2].should include r.exit_code 20 | r.refresh 21 | #r.stderr.should be_empty 22 | r.exit_code.should be_zero 23 | end 24 | end 25 | end 26 | 27 | describe package(package_name) do 28 | it { should be_installed } 29 | end 30 | 31 | describe service('nginx') do 32 | it { should be_running } 33 | end 34 | 35 | end 36 | -------------------------------------------------------------------------------- /puppet/modules/nginx/templates/conf.d/map.erb: -------------------------------------------------------------------------------- 1 | map <%= @string %> $<%= @name %> { 2 | <% if @hostnames -%> 3 | hostnames; 4 | <% end -%> 5 | <% if @default -%> 6 | default <%= @default %>; 7 | <% end -%> 8 | 9 | <% if @mappings -%> 10 | <%- field_width = @mappings.inject(0) { |l,(k,v)| k.size > l ? k.size : l } -%> 11 | <%- @mappings.sort_by{|k,v| k}.each do |key,value| -%> 12 | <%= sprintf("%-*s", field_width, key) %> <%= value %>; 13 | <%- end -%> 14 | <% end -%> 15 | } 16 | -------------------------------------------------------------------------------- /puppet/modules/nginx/templates/conf.d/proxy.conf.erb: -------------------------------------------------------------------------------- 1 | proxy_temp_path <%= @proxy_temp_path %>; 2 | client_body_temp_path <%= @client_body_temp_path %>; 3 | proxy_redirect <%= @proxy_redirect %>; 4 | client_max_body_size <%= @client_max_body_size %>; 5 | client_body_buffer_size <%= @client_body_buffer_size %>; 6 | proxy_connect_timeout <%= @proxy_connect_timeout %>; 7 | proxy_send_timeout <%= @proxy_send_timeout %>; 8 | proxy_read_timeout <%= @proxy_read_timeout %>; 9 | proxy_buffers <%= @proxy_buffers %>; 10 | proxy_buffer_size <%= @proxy_buffer_size %>; 11 | <% if @proxy_http_version -%> 12 | proxy_http_version <%= @proxy_http_version %>;<% end %> 13 | <% @proxy_set_header.each do |header| %> 14 | proxy_set_header <%= header %>;<% end %> 15 | proxy_headers_hash_bucket_size <%= @proxy_headers_hash_bucket_size %>; 16 | -------------------------------------------------------------------------------- /puppet/modules/nginx/templates/conf.d/upstream_header.erb: -------------------------------------------------------------------------------- 1 | upstream <%= @name %> { 2 | <% if @upstream_cfg_prepend -%><% @upstream_cfg_prepend.sort_by{|k,v| k}.each do |key,value| %> 3 | <% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> 4 | <% Array(subvalue).each do |asubvalue| -%> 5 | <%= key %> <%= subkey %> <%= asubvalue %>; 6 | <% end -%> 7 | <% end -%><% else -%> 8 | <% Array(value).each do |asubvalue| -%> 9 | <%= key %> <%= asubvalue %>; 10 | <% end -%> 11 | <% end -%> 12 | <% end -%><% end -%> 13 | -------------------------------------------------------------------------------- /puppet/modules/nginx/templates/conf.d/upstream_member.erb: -------------------------------------------------------------------------------- 1 | server <%= @server %>:<%= @port %> fail_timeout=<%= @upstream_fail_timeout %>; 2 | -------------------------------------------------------------------------------- /puppet/modules/nginx/templates/conf.d/upstream_members.erb: -------------------------------------------------------------------------------- 1 | <% @members.each do |i| %> 2 | server <%= i %> fail_timeout=<%= @upstream_fail_timeout %>;<% end %> 3 | -------------------------------------------------------------------------------- /puppet/modules/nginx/templates/vhost/locations/alias.erb: -------------------------------------------------------------------------------- 1 | alias <%= @location_alias %>; 2 | <% if defined? @autoindex -%> 3 | autoindex <%= @autoindex %>; 4 | <% end -%> 5 | -------------------------------------------------------------------------------- /puppet/modules/nginx/templates/vhost/locations/directory.erb: -------------------------------------------------------------------------------- 1 | <% if defined? @www_root -%> 2 | root <%= @www_root %>; 3 | <% end -%> 4 | <% if defined? @autoindex -%> 5 | 6 | autoindex <%= @autoindex %>; 7 | <% end -%> 8 | <% if @index_files.count > 0 -%> 9 | index <% Array(@index_files).each do |i| %> <%= i %><% end %>; 10 | <% end -%> 11 | <% if @try_files -%> 12 | try_files<% @try_files.each do |try| -%> <%= try %><% end -%>; 13 | <% end -%> 14 | <% if instance_variables.any? { |iv| iv.to_s.include? 'auth_basic' } -%> 15 | 16 | <%- if @auth_basic -%> 17 | auth_basic "<%= @auth_basic %>"; 18 | <%- end -%> 19 | <%- if defined? @auth_basic_user_file -%> 20 | auth_basic_user_file <%= @auth_basic_user_file %>; 21 | <%- end -%> 22 | <% end -%> -------------------------------------------------------------------------------- /puppet/modules/nginx/templates/vhost/locations/empty.erb: -------------------------------------------------------------------------------- 1 | <% if @location_custom_cfg -%> 2 | <%- @location_custom_cfg.sort_by {|k,v| k}.each do |key,value| -%> 3 | <%- if value.is_a?(Hash) -%> 4 | <%- value.sort_by {|k,v| k}.each do |subkey,subvalue| -%> 5 | <%- Array(subvalue).each do |asubvalue| -%> 6 | <%= key %> <%= subkey %> <%= asubvalue %>; 7 | <%- end -%> 8 | <%- end -%> 9 | <%- else -%> 10 | <%- Array(value).each do |asubvalue| -%> 11 | <%= key %> <%= asubvalue %>; 12 | <%- end -%> 13 | <%- end -%> 14 | <%- end -%> 15 | <% end -%> 16 | -------------------------------------------------------------------------------- /puppet/modules/nginx/templates/vhost/locations/stub_status.erb: -------------------------------------------------------------------------------- 1 | stub_status on; 2 | -------------------------------------------------------------------------------- /puppet/modules/nginx/tests/init.pp: -------------------------------------------------------------------------------- 1 | # The notify before should always come BEFORE all resources 2 | # managed by the nginx class 3 | # and the notify last should always come AFTER all resources 4 | # managed by the nginx class. 5 | node default { 6 | notify { 'before': } 7 | -> class { 'nginx': } 8 | -> notify { 'last': } 9 | } 10 | -------------------------------------------------------------------------------- /puppet/modules/nginx/tests/location_alias.pp: -------------------------------------------------------------------------------- 1 | include nginx 2 | 3 | nginx::resource::location { 'www.test.com-alias': 4 | ensure => present, 5 | location => '/some/url', 6 | location_alias => '/new/url/', 7 | vhost => 'www.test.com', 8 | } 9 | -------------------------------------------------------------------------------- /puppet/modules/nginx/tests/location_params.pp: -------------------------------------------------------------------------------- 1 | include nginx 2 | 3 | nginx::resource::location { 'www.test.com-params': 4 | ensure => present, 5 | location => '/some/url', 6 | vhost => 'www.test.com', 7 | fastcgi_param => { 8 | 'APP_ENV' => 'production', 9 | 'APP_VERSION' => '0.1.10', 10 | 'APP_SECRET' => 'hisfaihicasagfkjsa', 11 | }, 12 | } 13 | -------------------------------------------------------------------------------- /puppet/modules/nginx/tests/upstream.pp: -------------------------------------------------------------------------------- 1 | include nginx 2 | 3 | nginx::resource::upstream { 'proxypass': 4 | ensure => present, 5 | members => [ 6 | 'localhost:3000', 7 | 'localhost:3001', 8 | 'localhost:3002', 9 | ], 10 | } 11 | -------------------------------------------------------------------------------- /puppet/modules/nginx/tests/vhost.pp: -------------------------------------------------------------------------------- 1 | include nginx 2 | 3 | nginx::resource::vhost { 'test.local test': 4 | ensure => present, 5 | ipv6_enable => true, 6 | proxy => 'http://proxypass', 7 | } 8 | 9 | nginx::resource::vhost { 'test.local:8080': 10 | ensure => present, 11 | listen_port => 8080, 12 | server_name => ['test.local test'], 13 | ipv6_enable => true, 14 | proxy => 'http://proxypass', 15 | } 16 | 17 | -------------------------------------------------------------------------------- /puppet/modules/nginx/tests/vhost_ssl.pp: -------------------------------------------------------------------------------- 1 | include nginx 2 | 3 | nginx::resource::vhost { 'test2.local test2': 4 | ensure => present, 5 | www_root => '/var/www/nginx-default', 6 | ssl => true, 7 | ssl_cert => 'puppet:///modules/sslkey/whildcard_mydomain.crt', 8 | ssl_key => 'puppet:///modules/sslkey/whildcard_mydomain.key' 9 | } 10 | 11 | nginx::resource::location { 'test2.local-bob': 12 | ensure => present, 13 | www_root => '/var/www/bob', 14 | location => '/bob', 15 | vhost => 'test2.local test2', 16 | } 17 | 18 | -------------------------------------------------------------------------------- /puppet/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/puppetlabs/puppetlabs-concat.git" 8 | "stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git" 9 | symlinks: 10 | "php": "#{source_dir}" 11 | 12 | -------------------------------------------------------------------------------- /puppet/modules/php/.gemfile: -------------------------------------------------------------------------------- 1 | source :rubygems 2 | 3 | puppetversion = ENV['PUPPET_VERSION'] 4 | gem 'puppet', puppetversion, :require => false 5 | gem 'puppet-lint' 6 | gem 'rspec', '= 2.14.1' 7 | gem 'puppetlabs_spec_helper', '>= 0.1.0' 8 | -------------------------------------------------------------------------------- /puppet/modules/php/.gitignore: -------------------------------------------------------------------------------- 1 | /.gradle 2 | /metadata.json 3 | /.rvmrc 4 | build 5 | pkg/ 6 | Session.vim 7 | spec/fixtures 8 | .*.sw[a-z] 9 | *.un~ 10 | -------------------------------------------------------------------------------- /puppet/modules/php/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | php 4 | 5 | 6 | 7 | 8 | 9 | com.puppetlabs.geppetto.pp.dsl.ui.modulefileBuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.xtext.ui.shared.xtextBuilder 15 | 16 | 17 | 18 | 19 | 20 | com.puppetlabs.geppetto.pp.dsl.ui.puppetNature 21 | org.eclipse.xtext.ui.shared.xtextNature 22 | 23 | 24 | -------------------------------------------------------------------------------- /puppet/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.1.0" 11 | - PUPPET_VERSION="~> 3.6.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 | -------------------------------------------------------------------------------- /puppet/modules/php/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2013 Alessandro Franceschi / Lab42 2 | 3 | for the relevant commits Copyright (C) by the respective authors. 4 | 5 | Contact Lab42 at: info@lab42.it 6 | 7 | Licensed under the Apache License, Version 2.0 (the "License"); 8 | you may not use this file except in compliance with the License. 9 | You may obtain a copy of the License at 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, software 14 | distributed under the License is distributed on an "AS IS" BASIS, 15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | See the License for the specific language governing permissions and 17 | limitations under the License. 18 | -------------------------------------------------------------------------------- /puppet/modules/php/Modulefile: -------------------------------------------------------------------------------- 1 | name 'example42-php' 2 | version '2.0.18' 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 | -------------------------------------------------------------------------------- /puppet/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 | -------------------------------------------------------------------------------- /puppet/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 -i|grep \'^extension_dir\'|awk \'{ print $3 }\'') || nil 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /puppet/modules/php/lib/facter/php_fact_version.rb: -------------------------------------------------------------------------------- 1 | Facter.add("php_fact_version") do 2 | setcode do 3 | Facter::Util::Resolution.exec('php -v|awk \'{ print $2 }\'|head -n1') || nil 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /puppet/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 | and ! defined(Package[$php::package_devel]) { 9 | package { $php::package_devel : 10 | ensure => $php::manage_package, 11 | install_options => $php::install_options, 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /puppet/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 | -------------------------------------------------------------------------------- /puppet/modules/php/manifests/pecl/config.pp: -------------------------------------------------------------------------------- 1 | # Define: php::pecl::config 2 | # 3 | # Configures pecl 4 | # 5 | # Usage: 6 | # php::pecl::config { http_proxy: value => "myproxy:8080" } 7 | # 8 | define php::pecl::config ( 9 | $value, 10 | $layer = 'user', 11 | $path = '/usr/bin:/bin:/usr/sbin:/sbin' 12 | ) { 13 | 14 | include php::pear 15 | 16 | exec { "pecl-config-set-${name}": 17 | command => "pecl config-set ${name} ${value} ${layer}", 18 | path => $path, 19 | unless => "pecl config-get ${name} | grep ${value}", 20 | require => Package['php-pear'], 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /puppet/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 | -------------------------------------------------------------------------------- /puppet/modules/php/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'puppetlabs_spec_helper/module_spec_helper' 2 | -------------------------------------------------------------------------------- /puppet/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 | -------------------------------------------------------------------------------- /puppet/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 | -------------------------------------------------------------------------------- /puppet/modules/puppi/.fixtures.yml: -------------------------------------------------------------------------------- 1 | fixtures: 2 | repositories: 3 | "concat": "git://github.com/puppetlabs/puppetlabs-concat.git" 4 | "stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git" 5 | symlinks: 6 | "puppi": "#{source_dir}" 7 | -------------------------------------------------------------------------------- /puppet/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 | gem 'puppet-blacksmith', '>= 2.0.0' 8 | -------------------------------------------------------------------------------- /puppet/modules/puppi/.gitignore: -------------------------------------------------------------------------------- 1 | /.gradle 2 | /metadata.json 3 | /.rvmrc 4 | build 5 | pkg/ 6 | Session.vim 7 | spec/fixtures 8 | .*.sw[a-z] 9 | *.un~ 10 | -------------------------------------------------------------------------------- /puppet/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 | -------------------------------------------------------------------------------- /puppet/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 | -------------------------------------------------------------------------------- /puppet/modules/puppi/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2013 Alessandro Franceschi / Lab42 2 | 3 | for the relevant commits Copyright (C) by the respective authors. 4 | 5 | Contact Lab42 at: info@lab42.it 6 | 7 | Licensed under the Apache License, Version 2.0 (the "License"); 8 | you may not use this file except in compliance with the License. 9 | You may obtain a copy of the License at 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, software 14 | distributed under the License is distributed on an "AS IS" BASIS, 15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | See the License for the specific language governing permissions and 17 | limitations under the License. 18 | -------------------------------------------------------------------------------- /puppet/modules/puppi/Modulefile: -------------------------------------------------------------------------------- 1 | name 'example42-puppi' 2 | version '2.1.9' 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 | -------------------------------------------------------------------------------- /puppet/modules/puppi/Rakefile: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'puppetlabs_spec_helper/rake_tasks' 3 | require 'puppet_blacksmith/rake_tasks' 4 | require 'puppet-lint' 5 | PuppetLint.configuration.send("disable_80chars") 6 | PuppetLint.configuration.send('disable_class_parameter_defaults') 7 | -------------------------------------------------------------------------------- /puppet/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 | -------------------------------------------------------------------------------- /puppet/modules/puppi/files/info/readme/readme: -------------------------------------------------------------------------------- 1 | Default ReadMe File. 2 | Edit puppi/files/info/readme/readme to change this message 3 | -------------------------------------------------------------------------------- /puppet/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 | -------------------------------------------------------------------------------- /puppet/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 | -------------------------------------------------------------------------------- /puppet/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 | -------------------------------------------------------------------------------- /puppet/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 -p $workdir/$project/deleted 23 | mv $tobedeleted $workdir/$project/deleted 24 | } 25 | 26 | move 27 | -------------------------------------------------------------------------------- /puppet/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 | -------------------------------------------------------------------------------- /puppet/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 | -------------------------------------------------------------------------------- /puppet/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 | -------------------------------------------------------------------------------- /puppet/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 | -------------------------------------------------------------------------------- /puppet/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 | -------------------------------------------------------------------------------- /puppet/modules/puppi/lib/facter/windows_common_appdata.rb: -------------------------------------------------------------------------------- 1 | require 'facter' 2 | Facter.add(:windows_common_appdata) do 3 | confine :operatingsystem => :windows 4 | if Facter.value(:osfamily) == "windows" 5 | require 'win32/dir' 6 | end 7 | setcode do 8 | Dir::COMMON_APPDATA 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /puppet/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 | -------------------------------------------------------------------------------- /puppet/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 | -------------------------------------------------------------------------------- /puppet/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 | -------------------------------------------------------------------------------- /puppet/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 | -------------------------------------------------------------------------------- /puppet/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 | -------------------------------------------------------------------------------- /puppet/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 | -------------------------------------------------------------------------------- /puppet/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 | -------------------------------------------------------------------------------- /puppet/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 | should contain_file('puppi_helper_spec').with_content(/info/) 17 | end 18 | end 19 | 20 | end 21 | -------------------------------------------------------------------------------- /puppet/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 | should contain_file('/etc/puppi/info/sample').with_content(/myownscript/) 21 | end 22 | end 23 | 24 | end 25 | -------------------------------------------------------------------------------- /puppet/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 | should contain_file('/etc/puppi/logs/mylog').with_content(/mylog.log/) 19 | end 20 | end 21 | 22 | end 23 | -------------------------------------------------------------------------------- /puppet/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 contain_exec('Run_Puppi_myapp').with_command(/puppi deploy myapp/) } 15 | end 16 | 17 | end 18 | -------------------------------------------------------------------------------- /puppet/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 | should contain_file('/etc/puppi/todo/mytodo').with_content(/check_test/) 21 | end 22 | end 23 | 24 | end 25 | -------------------------------------------------------------------------------- /puppet/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 | end 19 | 20 | end 21 | -------------------------------------------------------------------------------- /puppet/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 | -------------------------------------------------------------------------------- /puppet/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 | -------------------------------------------------------------------------------- /puppet/modules/puppi/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'puppetlabs_spec_helper/module_spec_helper' 2 | -------------------------------------------------------------------------------- /puppet/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 | -------------------------------------------------------------------------------- /puppet/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 | -------------------------------------------------------------------------------- /puppet/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 | -------------------------------------------------------------------------------- /puppet/modules/puppi/templates/log.erb: -------------------------------------------------------------------------------- 1 | <% @array_log.each do |path| %><%= path %> 2 | <% end %> 3 | -------------------------------------------------------------------------------- /puppet/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 | -------------------------------------------------------------------------------- /puppet/modules/puppi/templates/puppi_clean.erb: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This scripts cleans puppi log files older than <%= scope.lookupvar('puppi::logs_retention_days') %> days 3 | seconds=$(( (RANDOM%60+1)*60 )) 4 | sleep $seconds 5 | 6 | if [ "<%= scope.lookupvar('puppi::params::logdir') %>" == "/" ] || [ "x<%= scope.lookupvar('puppi::params::logdir') %>" == "x" ]; then 7 | exit 1 8 | fi 9 | find "<%= scope.lookupvar('puppi::params::logdir') %>" -type f -mtime +<%= scope.lookupvar('puppi::logs_retention_days') %> -exec rm '{}' '+' >/dev/null 2>&1 10 | find "<%= scope.lookupvar('puppi::params::logdir') %>" -mindepth 2 -type d -mtime +<%= scope.lookupvar('puppi::logs_retention_days') %> -exec rmdir '{}' '+' >/dev/null 2>&1 11 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/.fixtures.yml: -------------------------------------------------------------------------------- 1 | fixtures: 2 | symlinks: 3 | stdlib: "#{source_dir}" 4 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/.gitignore: -------------------------------------------------------------------------------- 1 | pkg/ 2 | Gemfile.lock 3 | vendor/ 4 | spec/fixtures/ 5 | .vagrant/ 6 | .bundle/ 7 | coverage/ 8 | .idea/ 9 | *.iml 10 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | stdlib 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 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | --format 3 | progress 4 | --backtrace 5 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/.sync.yml: -------------------------------------------------------------------------------- 1 | --- 2 | .travis.yml: 3 | script: "\"bundle exec rake validate && bundle exec rake lint && bundle exec rake spec SPEC_OPTS='--color --format documentation'\"" 4 | Rakefile: 5 | unmanaged: true 6 | Gemfile: 7 | unmanaged: true 8 | spec/spec_helper.rb: 9 | unmanaged: true 10 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | sudo: false 3 | language: ruby 4 | bundler_args: --without system_tests 5 | script: "bundle exec rake validate && bundle exec rake lint && bundle exec rake spec SPEC_OPTS='--color --format documentation'" 6 | matrix: 7 | fast_finish: true 8 | include: 9 | - rvm: 1.8.7 10 | env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0" 11 | - rvm: 1.8.7 12 | env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0" 13 | - rvm: 1.9.3 14 | env: PUPPET_GEM_VERSION="~> 3.0" 15 | - rvm: 2.0.0 16 | env: PUPPET_GEM_VERSION="~> 3.0" 17 | notifications: 18 | email: false 19 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2011 Puppet Labs Inc 2 | 3 | and some parts: 4 | 5 | Copyright (C) 2011 Krzysztof Wilczynski 6 | 7 | Puppet Labs can be contacted at: info@puppetlabs.com 8 | 9 | Licensed under the Apache License, Version 2.0 (the "License"); 10 | you may not use this file except in compliance with the License. 11 | You may obtain a copy of the License at 12 | 13 | http://www.apache.org/licenses/LICENSE-2.0 14 | 15 | Unless required by applicable law or agreed to in writing, software 16 | distributed under the License is distributed on an "AS IS" BASIS, 17 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | See the License for the specific language governing permissions and 19 | limitations under the License. 20 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/README_SPECS.markdown: -------------------------------------------------------------------------------- 1 | NOTE 2 | ==== 3 | 4 | This project's specs depend on puppet core, and thus they require the 5 | `puppetlabs_spec_helper` project. For more information please see the README 6 | in that project, which can be found here: [puppetlabs spec 7 | helper](https://github.com/puppetlabs/puppetlabs_spec_helper) 8 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/Rakefile: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'puppetlabs_spec_helper/rake_tasks' 3 | require 'puppet-lint/tasks/puppet-lint' 4 | PuppetLint.configuration.send('disable_80chars') 5 | PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"] 6 | 7 | desc "Validate manifests, templates, and ruby files in lib." 8 | task :validate do 9 | Dir['manifests/**/*.pp'].each do |manifest| 10 | sh "puppet parser validate --noop #{manifest}" 11 | end 12 | Dir['lib/**/*.rb'].each do |lib_file| 13 | sh "ruby -c #{lib_file}" 14 | end 15 | Dir['templates/**/*.erb'].each do |template| 16 | sh "erb -P -x -T '-' #{template} | ruby -c" 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/lib/facter/util/puppet_settings.rb: -------------------------------------------------------------------------------- 1 | module Facter 2 | module Util 3 | module PuppetSettings 4 | # This method is intended to provide a convenient way to evaluate a 5 | # Facter code block only if Puppet is loaded. This is to account for the 6 | # situation where the fact happens to be in the load path, but Puppet is 7 | # not loaded for whatever reason. Perhaps the user is simply running 8 | # facter without the --puppet flag and they happen to be working in a lib 9 | # directory of a module. 10 | def self.with_puppet 11 | begin 12 | Module.const_get("Puppet") 13 | rescue NameError 14 | nil 15 | else 16 | yield 17 | end 18 | end 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/lib/puppet/parser/functions/bool2num.rb: -------------------------------------------------------------------------------- 1 | # 2 | # bool2num.rb 3 | # 4 | 5 | module Puppet::Parser::Functions 6 | newfunction(:bool2num, :type => :rvalue, :doc => <<-EOS 7 | Converts a boolean to a number. Converts the values: 8 | false, f, 0, n, and no to 0 9 | true, t, 1, y, and yes to 1 10 | Requires a single boolean or string as an input. 11 | EOS 12 | ) do |arguments| 13 | 14 | raise(Puppet::ParseError, "bool2num(): Wrong number of arguments " + 15 | "given (#{arguments.size} for 1)") if arguments.size < 1 16 | 17 | value = function_str2bool([arguments[0]]) 18 | 19 | # We have real boolean values as well ... 20 | result = value ? 1 : 0 21 | 22 | return result 23 | end 24 | end 25 | 26 | # vim: set ts=2 sw=2 et : 27 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/lib/puppet/parser/functions/bool2str.rb: -------------------------------------------------------------------------------- 1 | # 2 | # bool2str.rb 3 | # 4 | 5 | module Puppet::Parser::Functions 6 | newfunction(:bool2str, :type => :rvalue, :doc => <<-EOS 7 | Converts a boolean to a string. 8 | Requires a single boolean as an input. 9 | EOS 10 | ) do |arguments| 11 | 12 | raise(Puppet::ParseError, "bool2str(): Wrong number of arguments " + 13 | "given (#{arguments.size} for 1)") if arguments.size < 1 14 | 15 | value = arguments[0] 16 | klass = value.class 17 | 18 | # We can have either true or false, and nothing else 19 | unless [FalseClass, TrueClass].include?(klass) 20 | raise(Puppet::ParseError, 'bool2str(): Requires a boolean to work with') 21 | end 22 | 23 | return value.to_s 24 | end 25 | end 26 | 27 | # vim: set ts=2 sw=2 et : 28 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/lib/puppet/parser/functions/count.rb: -------------------------------------------------------------------------------- 1 | module Puppet::Parser::Functions 2 | newfunction(:count, :type => :rvalue, :arity => -2, :doc => <<-EOS 3 | Takes an array as first argument and an optional second argument. 4 | Count the number of elements in array that matches second argument. 5 | If called with only an array it counts the number of elements that are not nil/undef. 6 | EOS 7 | ) do |args| 8 | 9 | if (args.size > 2) then 10 | raise(ArgumentError, "count(): Wrong number of arguments "+ 11 | "given #{args.size} for 1 or 2.") 12 | end 13 | 14 | collection, item = args 15 | 16 | if item then 17 | collection.count item 18 | else 19 | collection.count { |obj| obj != nil && obj != :undef && obj != '' } 20 | end 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/lib/puppet/parser/functions/delete_values.rb: -------------------------------------------------------------------------------- 1 | module Puppet::Parser::Functions 2 | newfunction(:delete_values, :type => :rvalue, :doc => <<-EOS 3 | Deletes all instances of a given value from a hash. 4 | 5 | *Examples:* 6 | 7 | delete_values({'a'=>'A','b'=>'B','c'=>'C','B'=>'D'}, 'B') 8 | 9 | Would return: {'a'=>'A','c'=>'C','B'=>'D'} 10 | 11 | EOS 12 | ) do |arguments| 13 | 14 | raise(Puppet::ParseError, 15 | "delete_values(): Wrong number of arguments given " + 16 | "(#{arguments.size} of 2)") if arguments.size != 2 17 | 18 | hash, item = arguments 19 | 20 | if not hash.is_a?(Hash) 21 | raise(TypeError, "delete_values(): First argument must be a Hash. " + \ 22 | "Given an argument of class #{hash.class}.") 23 | end 24 | hash.dup.delete_if { |key, val| item == val } 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/lib/puppet/parser/functions/dirname.rb: -------------------------------------------------------------------------------- 1 | module Puppet::Parser::Functions 2 | newfunction(:dirname, :type => :rvalue, :doc => <<-EOS 3 | Returns the dirname of a path. 4 | EOS 5 | ) do |arguments| 6 | 7 | raise(Puppet::ParseError, "dirname(): Wrong number of arguments " + 8 | "given (#{arguments.size} for 1)") if arguments.size < 1 9 | 10 | path = arguments[0] 11 | return File.dirname(path) 12 | end 13 | end 14 | 15 | # vim: set ts=2 sw=2 et : 16 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/lib/puppet/parser/functions/empty.rb: -------------------------------------------------------------------------------- 1 | # 2 | # empty.rb 3 | # 4 | 5 | module Puppet::Parser::Functions 6 | newfunction(:empty, :type => :rvalue, :doc => <<-EOS 7 | Returns true if the variable is empty. 8 | EOS 9 | ) do |arguments| 10 | 11 | raise(Puppet::ParseError, "empty(): Wrong number of arguments " + 12 | "given (#{arguments.size} for 1)") if arguments.size < 1 13 | 14 | value = arguments[0] 15 | 16 | unless value.is_a?(Array) || value.is_a?(Hash) || value.is_a?(String) 17 | raise(Puppet::ParseError, 'empty(): Requires either ' + 18 | 'array, hash or string to work with') 19 | end 20 | 21 | result = value.empty? 22 | 23 | return result 24 | end 25 | end 26 | 27 | # vim: set ts=2 sw=2 et : 28 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/lib/puppet/parser/functions/flatten.rb: -------------------------------------------------------------------------------- 1 | # 2 | # flatten.rb 3 | # 4 | 5 | module Puppet::Parser::Functions 6 | newfunction(:flatten, :type => :rvalue, :doc => <<-EOS 7 | This function flattens any deeply nested arrays and returns a single flat array 8 | as a result. 9 | 10 | *Examples:* 11 | 12 | flatten(['a', ['b', ['c']]]) 13 | 14 | Would return: ['a','b','c'] 15 | EOS 16 | ) do |arguments| 17 | 18 | raise(Puppet::ParseError, "flatten(): Wrong number of arguments " + 19 | "given (#{arguments.size} for 1)") if arguments.size != 1 20 | 21 | array = arguments[0] 22 | 23 | unless array.is_a?(Array) 24 | raise(Puppet::ParseError, 'flatten(): Requires array to work with') 25 | end 26 | 27 | result = array.flatten 28 | 29 | return result 30 | end 31 | end 32 | 33 | # vim: set ts=2 sw=2 et : 34 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/lib/puppet/parser/functions/get_module_path.rb: -------------------------------------------------------------------------------- 1 | module Puppet::Parser::Functions 2 | newfunction(:get_module_path, :type =>:rvalue, :doc => <<-EOT 3 | Returns the absolute path of the specified module for the current 4 | environment. 5 | 6 | Example: 7 | $module_path = get_module_path('stdlib') 8 | EOT 9 | ) do |args| 10 | raise(Puppet::ParseError, "get_module_path(): Wrong number of arguments, expects one") unless args.size == 1 11 | if module_path = Puppet::Module.find(args[0], compiler.environment.to_s) 12 | module_path.path 13 | else 14 | raise(Puppet::ParseError, "Could not find module #{args[0]} in environment #{compiler.environment}") 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/lib/puppet/parser/functions/grep.rb: -------------------------------------------------------------------------------- 1 | # 2 | # grep.rb 3 | # 4 | 5 | module Puppet::Parser::Functions 6 | newfunction(:grep, :type => :rvalue, :doc => <<-EOS 7 | This function searches through an array and returns any elements that match 8 | the provided regular expression. 9 | 10 | *Examples:* 11 | 12 | grep(['aaa','bbb','ccc','aaaddd'], 'aaa') 13 | 14 | Would return: 15 | 16 | ['aaa','aaaddd'] 17 | EOS 18 | ) do |arguments| 19 | 20 | if (arguments.size != 2) then 21 | raise(Puppet::ParseError, "grep(): Wrong number of arguments "+ 22 | "given #{arguments.size} for 2") 23 | end 24 | 25 | a = arguments[0] 26 | pattern = Regexp.new(arguments[1]) 27 | 28 | a.grep(pattern) 29 | 30 | end 31 | end 32 | 33 | # vim: set ts=2 sw=2 et : 34 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/lib/puppet/parser/functions/has_ip_address.rb: -------------------------------------------------------------------------------- 1 | # 2 | # has_ip_address 3 | # 4 | 5 | module Puppet::Parser::Functions 6 | newfunction(:has_ip_address, :type => :rvalue, :doc => <<-EOS 7 | Returns true if the client has the requested IP address on some interface. 8 | 9 | This function iterates through the 'interfaces' fact and checks the 10 | 'ipaddress_IFACE' facts, performing a simple string comparison. 11 | EOS 12 | ) do |args| 13 | 14 | raise(Puppet::ParseError, "has_ip_address(): Wrong number of arguments " + 15 | "given (#{args.size} for 1)") if args.size != 1 16 | 17 | Puppet::Parser::Functions.autoloader.load(:has_interface_with) \ 18 | unless Puppet::Parser::Functions.autoloader.loaded?(:has_interface_with) 19 | 20 | function_has_interface_with(['ipaddress', args[0]]) 21 | 22 | end 23 | end 24 | 25 | # vim:sts=2 sw=2 26 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/lib/puppet/parser/functions/has_ip_network.rb: -------------------------------------------------------------------------------- 1 | # 2 | # has_ip_network 3 | # 4 | 5 | module Puppet::Parser::Functions 6 | newfunction(:has_ip_network, :type => :rvalue, :doc => <<-EOS 7 | Returns true if the client has an IP address within the requested network. 8 | 9 | This function iterates through the 'interfaces' fact and checks the 10 | 'network_IFACE' facts, performing a simple string comparision. 11 | EOS 12 | ) do |args| 13 | 14 | raise(Puppet::ParseError, "has_ip_network(): Wrong number of arguments " + 15 | "given (#{args.size} for 1)") if args.size != 1 16 | 17 | Puppet::Parser::Functions.autoloader.load(:has_interface_with) \ 18 | unless Puppet::Parser::Functions.autoloader.loaded?(:has_interface_with) 19 | 20 | function_has_interface_with(['network', args[0]]) 21 | 22 | end 23 | end 24 | 25 | # vim:sts=2 sw=2 26 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/lib/puppet/parser/functions/is_array.rb: -------------------------------------------------------------------------------- 1 | # 2 | # is_array.rb 3 | # 4 | 5 | module Puppet::Parser::Functions 6 | newfunction(:is_array, :type => :rvalue, :doc => <<-EOS 7 | Returns true if the variable passed to this function is an array. 8 | EOS 9 | ) do |arguments| 10 | 11 | raise(Puppet::ParseError, "is_array(): Wrong number of arguments " + 12 | "given (#{arguments.size} for 1)") if arguments.size < 1 13 | 14 | type = arguments[0] 15 | 16 | result = type.is_a?(Array) 17 | 18 | return result 19 | end 20 | end 21 | 22 | # vim: set ts=2 sw=2 et : 23 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/lib/puppet/parser/functions/is_bool.rb: -------------------------------------------------------------------------------- 1 | # 2 | # is_bool.rb 3 | # 4 | 5 | module Puppet::Parser::Functions 6 | newfunction(:is_bool, :type => :rvalue, :doc => <<-EOS 7 | Returns true if the variable passed to this function is a boolean. 8 | EOS 9 | ) do |arguments| 10 | 11 | raise(Puppet::ParseError, "is_bool(): 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?(TrueClass) || type.is_a?(FalseClass) 17 | 18 | return result 19 | end 20 | end 21 | 22 | # vim: set ts=2 sw=2 et : 23 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/lib/puppet/parser/functions/is_float.rb: -------------------------------------------------------------------------------- 1 | # 2 | # is_float.rb 3 | # 4 | 5 | module Puppet::Parser::Functions 6 | newfunction(:is_float, :type => :rvalue, :doc => <<-EOS 7 | Returns true if the variable passed to this function is a float. 8 | EOS 9 | ) do |arguments| 10 | 11 | if (arguments.size != 1) then 12 | raise(Puppet::ParseError, "is_float(): Wrong number of arguments "+ 13 | "given #{arguments.size} for 1") 14 | end 15 | 16 | value = arguments[0] 17 | 18 | # Only allow Numeric or String types 19 | return false unless value.is_a?(Numeric) or value.is_a?(String) 20 | 21 | if value != value.to_f.to_s and !value.is_a? Float then 22 | return false 23 | else 24 | return true 25 | end 26 | 27 | end 28 | end 29 | 30 | # vim: set ts=2 sw=2 et : 31 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/lib/puppet/parser/functions/is_hash.rb: -------------------------------------------------------------------------------- 1 | # 2 | # is_hash.rb 3 | # 4 | 5 | module Puppet::Parser::Functions 6 | newfunction(:is_hash, :type => :rvalue, :doc => <<-EOS 7 | Returns true if the variable passed to this function is a hash. 8 | EOS 9 | ) do |arguments| 10 | 11 | raise(Puppet::ParseError, "is_hash(): Wrong number of arguments " + 12 | "given (#{arguments.size} for 1)") if arguments.size != 1 13 | 14 | type = arguments[0] 15 | 16 | result = type.is_a?(Hash) 17 | 18 | return result 19 | end 20 | end 21 | 22 | # vim: set ts=2 sw=2 et : 23 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/lib/puppet/parser/functions/is_ip_address.rb: -------------------------------------------------------------------------------- 1 | # 2 | # is_ip_address.rb 3 | # 4 | 5 | module Puppet::Parser::Functions 6 | newfunction(:is_ip_address, :type => :rvalue, :doc => <<-EOS 7 | Returns true if the string passed to this function is a valid IP address. 8 | EOS 9 | ) do |arguments| 10 | 11 | require 'ipaddr' 12 | 13 | if (arguments.size != 1) then 14 | raise(Puppet::ParseError, "is_ip_address(): Wrong number of arguments "+ 15 | "given #{arguments.size} for 1") 16 | end 17 | 18 | begin 19 | ip = IPAddr.new(arguments[0]) 20 | rescue ArgumentError 21 | return false 22 | end 23 | 24 | if ip.ipv4? or ip.ipv6? then 25 | return true 26 | else 27 | return false 28 | end 29 | end 30 | end 31 | 32 | # vim: set ts=2 sw=2 et : 33 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/lib/puppet/parser/functions/is_mac_address.rb: -------------------------------------------------------------------------------- 1 | # 2 | # is_mac_address.rb 3 | # 4 | 5 | module Puppet::Parser::Functions 6 | newfunction(:is_mac_address, :type => :rvalue, :doc => <<-EOS 7 | Returns true if the string passed to this function is a valid mac address. 8 | EOS 9 | ) do |arguments| 10 | 11 | if (arguments.size != 1) then 12 | raise(Puppet::ParseError, "is_mac_address(): Wrong number of arguments "+ 13 | "given #{arguments.size} for 1") 14 | end 15 | 16 | mac = arguments[0] 17 | 18 | if /^[a-fA-F0-9]{1,2}:[a-fA-F0-9]{1,2}:[a-fA-F0-9]{1,2}:[a-fA-F0-9]{1,2}:[a-fA-F0-9]{1,2}:[a-fA-F0-9]{1,2}$/.match(mac) then 19 | return true 20 | else 21 | return false 22 | end 23 | 24 | end 25 | end 26 | 27 | # vim: set ts=2 sw=2 et : 28 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/lib/puppet/parser/functions/is_string.rb: -------------------------------------------------------------------------------- 1 | # 2 | # is_string.rb 3 | # 4 | 5 | module Puppet::Parser::Functions 6 | newfunction(:is_string, :type => :rvalue, :doc => <<-EOS 7 | Returns true if the variable passed to this function is a string. 8 | EOS 9 | ) do |arguments| 10 | 11 | raise(Puppet::ParseError, "is_string(): Wrong number of arguments " + 12 | "given (#{arguments.size} for 1)") if arguments.size < 1 13 | 14 | type = arguments[0] 15 | 16 | result = type.is_a?(String) 17 | 18 | if result and (type == type.to_f.to_s or type == type.to_i.to_s) then 19 | return false 20 | end 21 | 22 | return result 23 | end 24 | end 25 | 26 | # vim: set ts=2 sw=2 et : 27 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/lib/puppet/parser/functions/keys.rb: -------------------------------------------------------------------------------- 1 | # 2 | # keys.rb 3 | # 4 | 5 | module Puppet::Parser::Functions 6 | newfunction(:keys, :type => :rvalue, :doc => <<-EOS 7 | Returns the keys of a hash as an array. 8 | EOS 9 | ) do |arguments| 10 | 11 | raise(Puppet::ParseError, "keys(): Wrong number of arguments " + 12 | "given (#{arguments.size} for 1)") if arguments.size < 1 13 | 14 | hash = arguments[0] 15 | 16 | unless hash.is_a?(Hash) 17 | raise(Puppet::ParseError, 'keys(): Requires hash to work with') 18 | end 19 | 20 | result = hash.keys 21 | 22 | return result 23 | end 24 | end 25 | 26 | # vim: set ts=2 sw=2 et : 27 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/lib/puppet/parser/functions/loadyaml.rb: -------------------------------------------------------------------------------- 1 | module Puppet::Parser::Functions 2 | 3 | newfunction(:loadyaml, :type => :rvalue, :doc => <<-'ENDHEREDOC') do |args| 4 | Load a YAML file containing an array, string, or hash, and return the data 5 | in the corresponding native data type. 6 | 7 | For example: 8 | 9 | $myhash = loadyaml('/etc/puppet/data/myhash.yaml') 10 | ENDHEREDOC 11 | 12 | unless args.length == 1 13 | raise Puppet::ParseError, ("loadyaml(): wrong number of arguments (#{args.length}; must be 1)") 14 | end 15 | 16 | YAML.load_file(args[0]) 17 | 18 | end 19 | 20 | end 21 | -------------------------------------------------------------------------------- /puppet/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 | # Sometimes we get numbers as numerics and sometimes as strings. 12 | # We try to compare them as numbers when possible 13 | return args.max do |a,b| 14 | if a.to_s =~ /\A-?\d+(.\d+)?\z/ and b.to_s =~ /\A-?\d+(.\d+)?\z/ then 15 | a.to_f <=> b.to_f 16 | else 17 | a.to_s <=> b.to_s 18 | end 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /puppet/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 | # Sometimes we get numbers as numerics and sometimes as strings. 12 | # We try to compare them as numbers when possible 13 | return args.min do |a,b| 14 | if a.to_s =~ /\A^-?\d+(.\d+)?\z/ and b.to_s =~ /\A-?\d+(.\d+)?\z/ then 15 | a.to_f <=> b.to_f 16 | else 17 | a.to_s <=> b.to_s 18 | end 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/lib/puppet/parser/functions/parsejson.rb: -------------------------------------------------------------------------------- 1 | # 2 | # parsejson.rb 3 | # 4 | 5 | module Puppet::Parser::Functions 6 | newfunction(:parsejson, :type => :rvalue, :doc => <<-EOS 7 | This function accepts JSON as a string and converts into the correct Puppet 8 | structure. 9 | EOS 10 | ) do |arguments| 11 | 12 | if (arguments.size != 1) then 13 | raise(Puppet::ParseError, "parsejson(): Wrong number of arguments "+ 14 | "given #{arguments.size} for 1") 15 | end 16 | 17 | json = arguments[0] 18 | 19 | # PSON is natively available in puppet 20 | PSON.load(json) 21 | end 22 | end 23 | 24 | # vim: set ts=2 sw=2 et : 25 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/lib/puppet/parser/functions/parseyaml.rb: -------------------------------------------------------------------------------- 1 | # 2 | # parseyaml.rb 3 | # 4 | 5 | module Puppet::Parser::Functions 6 | newfunction(:parseyaml, :type => :rvalue, :doc => <<-EOS 7 | This function accepts YAML as a string and converts it into the correct 8 | Puppet structure. 9 | EOS 10 | ) do |arguments| 11 | 12 | if (arguments.size != 1) then 13 | raise(Puppet::ParseError, "parseyaml(): Wrong number of arguments "+ 14 | "given #{arguments.size} for 1") 15 | end 16 | 17 | require 'yaml' 18 | 19 | YAML::load(arguments[0]) 20 | 21 | end 22 | end 23 | 24 | # vim: set ts=2 sw=2 et : 25 | -------------------------------------------------------------------------------- /puppet/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 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/lib/puppet/parser/functions/reverse.rb: -------------------------------------------------------------------------------- 1 | # 2 | # reverse.rb 3 | # 4 | 5 | module Puppet::Parser::Functions 6 | newfunction(:reverse, :type => :rvalue, :doc => <<-EOS 7 | Reverses the order of a string or array. 8 | EOS 9 | ) do |arguments| 10 | 11 | raise(Puppet::ParseError, "reverse(): Wrong number of arguments " + 12 | "given (#{arguments.size} for 1)") if arguments.size < 1 13 | 14 | value = arguments[0] 15 | 16 | unless value.is_a?(Array) || value.is_a?(String) 17 | raise(Puppet::ParseError, 'reverse(): Requires either ' + 18 | 'array or string to work with') 19 | end 20 | 21 | result = value.reverse 22 | 23 | return result 24 | end 25 | end 26 | 27 | # vim: set ts=2 sw=2 et : 28 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/lib/puppet/parser/functions/rstrip.rb: -------------------------------------------------------------------------------- 1 | # 2 | # rstrip.rb 3 | # 4 | 5 | module Puppet::Parser::Functions 6 | newfunction(:rstrip, :type => :rvalue, :doc => <<-EOS 7 | Strips leading spaces to the right of the string. 8 | EOS 9 | ) do |arguments| 10 | 11 | raise(Puppet::ParseError, "rstrip(): Wrong number of arguments " + 12 | "given (#{arguments.size} for 1)") if arguments.size < 1 13 | 14 | value = arguments[0] 15 | 16 | unless value.is_a?(Array) || value.is_a?(String) 17 | raise(Puppet::ParseError, 'rstrip(): Requires either ' + 18 | 'array or string to work with') 19 | end 20 | 21 | if value.is_a?(Array) 22 | result = value.collect { |i| i.is_a?(String) ? i.rstrip : i } 23 | else 24 | result = value.rstrip 25 | end 26 | 27 | return result 28 | end 29 | end 30 | 31 | # vim: set ts=2 sw=2 et : 32 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/lib/puppet/parser/functions/sort.rb: -------------------------------------------------------------------------------- 1 | # 2 | # sort.rb 3 | # 4 | 5 | module Puppet::Parser::Functions 6 | newfunction(:sort, :type => :rvalue, :doc => <<-EOS 7 | Sorts strings and arrays lexically. 8 | EOS 9 | ) do |arguments| 10 | 11 | if (arguments.size != 1) then 12 | raise(Puppet::ParseError, "sort(): Wrong number of arguments "+ 13 | "given #{arguments.size} for 1") 14 | end 15 | 16 | value = arguments[0] 17 | 18 | if value.is_a?(Array) then 19 | value.sort 20 | elsif value.is_a?(String) then 21 | value.split("").sort.join("") 22 | end 23 | 24 | end 25 | end 26 | 27 | # vim: set ts=2 sw=2 et : 28 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/lib/puppet/parser/functions/type.rb: -------------------------------------------------------------------------------- 1 | # 2 | # type.rb 3 | # 4 | 5 | module Puppet::Parser::Functions 6 | newfunction(:type, :type => :rvalue, :doc => <<-EOS 7 | DEPRECATED: This function will cease to function on Puppet 4; please use type3x() before upgrading to puppet 4 for backwards-compatibility, or migrate to the new parser's typing system. 8 | EOS 9 | ) do |args| 10 | 11 | warning("type() DEPRECATED: This function will cease to function on Puppet 4; please use type3x() before upgrading to puppet 4 for backwards-compatibility, or migrate to the new parser's typing system.") 12 | if ! Puppet::Parser::Functions.autoloader.loaded?(:type3x) 13 | Puppet::Parser::Functions.autoloader.load(:type3x) 14 | end 15 | function_type3x(args + [false]) 16 | end 17 | end 18 | 19 | # vim: set ts=2 sw=2 et : 20 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/lib/puppet/parser/functions/union.rb: -------------------------------------------------------------------------------- 1 | # 2 | # union.rb 3 | # 4 | 5 | module Puppet::Parser::Functions 6 | newfunction(:union, :type => :rvalue, :doc => <<-EOS 7 | This function returns a union of two arrays. 8 | 9 | *Examples:* 10 | 11 | union(["a","b","c"],["b","c","d"]) 12 | 13 | Would return: ["a","b","c","d"] 14 | EOS 15 | ) do |arguments| 16 | 17 | # Two arguments are required 18 | raise(Puppet::ParseError, "union(): Wrong number of arguments " + 19 | "given (#{arguments.size} for 2)") if arguments.size != 2 20 | 21 | first = arguments[0] 22 | second = arguments[1] 23 | 24 | unless first.is_a?(Array) && second.is_a?(Array) 25 | raise(Puppet::ParseError, 'union(): Requires 2 arrays') 26 | end 27 | 28 | result = first | second 29 | 30 | return result 31 | end 32 | end 33 | 34 | # vim: set ts=2 sw=2 et : 35 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/manifests/init.pp: -------------------------------------------------------------------------------- 1 | # Class: stdlib 2 | # 3 | # This module manages stdlib. Most of stdlib's features are automatically 4 | # loaded by Puppet, but this class should be declared in order to use the 5 | # standardized run stages. 6 | # 7 | # Parameters: none 8 | # 9 | # Actions: 10 | # 11 | # Declares all other classes in the stdlib module. Currently, this consists 12 | # of stdlib::stages. 13 | # 14 | # Requires: nothing 15 | # 16 | class stdlib { 17 | 18 | class { 'stdlib::stages': } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/abs_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper_acceptance' 3 | 4 | describe 'abs function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do 5 | describe 'success' do 6 | it 'should accept a string' do 7 | pp = <<-EOS 8 | $input = '-34.56' 9 | $output = abs($input) 10 | notify { "$output": } 11 | EOS 12 | 13 | apply_manifest(pp, :catch_failures => true) do |r| 14 | expect(r.stdout).to match(/Notice: 34.56/) 15 | end 16 | end 17 | 18 | it 'should accept a float' do 19 | pp = <<-EOS 20 | $input = -34.56 21 | $output = abs($input) 22 | notify { "$output": } 23 | EOS 24 | 25 | apply_manifest(pp, :catch_failures => true) do |r| 26 | expect(r.stdout).to match(/Notice: 34.56/) 27 | end 28 | end 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/base64_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper_acceptance' 3 | 4 | describe 'base64 function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do 5 | describe 'success' do 6 | it 'should encode then decode a string' do 7 | pp = <<-EOS 8 | $encodestring = base64('encode', 'thestring') 9 | $decodestring = base64('decode', $encodestring) 10 | notify { $decodestring: } 11 | EOS 12 | 13 | apply_manifest(pp, :catch_failures => true) do |r| 14 | expect(r.stdout).to match(/thestring/) 15 | end 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/chomp_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper_acceptance' 3 | 4 | describe 'chomp function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do 5 | describe 'success' do 6 | it 'should eat the newline' do 7 | pp = <<-EOS 8 | $input = "test\n" 9 | if size($input) != 5 { 10 | fail("Size of ${input} is not 5.") 11 | } 12 | $output = chomp($input) 13 | if size($output) != 4 { 14 | fail("Size of ${input} is not 4.") 15 | } 16 | EOS 17 | 18 | apply_manifest(pp, :catch_failures => true) 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/deep_merge_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper_acceptance' 3 | 4 | describe 'deep_merge function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do 5 | describe 'success' do 6 | it 'should deep merge two hashes' do 7 | pp = <<-EOS 8 | $hash1 = {'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } } 9 | $hash2 = {'two' => 'dos', 'three' => { 'five' => 5 } } 10 | $merged_hash = deep_merge($hash1, $hash2) 11 | 12 | if $merged_hash != { 'one' => 1, 'two' => 'dos', 'three' => { 'four' => 4, 'five' => 5 } } { 13 | fail("Hash was incorrectly merged.") 14 | } 15 | EOS 16 | 17 | apply_manifest(pp, :catch_failures => true) 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/defined_with_params_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper_acceptance' 3 | 4 | describe 'defined_with_params function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do 5 | describe 'success' do 6 | it 'should successfully notify' do 7 | pp = <<-EOS 8 | user { 'dan': 9 | ensure => present, 10 | } 11 | 12 | if defined_with_params(User[dan], {'ensure' => 'present' }) { 13 | notify { 'User defined with ensure=>present': } 14 | } 15 | EOS 16 | 17 | apply_manifest(pp, :catch_failures => true) do |r| 18 | expect(r.stdout).to match(/Notice: User defined with ensure=>present/) 19 | end 20 | end 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/delete_at_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper_acceptance' 3 | 4 | describe 'delete_at function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do 5 | describe 'success' do 6 | it 'should delete elements of the array' do 7 | pp = <<-EOS 8 | $output = delete_at(['a','b','c','b'], 1) 9 | if $output == ['a','c','b'] { 10 | notify { 'output correct': } 11 | } 12 | EOS 13 | 14 | apply_manifest(pp, :catch_failures => true) do |r| 15 | expect(r.stdout).to match(/Notice: output correct/) 16 | end 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/delete_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper_acceptance' 3 | 4 | describe 'delete function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do 5 | describe 'success' do 6 | it 'should delete elements of the array' do 7 | pp = <<-EOS 8 | $output = delete(['a','b','c','b'], 'b') 9 | if $output == ['a','c'] { 10 | notify { 'output correct': } 11 | } 12 | EOS 13 | 14 | apply_manifest(pp, :catch_failures => true) do |r| 15 | expect(r.stdout).to match(/Notice: output correct/) 16 | end 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/delete_undef_values_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper_acceptance' 3 | 4 | describe 'delete_undef_values function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do 5 | describe 'success' do 6 | it 'should delete elements of the array' do 7 | pp = <<-EOS 8 | $output = delete_undef_values({a=>'A', b=>'', c=>undef, d => false}) 9 | if $output == { a => 'A', b => '', d => false } { 10 | notify { 'output correct': } 11 | } 12 | EOS 13 | 14 | apply_manifest(pp, :catch_failures => true) do |r| 15 | expect(r.stdout).to match(/Notice: output correct/) 16 | end 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/delete_values_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper_acceptance' 3 | 4 | describe 'delete_values function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do 5 | describe 'success' do 6 | it 'should delete elements of the hash' do 7 | pp = <<-EOS 8 | $a = { 'a' => 'A', 'b' => 'B', 'B' => 'C', 'd' => 'B' } 9 | $b = { 'a' => 'A', 'B' => 'C' } 10 | $o = delete_values($a, 'B') 11 | if $o == $b { 12 | notify { 'output correct': } 13 | } 14 | EOS 15 | 16 | apply_manifest(pp, :catch_failures => true) do |r| 17 | expect(r.stdout).to match(/Notice: output correct/) 18 | end 19 | end 20 | end 21 | describe 'failure' do 22 | it 'handles non-hash arguments' 23 | it 'handles improper argument counts' 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/difference_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper_acceptance' 3 | 4 | describe 'difference function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do 5 | describe 'success' do 6 | it 'returns non-duplicates in the first array' do 7 | pp = <<-EOS 8 | $a = ['a','b','c'] 9 | $b = ['b','c','d'] 10 | $c = ['a'] 11 | $o = difference($a, $b) 12 | if $o == $c { 13 | notify { 'output correct': } 14 | } 15 | EOS 16 | 17 | apply_manifest(pp, :catch_failures => true) do |r| 18 | expect(r.stdout).to match(/Notice: output correct/) 19 | end 20 | end 21 | end 22 | describe 'failure' do 23 | it 'handles non-array arguments' 24 | it 'handles improper argument counts' 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/ensure_packages_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper_acceptance' 3 | 4 | describe 'ensure_packages function', :unless => fact('osfamily') =~ /windows/i do 5 | describe 'success' do 6 | it 'ensure_packages a package' do 7 | apply_manifest('package { "rake": ensure => absent, provider => "gem", }') 8 | pp = <<-EOS 9 | $a = "rake" 10 | ensure_packages($a,{'provider' => 'gem'}) 11 | EOS 12 | 13 | apply_manifest(pp, :expect_changes => true) 14 | end 15 | it 'ensures a package already declared' 16 | it 'takes defaults arguments' 17 | end 18 | describe 'failure' do 19 | it 'handles no arguments' 20 | it 'handles non strings' 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/ensure_resource_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper_acceptance' 3 | 4 | describe 'ensure_resource function', :unless => fact('osfamily') =~ /windows/i do 5 | describe 'success' do 6 | it 'ensure_resource a package' do 7 | apply_manifest('package { "rake": ensure => absent, provider => "gem", }') 8 | pp = <<-EOS 9 | $a = "rake" 10 | ensure_resource('package', $a, {'provider' => 'gem'}) 11 | EOS 12 | 13 | apply_manifest(pp, :expect_changes => true) 14 | end 15 | it 'ensures a resource already declared' 16 | it 'takes defaults arguments' 17 | end 18 | describe 'failure' do 19 | it 'handles no arguments' 20 | it 'handles non strings' 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/get_module_path_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper_acceptance' 3 | 4 | describe 'get_module_path function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do 5 | describe 'success' do 6 | it 'get_module_paths dne' do 7 | pp = <<-EOS 8 | $a = $::is_pe ? { 9 | 'true' => '/etc/puppetlabs/puppet/modules/dne', 10 | 'false' => '/etc/puppet/modules/dne', 11 | } 12 | $o = get_module_path('dne') 13 | if $o == $a { 14 | notify { 'output correct': } 15 | } else { 16 | notify { "failed; module path is '$o'": } 17 | } 18 | EOS 19 | 20 | apply_manifest(pp, :expect_failures => true) 21 | end 22 | end 23 | describe 'failure' do 24 | it 'handles improper argument counts' 25 | it 'handles non-numbers' 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/getparam_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper_acceptance' 3 | 4 | describe 'getparam function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do 5 | describe 'success' do 6 | it 'getparam a notify' do 7 | pp = <<-EOS 8 | notify { 'rspec': 9 | message => 'custom rspec message', 10 | } 11 | $o = getparam(Notify['rspec'], 'message') 12 | notice(inline_template('getparam is <%= @o.inspect %>')) 13 | EOS 14 | 15 | apply_manifest(pp, :catch_failures => true) do |r| 16 | expect(r.stdout).to match(/getparam is "custom rspec message"/) 17 | end 18 | end 19 | end 20 | describe 'failure' do 21 | it 'handles no arguments' 22 | it 'handles non strings' 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/getvar_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper_acceptance' 3 | 4 | describe 'getvar function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do 5 | describe 'success' do 6 | it 'getvars from classes' do 7 | pp = <<-EOS 8 | class a::data { $foo = 'aoeu' } 9 | include a::data 10 | $b = 'aoeu' 11 | $o = getvar("a::data::foo") 12 | if $o == $b { 13 | notify { 'output correct': } 14 | } 15 | EOS 16 | 17 | apply_manifest(pp, :catch_failures => true) do |r| 18 | expect(r.stdout).to match(/Notice: output correct/) 19 | end 20 | end 21 | end 22 | describe 'failure' do 23 | it 'handles improper argument counts' 24 | it 'handles non-numbers' 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/grep_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper_acceptance' 3 | 4 | describe 'grep function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do 5 | describe 'success' do 6 | it 'greps arrays' do 7 | pp = <<-EOS 8 | $a = ['aaabbb','bbbccc','dddeee'] 9 | $b = 'bbb' 10 | $c = ['aaabbb','bbbccc'] 11 | $o = grep($a,$b) 12 | if $o == $c { 13 | notify { 'output correct': } 14 | } 15 | EOS 16 | 17 | apply_manifest(pp, :catch_failures => true) do |r| 18 | expect(r.stdout).to match(/Notice: output correct/) 19 | end 20 | end 21 | end 22 | describe 'failure' do 23 | it 'handles improper argument counts' 24 | it 'handles non-arrays' 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/hash_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper_acceptance' 3 | 4 | describe 'hash function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do 5 | describe 'success' do 6 | it 'hashs arrays' do 7 | pp = <<-EOS 8 | $a = ['aaa','bbb','bbb','ccc','ddd','eee'] 9 | $b = { 'aaa' => 'bbb', 'bbb' => 'ccc', 'ddd' => 'eee' } 10 | $o = hash($a) 11 | if $o == $b { 12 | notify { 'output correct': } 13 | } 14 | EOS 15 | 16 | apply_manifest(pp, :catch_failures => true) do |r| 17 | expect(r.stdout).to match(/Notice: output correct/) 18 | end 19 | end 20 | it 'handles odd-length arrays' 21 | end 22 | describe 'failure' do 23 | it 'handles improper argument counts' 24 | it 'handles non-arrays' 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/intersection_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper_acceptance' 3 | 4 | describe 'intersection function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do 5 | describe 'success' do 6 | it 'intersections arrays' do 7 | pp = <<-EOS 8 | $a = ['aaa','bbb','ccc'] 9 | $b = ['bbb','ccc','ddd','eee'] 10 | $c = ['bbb','ccc'] 11 | $o = intersection($a,$b) 12 | if $o == $c { 13 | notify { 'output correct': } 14 | } 15 | EOS 16 | 17 | apply_manifest(pp, :catch_failures => true) do |r| 18 | expect(r.stdout).to match(/Notice: output correct/) 19 | end 20 | end 21 | it 'intersections empty arrays' 22 | end 23 | describe 'failure' do 24 | it 'handles improper argument counts' 25 | it 'handles non-arrays' 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/join_keys_to_values_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper_acceptance' 3 | 4 | describe 'join_keys_to_values function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do 5 | describe 'success' do 6 | it 'join_keys_to_valuess hashes' do 7 | pp = <<-EOS 8 | $a = {'aaa'=>'bbb','ccc'=>'ddd'} 9 | $b = ':' 10 | $o = join_keys_to_values($a,$b) 11 | notice(inline_template('join_keys_to_values is <%= @o.sort.inspect %>')) 12 | EOS 13 | 14 | apply_manifest(pp, :catch_failures => true) do |r| 15 | expect(r.stdout).to match(/join_keys_to_values is \["aaa:bbb", "ccc:ddd"\]/) 16 | end 17 | end 18 | it 'handles non hashes' 19 | it 'handles empty hashes' 20 | end 21 | describe 'failure' do 22 | it 'handles improper argument counts' 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/join_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper_acceptance' 3 | 4 | describe 'join function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do 5 | describe 'success' do 6 | it 'joins arrays' do 7 | pp = <<-EOS 8 | $a = ['aaa','bbb','ccc'] 9 | $b = ':' 10 | $c = 'aaa:bbb:ccc' 11 | $o = join($a,$b) 12 | if $o == $c { 13 | notify { 'output correct': } 14 | } 15 | EOS 16 | 17 | apply_manifest(pp, :catch_failures => true) do |r| 18 | expect(r.stdout).to match(/Notice: output correct/) 19 | end 20 | end 21 | it 'handles non arrays' 22 | end 23 | describe 'failure' do 24 | it 'handles improper argument counts' 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/keys_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper_acceptance' 3 | 4 | describe 'keys function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do 5 | describe 'success' do 6 | it 'keyss hashes' do 7 | pp = <<-EOS 8 | $a = {'aaa'=>'bbb','ccc'=>'ddd'} 9 | $o = keys($a) 10 | notice(inline_template('keys is <%= @o.sort.inspect %>')) 11 | EOS 12 | 13 | apply_manifest(pp, :catch_failures => true) do |r| 14 | expect(r.stdout).to match(/keys is \["aaa", "ccc"\]/) 15 | end 16 | end 17 | it 'handles non hashes' 18 | it 'handles empty hashes' 19 | end 20 | describe 'failure' do 21 | it 'handles improper argument counts' 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/max_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper_acceptance' 3 | 4 | describe 'max function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do 5 | describe 'success' do 6 | it 'maxs arrays' do 7 | pp = <<-EOS 8 | $o = max("the","public","art","galleries") 9 | notice(inline_template('max is <%= @o.inspect %>')) 10 | EOS 11 | 12 | apply_manifest(pp, :catch_failures => true) do |r| 13 | expect(r.stdout).to match(/max is "the"/) 14 | end 15 | end 16 | end 17 | describe 'failure' do 18 | it 'handles no arguments' 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/min_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper_acceptance' 3 | 4 | describe 'min function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do 5 | describe 'success' do 6 | it 'mins arrays' do 7 | pp = <<-EOS 8 | $o = min("the","public","art","galleries") 9 | notice(inline_template('min is <%= @o.inspect %>')) 10 | EOS 11 | 12 | apply_manifest(pp, :catch_failures => true) do |r| 13 | expect(r.stdout).to match(/min is "art"/) 14 | end 15 | end 16 | end 17 | describe 'failure' do 18 | it 'handles no arguments' 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/nodesets/centos-59-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | centos-59-x64: 3 | roles: 4 | - master 5 | platform: el-5-x86_64 6 | box : centos-59-x64-vbox4210-nocm 7 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-59-x64-vbox4210-nocm.box 8 | hypervisor : vagrant 9 | CONFIG: 10 | type: git 11 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/nodesets/centos-6-vcloud.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | 'centos-6-vcloud': 3 | roles: 4 | - master 5 | platform: el-6-x86_64 6 | hypervisor: vcloud 7 | template: centos-6-x86_64 8 | CONFIG: 9 | type: foss 10 | ssh: 11 | keys: "~/.ssh/id_rsa-acceptance" 12 | datastore: instance0 13 | folder: Delivery/Quality Assurance/Enterprise/Dynamic 14 | resourcepool: delivery/Quality Assurance/Enterprise/Dynamic 15 | pooling_api: http://vcloud.delivery.puppetlabs.net/ 16 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/nodesets/centos-64-x64-pe.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | centos-64-x64: 3 | roles: 4 | - master 5 | - database 6 | - dashboard 7 | platform: el-6-x86_64 8 | box : centos-64-x64-vbox4210-nocm 9 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box 10 | hypervisor : vagrant 11 | CONFIG: 12 | type: pe 13 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/nodesets/centos-64-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | centos-64-x64: 3 | roles: 4 | - master 5 | platform: el-6-x86_64 6 | box : centos-64-x64-vbox4210-nocm 7 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box 8 | hypervisor : vagrant 9 | CONFIG: 10 | type: foss 11 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/nodesets/centos-65-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | centos-65-x64: 3 | roles: 4 | - master 5 | platform: el-6-x86_64 6 | box : centos-65-x64-vbox436-nocm 7 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box 8 | hypervisor : vagrant 9 | CONFIG: 10 | type: foss 11 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/nodesets/default.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | centos-65-x64: 3 | roles: 4 | - master 5 | platform: el-6-x86_64 6 | box : centos-65-x64-vbox436-nocm 7 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box 8 | hypervisor : vagrant 9 | CONFIG: 10 | type: foss 11 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/nodesets/fedora-18-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | fedora-18-x64: 3 | roles: 4 | - master 5 | platform: fedora-18-x86_64 6 | box : fedora-18-x64-vbox4210-nocm 7 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/fedora-18-x64-vbox4210-nocm.box 8 | hypervisor : vagrant 9 | CONFIG: 10 | type: foss 11 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/nodesets/sles-11-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | sles-11-x64.local: 3 | roles: 4 | - master 5 | platform: sles-11-x64 6 | box : sles-11sp1-x64-vbox4210-nocm 7 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/sles-11sp1-x64-vbox4210-nocm.box 8 | hypervisor : vagrant 9 | CONFIG: 10 | type: foss 11 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | ubuntu-server-10044-x64: 3 | roles: 4 | - master 5 | platform: ubuntu-10.04-amd64 6 | box : ubuntu-server-10044-x64-vbox4210-nocm 7 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-10044-x64-vbox4210-nocm.box 8 | hypervisor : vagrant 9 | CONFIG: 10 | type: foss 11 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | ubuntu-server-12042-x64: 3 | roles: 4 | - master 5 | platform: ubuntu-12.04-amd64 6 | box : ubuntu-server-12042-x64-vbox4210-nocm 7 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box 8 | hypervisor : vagrant 9 | CONFIG: 10 | type: foss 11 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | ubuntu-server-1404-x64: 3 | roles: 4 | - master 5 | platform: ubuntu-14.04-amd64 6 | box : puppetlabs/ubuntu-14.04-64-nocm 7 | box_url : https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm 8 | hypervisor : vagrant 9 | CONFIG: 10 | log_level : debug 11 | type: git 12 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/nodesets/windows-2003-i386.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | ubuntu1204: 3 | roles: 4 | - master 5 | - database 6 | - dashboard 7 | platform: ubuntu-12.04-amd64 8 | template: ubuntu-1204-x86_64 9 | hypervisor: vcloud 10 | win2003_i386: 11 | roles: 12 | - agent 13 | - default 14 | platform: windows-2003-i386 15 | template: win-2003-i386 16 | hypervisor: vcloud 17 | CONFIG: 18 | nfs_server: none 19 | ssh: 20 | keys: "~/.ssh/id_rsa-acceptance" 21 | consoleport: 443 22 | datastore: instance0 23 | folder: Delivery/Quality Assurance/Enterprise/Dynamic 24 | resourcepool: delivery/Quality Assurance/Enterprise/Dynamic 25 | pooling_api: http://vcloud.delivery.puppetlabs.net/ 26 | pe_dir: http://neptune.puppetlabs.lan/3.2/ci-ready/ 27 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/nodesets/windows-2003-x86_64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | ubuntu1204: 3 | roles: 4 | - master 5 | - database 6 | - dashboard 7 | platform: ubuntu-12.04-amd64 8 | template: ubuntu-1204-x86_64 9 | hypervisor: vcloud 10 | win2003_x86_64: 11 | roles: 12 | - agent 13 | - default 14 | platform: windows-2003-x86_64 15 | template: win-2003-x86_64 16 | hypervisor: vcloud 17 | CONFIG: 18 | nfs_server: none 19 | ssh: 20 | keys: "~/.ssh/id_rsa-acceptance" 21 | consoleport: 443 22 | datastore: instance0 23 | folder: Delivery/Quality Assurance/Enterprise/Dynamic 24 | resourcepool: delivery/Quality Assurance/Enterprise/Dynamic 25 | pooling_api: http://vcloud.delivery.puppetlabs.net/ 26 | pe_dir: http://neptune.puppetlabs.lan/3.2/ci-ready/ 27 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/nodesets/windows-2008-x86_64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | ubuntu1204: 3 | roles: 4 | - master 5 | - database 6 | - dashboard 7 | platform: ubuntu-12.04-amd64 8 | template: ubuntu-1204-x86_64 9 | hypervisor: vcloud 10 | win2008_x86_64: 11 | roles: 12 | - agent 13 | - default 14 | platform: windows-2008-x86_64 15 | template: win-2008-x86_64 16 | hypervisor: vcloud 17 | CONFIG: 18 | nfs_server: none 19 | ssh: 20 | keys: "~/.ssh/id_rsa-acceptance" 21 | consoleport: 443 22 | datastore: instance0 23 | folder: Delivery/Quality Assurance/Enterprise/Dynamic 24 | resourcepool: delivery/Quality Assurance/Enterprise/Dynamic 25 | pooling_api: http://vcloud.delivery.puppetlabs.net/ 26 | pe_dir: http://neptune.puppetlabs.lan/3.2/ci-ready/ 27 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/nodesets/windows-2008r2-x86_64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | ubuntu1204: 3 | roles: 4 | - master 5 | - database 6 | - dashboard 7 | platform: ubuntu-12.04-amd64 8 | template: ubuntu-1204-x86_64 9 | hypervisor: vcloud 10 | win2008r2: 11 | roles: 12 | - agent 13 | - default 14 | platform: windows-2008r2-x86_64 15 | template: win-2008r2-x86_64 16 | hypervisor: vcloud 17 | CONFIG: 18 | nfs_server: none 19 | ssh: 20 | keys: "~/.ssh/id_rsa-acceptance" 21 | consoleport: 443 22 | datastore: instance0 23 | folder: Delivery/Quality Assurance/Enterprise/Dynamic 24 | resourcepool: delivery/Quality Assurance/Enterprise/Dynamic 25 | pooling_api: http://vcloud.delivery.puppetlabs.net/ 26 | pe_dir: http://neptune.puppetlabs.lan/3.2/ci-ready/ 27 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/nodesets/windows-2012-x86_64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | ubuntu1204: 3 | roles: 4 | - master 5 | - database 6 | - dashboard 7 | platform: ubuntu-12.04-amd64 8 | template: ubuntu-1204-x86_64 9 | hypervisor: vcloud 10 | win2012: 11 | roles: 12 | - agent 13 | - default 14 | platform: windows-2012-x86_64 15 | template: win-2012-x86_64 16 | hypervisor: vcloud 17 | CONFIG: 18 | nfs_server: none 19 | ssh: 20 | keys: "~/.ssh/id_rsa-acceptance" 21 | consoleport: 443 22 | datastore: instance0 23 | folder: Delivery/Quality Assurance/Enterprise/Dynamic 24 | resourcepool: delivery/Quality Assurance/Enterprise/Dynamic 25 | pooling_api: http://vcloud.delivery.puppetlabs.net/ 26 | pe_dir: http://neptune.puppetlabs.lan/3.2/ci-ready/ 27 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/nodesets/windows-2012r2-x86_64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | ubuntu1204: 3 | roles: 4 | - master 5 | - database 6 | - dashboard 7 | platform: ubuntu-12.04-amd64 8 | template: ubuntu-1204-x86_64 9 | hypervisor: vcloud 10 | win2012r2: 11 | roles: 12 | - agent 13 | - default 14 | platform: windows-2012r2-x86_64 15 | template: win-2012r2-x86_64 16 | hypervisor: vcloud 17 | CONFIG: 18 | nfs_server: none 19 | ssh: 20 | keys: "~/.ssh/id_rsa-acceptance" 21 | consoleport: 443 22 | datastore: instance0 23 | folder: Delivery/Quality Assurance/Enterprise/Dynamic 24 | resourcepool: delivery/Quality Assurance/Enterprise/Dynamic 25 | pooling_api: http://vcloud.delivery.puppetlabs.net/ 26 | pe_dir: http://neptune.puppetlabs.lan/3.2/ci-ready/ 27 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/reverse_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper_acceptance' 3 | 4 | describe 'reverse function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do 5 | describe 'success' do 6 | it 'reverses strings' do 7 | pp = <<-EOS 8 | $a = "the public art galleries" 9 | # Anagram: Large picture halls, I bet 10 | $o = reverse($a) 11 | notice(inline_template('reverse is <%= @o.inspect %>')) 12 | EOS 13 | 14 | apply_manifest(pp, :catch_failures => true) do |r| 15 | expect(r.stdout).to match(/reverse is "seirellag tra cilbup eht"/) 16 | end 17 | end 18 | end 19 | describe 'failure' do 20 | it 'handles no arguments' 21 | it 'handles non strings or arrays' 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/str2saltedsha512_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper_acceptance' 3 | 4 | describe 'str2saltedsha512 function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do 5 | describe 'success' do 6 | it 'works with "y"' do 7 | pp = <<-EOS 8 | $o = str2saltedsha512('password') 9 | notice(inline_template('str2saltedsha512 is <%= @o.inspect %>')) 10 | EOS 11 | 12 | apply_manifest(pp, :catch_failures => true) do |r| 13 | expect(r.stdout).to match(/str2saltedsha512 is "[a-f0-9]{136}"/) 14 | end 15 | end 16 | end 17 | describe 'failure' do 18 | it 'handles no arguments' 19 | it 'handles more than one argument' 20 | it 'handles non strings' 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/strftime_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper_acceptance' 3 | 4 | describe 'strftime function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do 5 | describe 'success' do 6 | it 'gives the Century' do 7 | pp = <<-EOS 8 | $o = strftime('%C') 9 | notice(inline_template('strftime is <%= @o.inspect %>')) 10 | EOS 11 | 12 | apply_manifest(pp, :catch_failures => true) do |r| 13 | expect(r.stdout).to match(/strftime is "20"/) 14 | end 15 | end 16 | it 'takes a timezone argument' 17 | end 18 | describe 'failure' do 19 | it 'handles no arguments' 20 | it 'handles invalid format strings' 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/swapcase_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper_acceptance' 3 | 4 | describe 'swapcase function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do 5 | describe 'success' do 6 | it 'works with strings' do 7 | pp = <<-EOS 8 | $o = swapcase('aBcD') 9 | notice(inline_template('swapcase is <%= @o.inspect %>')) 10 | EOS 11 | 12 | apply_manifest(pp, :catch_failures => true) do |r| 13 | expect(r.stdout).to match(/swapcase is "AbCd"/) 14 | end 15 | end 16 | it 'works with arrays' 17 | end 18 | describe 'failure' do 19 | it 'handles no arguments' 20 | it 'handles non arrays or strings' 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/union_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper_acceptance' 3 | 4 | describe 'union function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do 5 | describe 'success' do 6 | it 'unions arrays' do 7 | pp = <<-EOS 8 | $a = ["the","public"] 9 | $b = ["art","galleries"] 10 | # Anagram: Large picture halls, I bet 11 | $o = union($a,$b) 12 | notice(inline_template('union is <%= @o.inspect %>')) 13 | EOS 14 | 15 | apply_manifest(pp, :catch_failures => true) do |r| 16 | expect(r.stdout).to match(/union is \["the", "public", "art", "galleries"\]/) 17 | end 18 | end 19 | end 20 | describe 'failure' do 21 | it 'handles no arguments' 22 | it 'handles non arrays' 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/unsupported_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper_acceptance' 3 | 4 | describe 'unsupported distributions and OSes', :if => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do 5 | it 'should fail' do 6 | pp = <<-EOS 7 | class { 'mysql::server': } 8 | EOS 9 | expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/unsupported osfamily/i) 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/acceptance/uriescape_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper_acceptance' 3 | 4 | describe 'uriescape function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do 5 | describe 'success' do 6 | it 'uriescape strings' do 7 | pp = <<-EOS 8 | $a = ":/?#[]@!$&'()*+,;= \\\"{}" 9 | $o = uriescape($a) 10 | notice(inline_template('uriescape is <%= @o.inspect %>')) 11 | EOS 12 | 13 | apply_manifest(pp, :catch_failures => true) do |r| 14 | expect(r.stdout).to match(/uriescape is ":\/\?%23\[\]@!\$&'\(\)\*\+,;=%20%22%7B%7D"/) 15 | end 16 | end 17 | it 'does nothing if a string is already safe' 18 | end 19 | describe 'failure' do 20 | it 'handles no arguments' 21 | it 'handles non strings or arrays' 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/classes/anchor_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper' 3 | require 'puppet_spec/compiler' 4 | 5 | describe "anchorrefresh" do 6 | include PuppetSpec::Compiler 7 | 8 | let :transaction do 9 | apply_compiled_manifest(<<-ANCHORCLASS) 10 | class anchored { 11 | anchor { 'anchored::begin': } 12 | ~> anchor { 'anchored::end': } 13 | } 14 | 15 | class anchorrefresh { 16 | notify { 'first': } 17 | ~> class { 'anchored': } 18 | ~> anchor { 'final': } 19 | } 20 | 21 | include anchorrefresh 22 | ANCHORCLASS 23 | end 24 | 25 | it 'propagates events through the anchored class' do 26 | resource = transaction.resource_status('Anchor[final]') 27 | 28 | expect(resource.restarted).to eq(true) 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/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 | expect(Puppet::Parser::Functions.function("abs")).to eq("function_abs") 10 | end 11 | 12 | it "should raise a ParseError if there is less than 1 arguments" do 13 | expect { scope.function_abs([]) }.to( 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 | expect(result).to(eq(34)) 19 | end 20 | 21 | it "should do nothing with a positive number" do 22 | result = scope.function_abs(["5678"]) 23 | expect(result).to(eq(5678)) 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/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 | expect(Puppet::Parser::Functions.function("chomp")).to eq("function_chomp") 9 | end 10 | 11 | it "should raise a ParseError if there is less than 1 arguments" do 12 | expect { scope.function_chomp([]) }.to( 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 | expect(result).to(eq("abc")) 18 | end 19 | 20 | it "should accept objects which extend String" do 21 | class AlsoString < String 22 | end 23 | 24 | value = AlsoString.new("abc\n") 25 | result = scope.function_chomp([value]) 26 | result.should(eq("abc")) 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/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 | expect(Puppet::Parser::Functions.function("chop")).to eq("function_chop") 9 | end 10 | 11 | it "should raise a ParseError if there is less than 1 arguments" do 12 | expect { scope.function_chop([]) }.to( 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 | expect(result).to(eq("asdf")) 18 | end 19 | 20 | it "should accept objects which extend String" do 21 | class AlsoString < String 22 | end 23 | 24 | value = AlsoString.new("abc\n") 25 | result = scope.function_chop([value]) 26 | result.should(eq('abc')) 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/functions/difference_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper' 3 | 4 | describe "the difference function" do 5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope } 6 | 7 | it "should exist" do 8 | expect(Puppet::Parser::Functions.function("difference")).to eq("function_difference") 9 | end 10 | 11 | it "should raise a ParseError if there are fewer than 2 arguments" do 12 | expect { scope.function_difference([]) }.to( raise_error(Puppet::ParseError) ) 13 | end 14 | 15 | it "should return the difference between two arrays" do 16 | result = scope.function_difference([["a","b","c"],["b","c","d"]]) 17 | expect(result).to(eq(["a"])) 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/functions/dirname_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper' 3 | 4 | describe "the dirname function" do 5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope } 6 | 7 | it "should exist" do 8 | expect(Puppet::Parser::Functions.function("dirname")).to eq("function_dirname") 9 | end 10 | 11 | it "should raise a ParseError if there is less than 1 arguments" do 12 | expect { scope.function_dirname([]) }.to( raise_error(Puppet::ParseError)) 13 | end 14 | 15 | it "should return dirname for an absolute path" do 16 | result = scope.function_dirname(['/path/to/a/file.ext']) 17 | expect(result).to(eq('/path/to/a')) 18 | end 19 | 20 | it "should return dirname for a relative path" do 21 | result = scope.function_dirname(['path/to/a/file.ext']) 22 | expect(result).to(eq('path/to/a')) 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/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 | expect(Puppet::Parser::Functions.function("grep")).to eq("function_grep") 9 | end 10 | 11 | it "should raise a ParseError if there is less than 1 arguments" do 12 | expect { scope.function_grep([]) }.to( 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 | expect(result).to(eq(["aaabbb","bbbccc"])) 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/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 | expect(Puppet::Parser::Functions.function("hash")).to eq("function_hash") 9 | end 10 | 11 | it "should raise a ParseError if there is less than 1 arguments" do 12 | expect { scope.function_hash([]) }.to( 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 | expect(result).to(eq({'a'=>1,'b'=>2,'c'=>3})) 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/functions/intersection_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper' 3 | 4 | describe "the intersection function" do 5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope } 6 | 7 | it "should exist" do 8 | expect(Puppet::Parser::Functions.function("intersection")).to eq("function_intersection") 9 | end 10 | 11 | it "should raise a ParseError if there are fewer than 2 arguments" do 12 | expect { scope.function_intersection([]) }.to( raise_error(Puppet::ParseError) ) 13 | end 14 | 15 | it "should return the intersection of two arrays" do 16 | result = scope.function_intersection([["a","b","c"],["b","c","d"]]) 17 | expect(result).to(eq(["b","c"])) 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/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 | expect(Puppet::Parser::Functions.function("join")).to eq("function_join") 9 | end 10 | 11 | it "should raise a ParseError if there is less than 1 arguments" do 12 | expect { scope.function_join([]) }.to( 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 | expect(result).to(eq("a:b:c")) 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/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 | expect(Puppet::Parser::Functions.function("keys")).to eq("function_keys") 9 | end 10 | 11 | it "should raise a ParseError if there is less than 1 arguments" do 12 | expect { scope.function_keys([]) }.to( 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 | expect(result).to match_array(['a','b']) 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/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 | expect(Puppet::Parser::Functions.function("parsejson")).to eq("function_parsejson") 9 | end 10 | 11 | it "should raise a ParseError if there is less than 1 arguments" do 12 | expect { scope.function_parsejson([]) }.to( 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 | expect(result).to(eq(['aaa','bbb','ccc'])) 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/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 | expect(Puppet::Parser::Functions.function("parseyaml")).to eq("function_parseyaml") 9 | end 10 | 11 | it "should raise a ParseError if there is less than 1 arguments" do 12 | expect { scope.function_parseyaml([]) }.to( 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 | expect(result).to(eq(['aaa','bbb','ccc'])) 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/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 | expect(Puppet::Parser::Functions.function("reject")).to eq("function_reject") 10 | end 11 | 12 | it "should raise a ParseError if there is less than 1 arguments" do 13 | expect { scope.function_reject([]) }.to( 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 | expect(result).to(eq(["1111", "dddeee"])) 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/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 | expect(Puppet::Parser::Functions.function("size")).to eq("function_size") 9 | end 10 | 11 | it "should raise a ParseError if there is less than 1 arguments" do 12 | expect { scope.function_size([]) }.to( raise_error(Puppet::ParseError)) 13 | end 14 | 15 | it "should return the size of a string" do 16 | result = scope.function_size(["asdf"]) 17 | expect(result).to(eq(4)) 18 | end 19 | 20 | it "should return the size of an array" do 21 | result = scope.function_size([["a","b","c"]]) 22 | expect(result).to(eq(3)) 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/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 | expect(Puppet::Parser::Functions.function("sort")).to eq("function_sort") 9 | end 10 | 11 | it "should raise a ParseError if there is not 1 arguments" do 12 | expect { scope.function_sort(['','']) }.to( raise_error(Puppet::ParseError)) 13 | end 14 | 15 | it "should sort an array" do 16 | result = scope.function_sort([["a","c","b"]]) 17 | expect(result).to(eq(['a','b','c'])) 18 | end 19 | 20 | it "should sort a string" do 21 | result = scope.function_sort(["acb"]) 22 | expect(result).to(eq('abc')) 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/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 | expect(Puppet::Parser::Functions.function("squeeze")).to eq("function_squeeze") 9 | end 10 | 11 | it "should raise a ParseError if there is less than 2 arguments" do 12 | expect { scope.function_squeeze([]) }.to( raise_error(Puppet::ParseError)) 13 | end 14 | 15 | it "should squeeze a string" do 16 | result = scope.function_squeeze(["aaabbbbcccc"]) 17 | expect(result).to(eq('abc')) 18 | end 19 | 20 | it "should squeeze all elements in an array" do 21 | result = scope.function_squeeze([["aaabbbbcccc","dddfff"]]) 22 | expect(result).to(eq(['abc','df'])) 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/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 | expect(Puppet::Parser::Functions.function("strip")).to eq("function_strip") 8 | end 9 | 10 | it "should raise a ParseError if there is less than 1 arguments" do 11 | expect { scope.function_strip([]) }.to( raise_error(Puppet::ParseError)) 12 | end 13 | 14 | it "should strip a string" do 15 | result = scope.function_strip([" ab cd "]) 16 | expect(result).to(eq('ab cd')) 17 | end 18 | 19 | it "should accept objects which extend String" do 20 | class AlsoString < String 21 | end 22 | 23 | value = AlsoString.new(' as df ') 24 | result = scope.function_strip([value]) 25 | result.should(eq('as df')) 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/functions/union_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper' 3 | 4 | describe "the union function" do 5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope } 6 | 7 | it "should exist" do 8 | expect(Puppet::Parser::Functions.function("union")).to eq("function_union") 9 | end 10 | 11 | it "should raise a ParseError if there are fewer than 2 arguments" do 12 | expect { scope.function_union([]) }.to( raise_error(Puppet::ParseError) ) 13 | end 14 | 15 | it "should join two arrays together" do 16 | result = scope.function_union([["a","b","c"],["b","c","d"]]) 17 | expect(result).to(eq(["a","b","c","d"])) 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/lib/puppet_spec/modules.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | module PuppetSpec::Modules 3 | class << self 4 | def create(name, dir, options = {}) 5 | module_dir = File.join(dir, name) 6 | FileUtils.mkdir_p(module_dir) 7 | 8 | environment = options[:environment] 9 | 10 | if metadata = options[:metadata] 11 | metadata[:source] ||= 'github' 12 | metadata[:author] ||= 'puppetlabs' 13 | metadata[:version] ||= '9.9.9' 14 | metadata[:license] ||= 'to kill' 15 | metadata[:dependencies] ||= [] 16 | 17 | metadata[:name] = "#{metadata[:author]}/#{name}" 18 | 19 | File.open(File.join(module_dir, 'metadata.json'), 'w') do |f| 20 | f.write(metadata.to_pson) 21 | end 22 | end 23 | 24 | Puppet::Module.new(name, module_dir, environment) 25 | end 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/lib/puppet_spec/pops.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | module PuppetSpec::Pops 3 | extend RSpec::Matchers::DSL 4 | 5 | # Checks if an Acceptor has a specific issue in its list of diagnostics 6 | matcher :have_issue do |expected| 7 | match do |actual| 8 | actual.diagnostics.index { |i| i.issue == expected } != nil 9 | end 10 | failure_message_for_should do |actual| 11 | "expected Acceptor[#{actual.diagnostics.collect { |i| i.issue.issue_code }.join(',')}] to contain issue #{expected.issue_code}" 12 | end 13 | failure_message_for_should_not do |actual| 14 | "expected Acceptor[#{actual.diagnostics.collect { |i| i.issue.issue_code }.join(',')}] to not contain issue #{expected.issue_code}" 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/lib/puppet_spec/scope.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | 3 | module PuppetSpec::Scope 4 | # Initialize a new scope suitable for testing. 5 | # 6 | def create_test_scope_for_node(node_name) 7 | node = Puppet::Node.new(node_name) 8 | compiler = Puppet::Parser::Compiler.new(node) 9 | scope = Puppet::Parser::Scope.new(compiler) 10 | scope.source = Puppet::Resource::Type.new(:node, node_name) 11 | scope.parent = compiler.topscope 12 | scope 13 | end 14 | 15 | end -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/lib/puppet_spec/verbose.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | # Support code for running stuff with warnings disabled. 3 | module Kernel 4 | def with_verbose_disabled 5 | verbose, $VERBOSE = $VERBOSE, nil 6 | result = yield 7 | $VERBOSE = verbose 8 | return result 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/monkey_patches/alias_should_to_must.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'rspec' 3 | 4 | class Object 5 | # This is necessary because the RAL has a 'should' 6 | # method. 7 | alias :must :should 8 | alias :must_not :should_not 9 | end 10 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/monkey_patches/publicize_methods.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | # Some monkey-patching to allow us to test private methods. 3 | class Class 4 | def publicize_methods(*methods) 5 | saved_private_instance_methods = methods.empty? ? self.private_instance_methods : methods 6 | 7 | self.class_eval { public(*saved_private_instance_methods) } 8 | yield 9 | self.class_eval { private(*saved_private_instance_methods) } 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/spec.opts: -------------------------------------------------------------------------------- 1 | --format 2 | s 3 | --colour 4 | --loadby 5 | mtime 6 | --backtrace 7 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/unit/puppet/parser/functions/camelcase_spec.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -S rspec 2 | require 'spec_helper' 3 | 4 | describe "the camelcase function" do 5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope } 6 | 7 | it "should exist" do 8 | expect(Puppet::Parser::Functions.function("camelcase")).to eq("function_camelcase") 9 | end 10 | 11 | it "should raise a ParseError if there is less than 1 arguments" do 12 | expect { scope.function_camelcase([]) }.to( raise_error(Puppet::ParseError)) 13 | end 14 | 15 | it "should capitalize the beginning of a normal string" do 16 | result = scope.function_camelcase(["abc"]) 17 | expect(result).to(eq("Abc")) 18 | end 19 | 20 | it "should camelcase an underscore-delimited string" do 21 | result = scope.function_camelcase(["aa_bb_cc"]) 22 | expect(result).to(eq("AaBbCc")) 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/spec/unit/puppet/type/anchor_spec.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require 'spec_helper' 4 | 5 | anchor = Puppet::Type.type(:anchor).new(:name => "ntp::begin") 6 | 7 | describe anchor do 8 | it "should stringify normally" do 9 | expect(anchor.to_s).to eq("Anchor[ntp::begin]") 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/tests/file_line.pp: -------------------------------------------------------------------------------- 1 | # This is a simple smoke test 2 | # of the file_line resource type. 3 | file { '/tmp/dansfile': 4 | ensure => present 5 | }-> 6 | file_line { 'dans_line': 7 | line => 'dan is awesome', 8 | path => '/tmp/dansfile', 9 | } 10 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/tests/has_interface_with.pp: -------------------------------------------------------------------------------- 1 | include stdlib 2 | info('has_interface_with(\'lo\'):', has_interface_with('lo')) 3 | info('has_interface_with(\'loX\'):', has_interface_with('loX')) 4 | info('has_interface_with(\'ipaddress\', \'127.0.0.1\'):', has_interface_with('ipaddress', '127.0.0.1')) 5 | info('has_interface_with(\'ipaddress\', \'127.0.0.100\'):', has_interface_with('ipaddress', '127.0.0.100')) 6 | info('has_interface_with(\'network\', \'127.0.0.0\'):', has_interface_with('network', '127.0.0.0')) 7 | info('has_interface_with(\'network\', \'128.0.0.0\'):', has_interface_with('network', '128.0.0.0')) 8 | info('has_interface_with(\'netmask\', \'255.0.0.0\'):', has_interface_with('netmask', '255.0.0.0')) 9 | info('has_interface_with(\'netmask\', \'256.0.0.0\'):', has_interface_with('netmask', '256.0.0.0')) 10 | 11 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/tests/has_ip_address.pp: -------------------------------------------------------------------------------- 1 | include stdlib 2 | info('has_ip_address(\'192.168.1.256\'):', has_ip_address('192.168.1.256')) 3 | info('has_ip_address(\'127.0.0.1\'):', has_ip_address('127.0.0.1')) 4 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/tests/has_ip_network.pp: -------------------------------------------------------------------------------- 1 | include stdlib 2 | info('has_ip_network(\'127.0.0.0\'):', has_ip_network('127.0.0.0')) 3 | info('has_ip_network(\'128.0.0.0\'):', has_ip_network('128.0.0.0')) 4 | 5 | -------------------------------------------------------------------------------- /puppet/modules/stdlib/tests/init.pp: -------------------------------------------------------------------------------- 1 | include stdlib 2 | -------------------------------------------------------------------------------- /puppet/modules/wp/Modulefile: -------------------------------------------------------------------------------- 1 | name 'rmccue-wp' 2 | version '1.0.1' 3 | author 'Ryan McCue' 4 | license 'MIT License' 5 | summary 'Manage your WordPress installations with wp-cli' 6 | description 'This module manages your WordPress sites using wp-cli, allowing you 7 | to install your site, manage plugins, and update options.' 8 | project_page 'https://github.com/rmccue/puppet-wp' 9 | -------------------------------------------------------------------------------- /puppet/modules/wp/manifests/command.pp: -------------------------------------------------------------------------------- 1 | define wp::command ( 2 | $location, 3 | $command 4 | ) { 5 | include wp::cli 6 | 7 | exec {"$location wp $command": 8 | command => "/usr/bin/wp $command", 9 | cwd => $location, 10 | user => $::wp::user, 11 | require => [ Class['wp::cli'] ], 12 | onlyif => '/usr/bin/wp core is-installed' 13 | } 14 | } -------------------------------------------------------------------------------- /puppet/modules/wp/manifests/init.pp: -------------------------------------------------------------------------------- 1 | class wp ( 2 | $user = $::wp::params::user, 3 | ) inherits wp::params { 4 | # ... 5 | } -------------------------------------------------------------------------------- /puppet/modules/wp/manifests/option.pp: -------------------------------------------------------------------------------- 1 | define wp::option ( 2 | $location, 3 | $key = $title, 4 | $value = undef, 5 | $ensure = present 6 | ) { 7 | case $ensure { 8 | present: { 9 | $command = "get $key" 10 | } 11 | equal: { 12 | if $value == undef { 13 | fail('Option value must be specified') 14 | } 15 | $command = "update $key $value" 16 | } 17 | absent: { 18 | $command = "delete $key" 19 | } 20 | default: { 21 | fail('Invalid option operation') 22 | } 23 | } 24 | 25 | wp::command { "$location option $command": 26 | location => $location, 27 | command => "option $command" 28 | } 29 | } -------------------------------------------------------------------------------- /puppet/modules/wp/manifests/params.pp: -------------------------------------------------------------------------------- 1 | class wp::params { 2 | $user = 'www-data' 3 | } -------------------------------------------------------------------------------- /puppet/modules/wp/manifests/rewrite.pp: -------------------------------------------------------------------------------- 1 | define wp::rewrite ( 2 | $location, 3 | $structure = $title 4 | ) { 5 | include wp::cli 6 | 7 | wp::command { "$location rewrite structure '$structure'": 8 | location => $location, 9 | command => "rewrite structure '$structure'" 10 | } 11 | } -------------------------------------------------------------------------------- /puppet/modules/wp/manifests/theme.pp: -------------------------------------------------------------------------------- 1 | define wp::theme ( 2 | $location, 3 | $ensure = enabled 4 | ) { 5 | #$name = $title, 6 | include wp::cli 7 | 8 | case $ensure { 9 | enabled: { 10 | $command = "activate $title" 11 | } 12 | default: { 13 | fail("Invalid ensure for wp::theme") 14 | } 15 | } 16 | wp::command { "$location theme $command": 17 | location => $location, 18 | command => "theme $command" 19 | } 20 | } --------------------------------------------------------------------------------