diff --git a/CHANGELOG.md b/CHANGELOG.md index a4767bf..d0cddf6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,17 @@ in 1.x versions. To get the diff for a specific change, go to https://github.com/joomlatools/joomla-vagrant/commit/xxx where xxx is the change hash. To view the diff between two versions, go to https://github.com/joomlatools/joomla-vagrant/compare/v1.0.0...v1.0.1 +* 1.3.1 (2015-09-03) + * Added - Support for PHP7 + * Added - Support for [joomla-platform](https://github.com/joomlatools/joomla-platform) installations + * Added - Installed git-ftp + * Added - `box server:restart` command + * Improved - Use the async option when mounting NFS on Linux + * Improved - Link to both site and administrator in dashboard listing + * Fixed - Allow value _0_ to be written to PHP ini using `box php:ini` + * Fixed - Use bison 2.4 when building PHP 5.4.19+ + * Fixed - Point to global apc-dashboard.php file in `/apc` alias + * 1.3.0 (2015-06-01) * Improved - Upgraded default PHP to 5.5 * Improved - Upgraded OS and stack: Ubuntu 14.04, Apache 2.4, Puppet 3.4, Ruby 2.2 diff --git a/README.md b/README.md index b6e8340..63e7723 100644 --- a/README.md +++ b/README.md @@ -38,9 +38,9 @@ Getting started 1. Once you have installed the box as described above, SSH into the box: - ``` + ``` vagrant ssh -``` + ``` 1. Create your first Joomla website with this command: @@ -52,6 +52,18 @@ joomla site:create mysite 1. You can now symlink and install your custom extensions into the site, manage PHP versions and much more. Head over to our [documentation pages](http://developer.joomlatools.com/tools/vagrant/introduction.html) to learn more about the box and its possibilities. +Sharing access to the box +------------------------- + +One of the great features of Vagrant is [Vagrant Share](https://docs.vagrantup.com/v2/share/index.html). Please note that Vagrant Share requires an account with [HashiCorp's Atlas](https://atlas.hashicorp.com/). + +To share access, run this command and follow the instructions: + +``` +vagrant share --http 80 +``` + +For more options please refer to the [Vagrant docs](https://docs.vagrantup.com/v2/share/index.html). For hacking on the box ---------------------- @@ -84,6 +96,55 @@ vagrant up vagrant provision ``` +Building and releasing using Packer +----------------------------------- + +We use [Packer](https://www.packer.io/) to automatically build and deploy the box on [Atlas](https://atlas.hashicorp.com/joomlatools/box). To launch a build, follow these steps: + +1. Clone this repository: + + ``` +git clone https://github.com/joomlatools/joomla-vagrant.git + ``` + +1. Install [Packer](https://www.packer.io/) +1. Generate a new token for your [Atlas account](https://atlas.hashicorp.com/settings/tokens). +1. Make the token available to Packer in the current terminal session: + + ``` +export ATLAS_TOKEN= + ``` + +1. Now edit the `packer.json` file. Look for the current version and increase the version number. +The version number is defined in the post-processor section and can be found at the bottom of the file. It looks like this: + + ```js +"post-processors": [ + ... + { + "type": "atlas", + ... + "metadata": { + "provider": "virtualbox", + "version": "1.3.0" + } + }] +] + ``` + + If you are not updating the `joomlatools/box` but want to create your own version, be sure to replace all occurences of `joomlatools/box` with your account and box name in the `packer.json` file. + + *Note* A build cannot overwrite an existing version. If you want to replace an existing version, you will have to delete it on Atlas first! + +1. Commit the change and push back to GitHub. +1. Instruct packer to start the build: + + ``` +packer push packer.json + ``` + +You can follow-up the build progress on the [Builds](https://atlas.hashicorp.com/builds) page. Once it's finished, the new version will be automatically available on the [your boxes](https://atlas.hashicorp.com/vagrant) section. Add a changelog and release it to the public. + Reporting issues ---------------- diff --git a/Vagrantfile b/Vagrantfile index bf08aeb..dba18b3 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -41,7 +41,7 @@ Vagrant.configure("2") do |config| if CONF.has_key?('synced_folders') CONF['synced_folders'].each { |target, source| if source - config.vm.synced_folder source, target, :nfs => CONF['nfs'], :create => true + config.vm.synced_folder source, target, :nfs => CONF['nfs'], :linux__nfs_options => ['rw', 'no_subtree_check', 'all_squash','async'], :create => true end } diff --git a/Vagrantfile.pkg b/Vagrantfile.pkg index ec51e1c..dfeea10 100644 --- a/Vagrantfile.pkg +++ b/Vagrantfile.pkg @@ -37,7 +37,7 @@ Vagrant.configure("2") do |config| if CONF.has_key?('synced_folders') CONF['synced_folders'].each { |target, source| if source - config.vm.synced_folder source, target, :nfs => CONF['nfs'], :create => true + config.vm.synced_folder source, target, :nfs => CONF['nfs'], :linux__nfs_options => ['rw', 'no_subtree_check', 'all_squash','async'], :create => true end } diff --git a/packer.json b/packer.json index 94e928f..eb6e9b7 100644 --- a/packer.json +++ b/packer.json @@ -34,9 +34,9 @@ "disk_size": 8000, "guest_os_type": "Ubuntu_64", "http_directory": "packer/http", - "iso_checksum": "83aabd8dcf1e8f469f3c72fff2375195", + "iso_checksum": "9e5fecc94b3925bededed0fdca1bd417", "iso_checksum_type": "md5", - "iso_url": "http://releases.ubuntu.com/14.04/ubuntu-14.04.2-server-amd64.iso", + "iso_url": "http://releases.ubuntu.com/14.04/ubuntu-14.04.3-server-amd64.iso", "ssh_username": "vagrant", "ssh_password": "vagrant", "ssh_port": 22, @@ -90,7 +90,7 @@ "artifact_type": "vagrant.box", "metadata": { "provider": "virtualbox", - "version": "1.3.0" + "version": "1.3.1" } }] ] diff --git a/puppet/manifests/default.pp b/puppet/manifests/default.pp index 7c24edc..603a425 100644 --- a/puppet/manifests/default.pp +++ b/puppet/manifests/default.pp @@ -19,6 +19,8 @@ require => Apt::Key['4F4EA0AAE5267A6C'] } +apt::ppa { 'ppa:resmo/git-ftp': } + include '::gnupg' gnupg_key { 'gpg-rvm-signature': ensure => present, @@ -40,7 +42,7 @@ 'git-core', 'unzip' ]: - ensure => 'installed', + ensure => 'installed' } class apache::certificate { @@ -332,4 +334,13 @@ class { 'phpmetrics': require => [Class['composer'], Class['scripts']] +} + +package { 'git-ftp': + require => Apt::Ppa['ppa:resmo/git-ftp'] +} + +swap_file::files { 'default': + ensure => present, + swapfilesize => '512 MB' } \ No newline at end of file diff --git a/puppet/modules/apache/templates/custom.conf.erb b/puppet/modules/apache/templates/custom.conf.erb index a0a9599..4d3b338 100644 --- a/puppet/modules/apache/templates/custom.conf.erb +++ b/puppet/modules/apache/templates/custom.conf.erb @@ -1 +1,5 @@ EnableSendfile Off + + + AllowOverride All + \ No newline at end of file diff --git a/puppet/modules/apache/templates/virtualhost/joomlatools.vhost.conf.erb b/puppet/modules/apache/templates/virtualhost/joomlatools.vhost.conf.erb index 286556a..07b22ed 100644 --- a/puppet/modules/apache/templates/virtualhost/joomlatools.vhost.conf.erb +++ b/puppet/modules/apache/templates/virtualhost/joomlatools.vhost.conf.erb @@ -24,7 +24,7 @@ ErrorLog <%= scope.lookupvar('apache::log_dir') %>/<%= @name %>-error_log CustomLog <%= scope.lookupvar('apache::log_dir') %>/<%= @name %>-access_log combined - Alias /apc /home/vagrant/scripts/apc.php + Alias /apc /home/vagrant/scripts/apc-dashboard.php Alias /phpinfo /home/vagrant/scripts/phpinfo.php Alias /dashboard /home/vagrant/scripts/dashboard diff --git a/puppet/modules/box/files/scripts/Command/Php/Ini.php b/puppet/modules/box/files/scripts/Command/Php/Ini.php index da60b7b..a61c3a5 100644 --- a/puppet/modules/box/files/scripts/Command/Php/Ini.php +++ b/puppet/modules/box/files/scripts/Command/Php/Ini.php @@ -4,6 +4,7 @@ use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class Ini extends Command @@ -14,12 +15,16 @@ protected function configure() ->setDescription('Get or set PHP config directive for the currently active PHP version') ->addArgument( 'key', - InputArgument::REQUIRED, - 'Name of the directive' + InputArgument::OPTIONAL, + 'Name of the directive to lookup or update' )->addArgument( 'value', InputArgument::OPTIONAL, - 'Value to set' + 'New value' + )->addOption( + 'list-files', + 'l', + InputOption::VALUE_NONE ); } @@ -28,6 +33,14 @@ protected function execute(InputInterface $input, OutputInterface $output) $key = $input->getArgument('key'); $value = $input->getArgument('value'); + if ($input->getOPtion('list-files') || empty($key)) { + $this->_listIniFiles(); + } + + if (empty($key)) { + return; + } + $current = $this->_getConfigValue($key); if ($current === false) @@ -37,6 +50,10 @@ protected function execute(InputInterface $input, OutputInterface $output) return; } + if (empty($current)) { + $current = 'no value (0 or empty string)'; + } + if (!is_null($value)) { $ini = $this->_getIniOverride(); @@ -51,7 +68,7 @@ protected function execute(InputInterface $input, OutputInterface $output) } else $output->write('Error: failed to find PHP\'s additional config directory (config-file-scan-dir)!'); } - else $output->writeln($current); + else $output->writeln("$key value is $current"); } protected function _getConfigValue($key) @@ -85,6 +102,22 @@ protected function _getIniOverride() return false; } + protected function _listIniFiles() + { + $filelist = `php -r 'echo php_ini_scanned_files();'`; + + if (strpos($filelist, ',')) + { + $files = explode(',', $filelist); + + foreach ($files as $file) { + echo trim($file) . PHP_EOL; + } + } + + return false; + } + protected function _updateIni($ini, $key, $value) { $values = parse_ini_file($ini); @@ -93,7 +126,7 @@ protected function _updateIni($ini, $key, $value) $string = ''; foreach($values as $k => $v) { - if (!empty($v)) { + if (!empty($v) || $v === '0') { $string .= "$k = $v" . PHP_EOL; } } diff --git a/puppet/modules/box/files/scripts/Command/Server/Restart.php b/puppet/modules/box/files/scripts/Command/Server/Restart.php new file mode 100644 index 0000000..7a1862a --- /dev/null +++ b/puppet/modules/box/files/scripts/Command/Server/Restart.php @@ -0,0 +1,24 @@ +setName('server:restart') + ->setDescription('Restart Apache and MySQL'); + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + `sudo service apache2 restart 2>&1 1> /dev/null`; + `sudo service mysql restart 2>&1 1> /dev/null`; + + $output->writeln("Server has been restarted"); + } +} \ No newline at end of file diff --git a/puppet/modules/box/files/scripts/Command/Server/Stop.php b/puppet/modules/box/files/scripts/Command/Server/Stop.php index 8916dd1..39f09f2 100644 --- a/puppet/modules/box/files/scripts/Command/Server/Stop.php +++ b/puppet/modules/box/files/scripts/Command/Server/Stop.php @@ -11,23 +11,14 @@ class Stop extends Command protected function configure() { $this->setName('server:stop') - ->setDescription('Stop Apache and MySQL') - ->addOption( - 'restart', - null, - InputOption::VALUE_NONE, - "Restart the services instead of stopping them." - ); + ->setDescription('Stop Apache and MySQL'); } protected function execute(InputInterface $input, OutputInterface $output) { - $task = $input->getOption('restart') ? 'restart' : 'stop'; - $txt = $task == 'stop' ? 'stopped' : 'restarted'; + `sudo service apache2 stop 2>&1 1> /dev/null`; + `sudo service mysql stop 2>&1 1> /dev/null`; - `sudo service apache2 $task 2>&1 1> /dev/null`; - `sudo service mysql $task 2>&1 1> /dev/null`; - - $output->writeln("Server has been $txt"); + $output->writeln("Server has been stopped"); } } \ No newline at end of file diff --git a/puppet/modules/box/files/scripts/box b/puppet/modules/box/files/scripts/box index 511f594..d92e8a7 100755 --- a/puppet/modules/box/files/scripts/box +++ b/puppet/modules/box/files/scripts/box @@ -31,6 +31,7 @@ $application->add(new Command\Apc\Clear()); $application->add(new Command\Xdebug\Enable()); $application->add(new Command\Xdebug\Disable()); +$application->add(new Command\Server\Restart()); $application->add(new Command\Server\Start()); $application->add(new Command\Server\Stop()); diff --git a/puppet/modules/phpmanager/files/scripts/phpmanager b/puppet/modules/phpmanager/files/scripts/phpmanager index 6d6d27a..bd76473 100755 --- a/puppet/modules/phpmanager/files/scripts/phpmanager +++ b/puppet/modules/phpmanager/files/scripts/phpmanager @@ -142,10 +142,30 @@ command_use() { sudo cp "/usr/lib/apache2/modules/libphp5.so" "/usr/lib/apache2/modules/libphp5.so.original" fi - sudo cp "/opt/php/${VERSION}/lib/apache/libphp5.so" "/usr/lib/apache2/modules/libphp5.so" + SHORT=$(sub_getshortversion $VERSION) + if [[ "$SHORT" -lt 7000 ]] ; then + LIBNAME="libphp5.so" + DELNAME="libphp7.so" + + sudo a2dismod php7 &> /dev/null + sudo a2enmod php5 &> /dev/null + else + LIBNAME="libphp7.so" + DELNAME="libphp5.so" + + if [[ ! -f "/etc/apache2/mods-available/php7.conf" ]] ; then + sudo cp /etc/apache2/mods-available/php5.conf /etc/apache2/mods-available/php7.conf + fi + + sudo a2dismod php5 &> /dev/null + sudo a2enmod php7 &> /dev/null + fi + + [[ -f "/usr/lib/apache2/modules/${DELNAME}" ]] && sudo rm "/usr/lib/apache2/modules/${DELNAME}" + sudo cp "/opt/php/${VERSION}/lib/apache/${LIBNAME}" "/usr/lib/apache2/modules/${LIBNAME}" echo -n "Restarting Apache .. " - sudo /etc/init.d/apache2 restart &> /dev/null + sudo service apache2 restart &> /dev/null if [ $? -ne 0 ] ; then echo -e "\033[31mFAILED\e[0m" @@ -230,8 +250,14 @@ command_install() { # Start the build sub_execute "make" "make" "$LOGFILE" "Building ${VERSION}" - # Backup the libphp5.so file as "make install" will overwrite it automatically - sudo mv /usr/lib/apache2/modules/libphp5.so /usr/lib/apache2/modules/libphp5.so.bak + if [[ "$SHORT" -lt 7000 ]] ; then + LIBNAME="libphp5.so" + else + LIBNAME="libphp7.so" + fi + + # Backup the libphpX.so files as "make install" will overwrite them automatically + [[ -f "/usr/lib/apache2/modules/${LIBNAME}" ]] && sudo mv "/usr/lib/apache2/modules/${LIBNAME}" "/usr/lib/apache2/modules/${LIBNAME}.bak" # Install the new binaries and module sub_execute "sudo make install" "install" "$LOGFILE" "Installing ${VERSION}" @@ -251,32 +277,36 @@ command_install() { sudo /opt/php/${VERSION}/bin/pecl channel-update pecl.php.net # Build Xdebug - sub_xdebug "$VERSION" "$LOGFILE" + if [[ "$SHORT" -lt 7000 ]] ; then + sub_xdebug "$VERSION" "$LOGFILE" + fi # Build APC or APCu+Opcache - if [[ "$SHORT" -lt 5500 ]] ; then - sub_apc "$VERSION" "$LOGFILE" - else - sub_apcu "$VERSION" "$LOGFILE" + if [[ "$SHORT" -lt 7000 ]] ; then + if [[ "$SHORT" -lt 5500 ]] ; then + sub_apc "$VERSION" "$LOGFILE" + else + sub_apcu "$VERSION" "$LOGFILE" + fi fi - # Store our newly built Apache module and put the original libphp5.so module back - if [[ -f "${SOURCE}/.libs/libphp5.so" ]] ; then - sudo cp "${SOURCE}/.libs/libphp5.so" "/opt/php/${VERSION}/lib/apache/libphp5.so" - elif [[ -f /usr/lib/apache2/modules/libphp5.so ]] ; then - sudo mv "/usr/lib/apache2/modules/libphp5.so" "/opt/php/${VERSION}/lib/apache/libphp5.so" + # Store our newly built Apache module and put the original libphpX.so module back + if [[ -f "${SOURCE}/.libs/${LIBNAME}" ]] ; then + sudo cp "${SOURCE}/.libs/${LIBNAME}" "/opt/php/${VERSION}/lib/apache/${LIBNAME}" + elif [[ -f "/usr/lib/apache2/modules/${LIBNAME}" ]] ; then + sudo mv "/usr/lib/apache2/modules/${LIBNAME}" "/opt/php/${VERSION}/lib/apache/${LIBNAME}" else - [[ -f /usr/lib/apache2/modules/libphp5.so ]] && sudo rm /usr/lib/apache2/modules/libphp5.so - sudo mv /usr/lib/apache2/modules/libphp5.so.bak /usr/lib/apache2/modules/libphp5.so + [[ -f /usr/lib/apache2/modules/${LIBNAME} ]] && sudo rm "/usr/lib/apache2/modules/${LIBNAME}" + sudo mv "/usr/lib/apache2/modules/${LIBNAME}.bak" "/usr/lib/apache2/modules/${LIBNAME}" - echo -e "\033[31mERROR: Failed to build libphp5.so!\e[0m" + echo -e "\033[31mERROR: Failed to build ${LIBNAME}!\e[0m" echo "See ${LOGFILE} for more details or try again." exit 1 fi # Put the original apache module back in place - [[ -f /usr/lib/apache2/modules/libphp5.so ]] && sudo rm /usr/lib/apache2/modules/libphp5.so - sudo mv /usr/lib/apache2/modules/libphp5.so.bak /usr/lib/apache2/modules/libphp5.so + [[ -f "/usr/lib/apache2/modules/${LIBNAME}" ]] && sudo rm "/usr/lib/apache2/modules/${LIBNAME}" + [[ -f "/usr/lib/apache2/modules/${LIBNAME}.bak" ]] && sudo mv "/usr/lib/apache2/modules/${LIBNAME}.bak" "/usr/lib/apache2/modules/${LIBNAME}" echo -e "\n${VERSION} has been built and can be found at /opt/php/${VERSION} -- happy coding!" @@ -311,10 +341,16 @@ command_restore() { sudo rm "/usr/lib/apache2/modules/libphp5.so" fi + if [ -f "/usr/lib/apache2/modules/libphp7.so" ] ; then + sudo a2dismod php7 &> /dev/null + sudo rm "/usr/lib/apache2/modules/libphp7.so" + fi + sudo cp "/usr/lib/apache2/modules/libphp5.so.original" "/usr/lib/apache2/modules/libphp5.so" echo -n "Restarting Apache .. " - sudo /etc/init.d/apache2 restart &> /dev/null + sudo a2enmod php5 &> /dev/null + sudo service apache2 restart &> /dev/null if [ $? -ne 0 ] ; then echo -e "\033[31mFAILED\e[0m" @@ -609,7 +645,7 @@ sub_getversions() { eval "$(git for-each-ref --shell --format='TAGS+=(%(refname))' refs/tags/)" for TAG in "${TAGS[@]}"; do # Only list PHP versions greater than or equal to 5.2 - PATTERN="refs/tags/php-[5-9]\.[2-9]" + PATTERN="refs/tags/php-([5-9]\.[2-9]+|7\.[0-9]+)" if [[ $TAG =~ $PATTERN ]] ; then AVAILABLE_PHP_VERSIONS+=(${TAG/refs\/tags\//}) fi; @@ -620,7 +656,7 @@ sub_getversions() { $(for el in "${AVAILABLE_PHP_VERSIONS[@]}" do echo "$el" - done | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n + done | sort --version-sort ) ) @@ -731,7 +767,7 @@ sub_getbuilds() { INSTALLED_PHP_VERSIONS=() for ITEM in "${LIST[@]}"; do - PATTERN="(master|php-[5-9]\.[2-9])" + PATTERN="(master|php-[5-9])" if [[ "$ITEM" =~ $PATTERN ]] ; then PHP=$(basename "$ITEM") PHP="${PHP[@]/php-/}" @@ -744,7 +780,7 @@ sub_getbuilds() { sub_getcurrent() { BIN=$(readlink -f /usr/bin/php) - REGEX="/opt/php/(master|php-[0-9\.]+)/bin/php" + REGEX="/opt/php/(master|php-[0-9a-zA-Z\.]+)/bin/php" if [[ $BIN =~ $REGEX ]]; then CURRENT_PHP_VERSION="${BASH_REMATCH[1]}"; CURRENT_PHP_VERSION="${CURRENT_PHP_VERSION[@]/php-/}" diff --git a/puppet/modules/phpmanager/manifests/init.pp b/puppet/modules/phpmanager/manifests/init.pp index b45408e..6f005a3 100644 --- a/puppet/modules/phpmanager/manifests/init.pp +++ b/puppet/modules/phpmanager/manifests/init.pp @@ -66,8 +66,8 @@ } class phpmanager::buildtools { - package { ['autoconf2.13', 're2c', 'apache2-prefork-dev', 'bison', 'g++-4.4', 'gcc-4.4']: ensure => 'installed' } - package { ['libcurl4-openssl-dev', 'libmysqlclient-dev', 'libmcrypt-dev', 'libbz2-dev', 'libjpeg-dev', 'libpng12-dev', 'libfreetype6-dev', 'libicu-dev', 'libxml2-dev', 'libxslt-dev', 'libssl-dev']: ensure => 'installed' } + package { ['autoconf2.13', 're2c', 'apache2-dev', 'bison', 'g++-4.4', 'gcc-4.4']: ensure => 'installed' } + package { ['libcurl4-openssl-dev', 'libmysqlclient-dev', 'libmcrypt-dev', 'libbz2-dev', 'libjpeg-dev', 'libpng12-dev', 'libfreetype6-dev', 'libicu-dev', 'libxml2-dev', 'libxslt1-dev', 'libssl-dev']: ensure => 'installed' } puppi::netinstall { 'bison-2.2': url => 'http://ftp.gnu.org/gnu/bison/bison-2.2.tar.gz', diff --git a/puppet/modules/scripts/files/scripts/dashboard/index.php b/puppet/modules/scripts/files/scripts/dashboard/index.php index 6f6b530..058db38 100644 --- a/puppet/modules/scripts/files/scripts/dashboard/index.php +++ b/puppet/modules/scripts/files/scripts/dashboard/index.php @@ -1,5 +1,6 @@ isDir() && !$fileinfo->isDot()) - { - $code = $fileinfo->getPathname() . '/libraries/cms/version/version.php'; + $code = $application = null; - if (file_exists($code)) + if ($fileinfo->isDir() && !$fileinfo->isDot()) { - $identifier = uniqid(); + $files = array( + 'joomla-cms' => $fileinfo->getPathname() . '/libraries/cms/version/version.php', + 'joomla-platform' => $fileinfo->getPathname() . '/lib/libraries/cms/version/version.php', + 'joomla-1.5' => $fileinfo->getPathname() . '/libraries/joomla/version.php' + ); - $source = file_get_contents($code); - $source = preg_replace('/<\?php/', '', $source, 1); - $source = preg_replace('/class JVersion/i', 'class JVersion' . $identifier, $source); + foreach ($files as $type => $file) + { + if (file_exists($file)) + { + $code = $file; + $application = $type; - eval($source); + break; + } + } - $class = 'JVersion'.$identifier; - $version = new $class(); - $sites[$fileinfo->getFilename()] = (object) array('version' => $version->RELEASE.'.'.$version->DEV_LEVEL); + if (!is_null($code) && file_exists($code)) + { + $identifier = uniqid(); + + $source = file_get_contents($code); + $source = preg_replace('/<\?php/', '', $source, 1); + $source = preg_replace('/class JVersion/i', 'class JVersion' . $identifier, $source); + + eval($source); + + $class = 'JVersion'.$identifier; + $version = new $class(); + $sites[] = (object) array( + 'name' => $fileinfo->getFilename(), + 'docroot' => $fileinfo->getFilename() . '/' . ($application == 'joomla-platform' ? 'web' : ''), + 'type' => $application, + 'version' => $version->RELEASE.'.'.$version->DEV_LEVEL + ); + } } - } } ?> @@ -100,7 +123,6 @@
-

To install new sites, check out the documentation on Github.

@@ -113,30 +135,22 @@ $info): ?> + foreach ($sites as $site): ?> diff --git a/puppet/modules/swap_file/.fixtures.yml b/puppet/modules/swap_file/.fixtures.yml new file mode 100755 index 0000000..0c5eebb --- /dev/null +++ b/puppet/modules/swap_file/.fixtures.yml @@ -0,0 +1,5 @@ +fixtures: + repositories: + stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib.git" + symlinks: + swap_file: "#{source_dir}" diff --git a/puppet/modules/swap_file/.gitignore b/puppet/modules/swap_file/.gitignore new file mode 100755 index 0000000..e2df2e4 --- /dev/null +++ b/puppet/modules/swap_file/.gitignore @@ -0,0 +1,5 @@ +.*.sw? +pkg +spec/fixtures +.rspec_system +.vagrant/ \ No newline at end of file diff --git a/puppet/modules/swap_file/.rspec b/puppet/modules/swap_file/.rspec new file mode 100755 index 0000000..8c18f1a --- /dev/null +++ b/puppet/modules/swap_file/.rspec @@ -0,0 +1,2 @@ +--format documentation +--color diff --git a/puppet/modules/swap_file/.travis.yml b/puppet/modules/swap_file/.travis.yml new file mode 100755 index 0000000..60e9f7e --- /dev/null +++ b/puppet/modules/swap_file/.travis.yml @@ -0,0 +1,15 @@ +--- +language: ruby +bundler_args: --without system_tests development +script: "bundle exec rake validate && bundle exec rake lint && bundle exec rake spec SPEC_OPTS='--format documentation'" +rvm: + - 1.9.3 + - 2.0.0 +matrix: + exclude: + - rvm: 2.0.0 + env: PUPPET_VERSION="~> 2.7.0" + - rvm: 2.0.0 + env: PUPPET_VERSION="~> 3.1.0" + - rvm: 1.9.3 + env: PUPPET_VERSION="~> 2.7.0" \ No newline at end of file diff --git a/puppet/modules/swap_file/CHANGELOG.md b/puppet/modules/swap_file/CHANGELOG.md new file mode 100755 index 0000000..90c1b09 --- /dev/null +++ b/puppet/modules/swap_file/CHANGELOG.md @@ -0,0 +1,27 @@ +## Change Log + +## 2015-03-17 - Release 1.1.1 +### Summary + +- Update README +- Update to Beaker specs + +## 2015-03-17 - Release 1.1.0 +### Summary + +- Adds swap_file::files defined type +- Deprecate use of class to create swap files + +## 2015-01-01 - Release 1.0.1 +### Summary + +- Minor fix to liscense rule (https://docs.puppetlabs.com/puppet/latest/reference/modules_publishing.html#fields-in-metadatajson) + +## 2014-08-24 - Release 1.0.0 +### Summary + +#### Features +- No real functionality changes, just tweaks for approval release + +#### Bugfixes +- n/a \ No newline at end of file diff --git a/puppet/modules/swap_file/CONTRIBUTING.md b/puppet/modules/swap_file/CONTRIBUTING.md new file mode 100755 index 0000000..41f4e0a --- /dev/null +++ b/puppet/modules/swap_file/CONTRIBUTING.md @@ -0,0 +1,83 @@ +This module has grown over time based on a range of contributions from +people using it. If you follow these contributing guidelines your patch +will likely make it into a release a little quicker. + + +## Contributing + +1. Fork the repo. + +2. Run the tests. We only take pull requests with passing tests, and + it's great to know that you have a clean slate + +3. Add a test for your change. Only refactoring and documentation + changes require no new tests. If you are adding functionality + or fixing a bug, please add a test. + +4. Make the test pass. + +5. Push to your fork and submit a pull request. + + +## Dependencies + +The testing and development tools have a bunch of dependencies, +all managed by [bundler](http://bundler.io/) according to the +[Puppet support matrix](http://docs.puppetlabs.com/guides/platforms.html#ruby-versions). + +By default the tests use a baseline version of Puppet. + +If you have Ruby 2.x or want a specific version of Puppet, +you must set an environment variable such as: + + export PUPPET_VERSION="~> 3.2.0" + +Install the dependencies like so... + + bundle install + +## Syntax and style + +The test suite will run [Puppet Lint](http://puppet-lint.com/) and +[Puppet Syntax](https://github.com/gds-operations/puppet-syntax) to +check various syntax and style things. You can run these locally with: + + bundle exec rake lint + bundle exec rake syntax + +## Running the unit tests + +The unit test suite covers most of the code, as mentioned above please +add tests if you're adding new functionality. If you've not used +[rspec-puppet](http://rspec-puppet.com/) before then feel free to ask +about how best to test your new feature. Running the test suite is done +with: + + bundle exec rake spec + +Note also you can run the syntax, style and unit tests in one go with: + + bundle exec rake test + +## Integration tests + +The unit tests just check the code runs, not that it does exactly what +we want on a real machine. For that we're using +[beaker](https://github.com/puppetlabs/beaker). + +This fires up a new virtual machine (using vagrant) and runs a series of +simple tests against it after applying the module. You can run this +with: + + bundle exec rake acceptance + +This will run the tests on an Ubuntu 12.04 virtual machine. You can also +run the integration tests against Centos 6.5 with. + + RS_SET=centos-64-x64 bundle exec rake acceptances + +If you don't want to have to recreate the virtual machine every time you +can use `RS_DESTROY=no` and `RS_PROVISION=no`. On the first run you will +at least need `RS_PROVISION` set to yes (the default). The Vagrantfile +for the created virtual machines will be in `.vagrant/beaker_vagrant_fies`. + diff --git a/puppet/modules/swap_file/CONTRIBUTORS b/puppet/modules/swap_file/CONTRIBUTORS new file mode 100755 index 0000000..c704572 --- /dev/null +++ b/puppet/modules/swap_file/CONTRIBUTORS @@ -0,0 +1,2 @@ +Peter Souter (@petems) +Matt Dainty (@bodgit) \ No newline at end of file diff --git a/puppet/modules/swap_file/Gemfile b/puppet/modules/swap_file/Gemfile new file mode 100755 index 0000000..7445244 --- /dev/null +++ b/puppet/modules/swap_file/Gemfile @@ -0,0 +1,25 @@ +source 'http://rubygems.org' + +group :test do + gem 'rake' + gem 'puppet', ENV['PUPPET_VERSION'] || '~> 3.4.0' + gem 'puppet-lint' + gem 'rspec-puppet', :git => 'https://github.com/rodjek/rspec-puppet.git' + gem 'puppet-syntax' + gem 'puppetlabs_spec_helper' + gem 'simplecov' + gem 'metadata-json-lint' +end + +group :development do + gem 'travis' + gem 'travis-lint' + gem 'puppet-blacksmith' + gem 'guard-rake' + gem 'puppet-module' +end + +group :system_tests do + gem 'beaker' + gem 'beaker-rspec' +end \ No newline at end of file diff --git a/puppet/modules/swap_file/Gemfile.lock b/puppet/modules/swap_file/Gemfile.lock new file mode 100755 index 0000000..d515400 --- /dev/null +++ b/puppet/modules/swap_file/Gemfile.lock @@ -0,0 +1,345 @@ +GIT + remote: https://github.com/rodjek/rspec-puppet.git + revision: a9a837669cf6955279f02d1d9b524dc140b9d3e8 + specs: + rspec-puppet (2.0.1) + rspec + +GEM + remote: http://rubygems.org/ + specs: + CFPropertyList (2.3.0) + activesupport (4.2.0) + i18n (~> 0.7) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) + addressable (2.3.7) + autoparse (0.3.3) + addressable (>= 2.3.1) + extlib (>= 0.9.15) + multi_json (>= 1.0.0) + aws-sdk (1.63.0) + aws-sdk-v1 (= 1.63.0) + aws-sdk-v1 (1.63.0) + json (~> 1.4) + nokogiri (>= 1.4.4) + backports (3.6.4) + beaker (2.6.0) + aws-sdk (~> 1.57) + docker-api + fission (~> 0.4) + fog (~> 1.25) + google-api-client (~> 0.8) + hocon (~> 0.0.4) + inifile (~> 2.0) + json (~> 1.8) + minitest (~> 5.4) + net-scp (~> 1.2) + net-ssh (~> 2.9) + rbvmomi (~> 1.8) + rsync (~> 1.0.9) + unf (~> 0.1) + beaker-rspec (5.0.1) + beaker (~> 2.0) + rspec + serverspec (~> 2) + specinfra (~> 2) + builder (3.2.2) + celluloid (0.16.0) + timers (~> 4.0.0) + coderay (1.1.0) + diff-lcs (1.2.5) + docile (1.1.5) + docker-api (1.20.0) + excon (>= 0.38.0) + json + ethon (0.7.3) + ffi (>= 1.3.0) + excon (0.44.4) + extlib (0.9.16) + facter (1.7.6) + faraday (0.9.1) + multipart-post (>= 1.2, < 3) + faraday_middleware (0.9.1) + faraday (>= 0.7.4, < 0.10) + ffi (1.9.8) + fission (0.5.0) + CFPropertyList (~> 2.2) + fog (1.28.0) + fog-atmos + fog-aws (~> 0.0) + fog-brightbox (~> 0.4) + fog-core (~> 1.27, >= 1.27.3) + fog-ecloud + fog-json + fog-profitbricks + fog-radosgw (>= 0.0.2) + fog-riakcs + fog-sakuracloud (>= 0.0.4) + fog-serverlove + fog-softlayer + fog-storm_on_demand + fog-terremark + fog-vmfusion + fog-voxel + fog-xml (~> 0.1.1) + ipaddress (~> 0.5) + nokogiri (~> 1.5, >= 1.5.11) + fog-atmos (0.1.0) + fog-core + fog-xml + fog-aws (0.1.1) + fog-core (~> 1.27) + fog-json (~> 1.0) + fog-xml (~> 0.1) + ipaddress (~> 0.8) + fog-brightbox (0.7.1) + fog-core (~> 1.22) + fog-json + inflecto (~> 0.0.2) + fog-core (1.29.0) + builder + excon (~> 0.38) + formatador (~> 0.2) + mime-types + net-scp (~> 1.1) + net-ssh (>= 2.1.3) + fog-ecloud (0.0.2) + fog-core + fog-xml + fog-json (1.0.0) + multi_json (~> 1.0) + fog-profitbricks (0.0.1) + fog-core + fog-xml + nokogiri + fog-radosgw (0.0.3) + fog-core (>= 1.21.0) + fog-json + fog-xml (>= 0.0.1) + fog-riakcs (0.1.0) + fog-core + fog-json + fog-xml + fog-sakuracloud (1.0.0) + fog-core + fog-json + fog-serverlove (0.1.1) + fog-core + fog-json + fog-softlayer (0.4.1) + fog-core + fog-json + fog-storm_on_demand (0.1.0) + fog-core + fog-json + fog-terremark (0.0.4) + fog-core + fog-xml + fog-vmfusion (0.0.1) + fission + fog-core + fog-voxel (0.0.2) + fog-core + fog-xml + fog-xml (0.1.1) + fog-core + nokogiri (~> 1.5, >= 1.5.11) + formatador (0.2.5) + gh (0.14.0) + addressable + backports + faraday (~> 0.8) + multi_json (~> 1.0) + net-http-persistent (>= 2.7) + net-http-pipeline + google-api-client (0.8.2) + activesupport (>= 3.2) + addressable (~> 2.3) + autoparse (~> 0.3) + extlib (~> 0.9) + faraday (~> 0.9) + launchy (~> 2.4) + multi_json (~> 1.10) + retriable (~> 1.4) + signet (~> 0.6) + guard (2.12.5) + formatador (>= 0.2.4) + listen (~> 2.7) + lumberjack (~> 1.0) + nenv (~> 0.1) + notiffany (~> 0.0) + pry (>= 0.9.12) + shellany (~> 0.0) + thor (>= 0.18.1) + guard-rake (1.0.0) + guard + rake + hiera (1.3.4) + json_pure + highline (1.7.1) + hitimes (1.2.2) + hocon (0.0.7) + i18n (0.7.0) + inflecto (0.0.2) + inifile (2.0.2) + ipaddress (0.8.0) + json (1.8.2) + json_pure (1.8.2) + jwt (1.4.1) + launchy (2.4.3) + addressable (~> 2.3) + listen (2.9.0) + celluloid (>= 0.15.2) + rb-fsevent (>= 0.9.3) + rb-inotify (>= 0.9) + lumberjack (1.0.9) + metaclass (0.0.4) + metadata-json-lint (0.0.6) + json + spdx-licenses (~> 1.0) + method_source (0.8.2) + mime-types (2.4.3) + mini_portile (0.6.2) + minitest (5.5.1) + mocha (1.1.0) + metaclass (~> 0.0.1) + multi_json (1.11.0) + multipart-post (2.0.0) + nenv (0.2.0) + net-http-persistent (2.9.4) + net-http-pipeline (1.0.1) + net-scp (1.2.1) + net-ssh (>= 2.6.5) + net-ssh (2.9.2) + netrc (0.10.3) + nokogiri (1.6.6.2) + mini_portile (~> 0.6.0) + notiffany (0.0.6) + nenv (~> 0.1) + shellany (~> 0.0) + pry (0.9.12.6) + coderay (~> 1.0) + method_source (~> 0.8) + slop (~> 3.4) + puppet (3.4.3) + facter (~> 1.6) + hiera (~> 1.0) + rgen (~> 0.6.5) + puppet-blacksmith (3.2.0) + puppet (>= 2.7.16) + rest-client + puppet-lint (1.1.0) + puppet-module (0.3.4) + puppet-syntax (2.0.0) + rake + puppetlabs_spec_helper (0.10.0) + mocha + puppet-lint + puppet-syntax + rake + rspec-puppet + pusher-client (0.6.0) + json + websocket (~> 1.0) + rake (10.4.2) + rb-fsevent (0.9.4) + rb-inotify (0.9.5) + ffi (>= 0.5.0) + rbvmomi (1.8.2) + builder + nokogiri (>= 1.4.1) + trollop + rest-client (1.7.3) + mime-types (>= 1.16, < 3.0) + netrc (~> 0.7) + retriable (1.4.1) + rgen (0.6.6) + rspec (3.2.0) + rspec-core (~> 3.2.0) + rspec-expectations (~> 3.2.0) + rspec-mocks (~> 3.2.0) + rspec-core (3.2.2) + rspec-support (~> 3.2.0) + rspec-expectations (3.2.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.2.0) + rspec-its (1.2.0) + rspec-core (>= 3.0.0) + rspec-expectations (>= 3.0.0) + rspec-mocks (3.2.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.2.0) + rspec-support (3.2.2) + rsync (1.0.9) + serverspec (2.10.1) + multi_json + rspec (~> 3.0) + rspec-its + specinfra (~> 2.15) + shellany (0.0.1) + signet (0.6.0) + addressable (~> 2.3) + extlib (~> 0.9) + faraday (~> 0.9) + jwt (~> 1.0) + multi_json (~> 1.10) + simplecov (0.9.2) + docile (~> 1.1.0) + multi_json (~> 1.0) + simplecov-html (~> 0.9.0) + simplecov-html (0.9.0) + slop (3.6.0) + spdx-licenses (1.0.0) + json + specinfra (2.19.4) + net-scp + net-ssh + thor (0.19.1) + thread_safe (0.3.5) + timers (4.0.1) + hitimes + travis (1.7.5) + addressable (~> 2.3) + backports + faraday (~> 0.9) + faraday_middleware (~> 0.9, >= 0.9.1) + gh (~> 0.13) + highline (~> 1.6) + launchy (~> 2.1) + pry (~> 0.9, < 0.10) + pusher-client (~> 0.4) + typhoeus (~> 0.6, >= 0.6.8) + travis-lint (2.0.0) + json + trollop (2.1.2) + typhoeus (0.7.1) + ethon (>= 0.7.1) + tzinfo (1.2.2) + thread_safe (~> 0.1) + unf (0.1.4) + unf_ext + unf_ext (0.0.6) + websocket (1.2.1) + +PLATFORMS + ruby + +DEPENDENCIES + beaker + beaker-rspec + guard-rake + metadata-json-lint + puppet (~> 3.4.0) + puppet-blacksmith + puppet-lint + puppet-module + puppet-syntax + puppetlabs_spec_helper + rake + rspec-puppet! + simplecov + travis + travis-lint diff --git a/puppet/modules/swap_file/Guardfile b/puppet/modules/swap_file/Guardfile new file mode 100755 index 0000000..fd50602 --- /dev/null +++ b/puppet/modules/swap_file/Guardfile @@ -0,0 +1,5 @@ +notification :off + +guard 'rake', :task => 'test' do + watch(%r{^manifests\/(.+)\.pp$}) +end diff --git a/puppet/modules/swap_file/LICENSE b/puppet/modules/swap_file/LICENSE new file mode 100755 index 0000000..9f71055 --- /dev/null +++ b/puppet/modules/swap_file/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + diff --git a/puppet/modules/swap_file/README.markdown b/puppet/modules/swap_file/README.markdown new file mode 100755 index 0000000..6439775 --- /dev/null +++ b/puppet/modules/swap_file/README.markdown @@ -0,0 +1,79 @@ +####Table of Contents + +1. [Overview](#overview) +2. [Module Description ](#module-description) +3. [Setup](#setup) + * [What swap_file affects](#what-swap_file-affects) +4. [Usage](#usage) +5. [Limitations](#limitations) +6. [Development](#development) + +##Overview + +Manage [swap files](http://en.wikipedia.org/wiki/Paging) for your Linux environments. This is based on the gist by @Yggdrasil, with a few changes and added specs. + +##Setup + +###What swap_file affects + +* Creating files from the path given using `/bin/dd` +* Swapfiles on the system +* Any mounts of swapfiles + +##Usage + +The simplest use of the module is this: + +```puppet +swap_file::files { 'default': + ensure => present, +} +``` + +By default, the module it will: + +* create a file using /bin/dd atr `/mnt/swap.1` with the default size taken from the `$::memorysizeinbytes` +* A `mount` for the swapfile created + +For a custom setup, you can do something like this: + +```puppet +swap_file::files { 'tmp file swap': + ensure => present, + swapfile => '/tmp/swapfile', + mount => false, +} +``` + +To remove a prexisting swap, you can use ensure absent: + +```puppet +swap_file::files { 'tmp file swap': + ensure => absent, +} +``` + +## Previous to 1.0.1 Release + +Previously you would create swapfiles with the `swap_file` class: + +``` +class { 'swap_file': + swapfile => '/mount/swapfile', + swapfilesize => '100 MB', +} +``` + +However, this had many problems, such as not being able to declare more than one swap_file because of duplicate class errors. + +This is now deprecated and will give a warning. + +##Limitations + +Primary support is for Debian and RedHat, but should work on all Linux flavours. + +Right now there is no BSD support, but I'm planning on adding it in the future + +##Development + +Follow the CONTRIBUTING guidelines! :) diff --git a/puppet/modules/swap_file/Rakefile b/puppet/modules/swap_file/Rakefile new file mode 100755 index 0000000..1f6c81f --- /dev/null +++ b/puppet/modules/swap_file/Rakefile @@ -0,0 +1,39 @@ +require 'puppetlabs_spec_helper/rake_tasks' +require 'puppet-lint/tasks/puppet-lint' +require 'puppet-syntax/tasks/puppet-syntax' + +# These two gems aren't always present, for instance +# on Travis with --without development +begin + require 'puppet_blacksmith/rake_tasks' +rescue LoadError +end + +PuppetLint.configuration.fail_on_warnings +PuppetLint.configuration.send('relative') +PuppetLint.configuration.send('disable_80chars') +PuppetLint.configuration.send('disable_class_inherits_from_params_class') +PuppetLint.configuration.send('disable_class_parameter_defaults') +PuppetLint.configuration.send('disable_documentation') +PuppetLint.configuration.send('disable_single_quote_string_with_variables') +PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"] + +exclude_paths = [ + "pkg/**/*", + "vendor/**/*", + "spec/**/*", +] +PuppetLint.configuration.ignore_paths = exclude_paths +PuppetSyntax.exclude_paths = exclude_paths + +desc "Run acceptance tests" +RSpec::Core::RakeTask.new(:acceptance) do |t| + t.pattern = 'spec/acceptance' +end + +desc "Run syntax, lint, and spec tests." +task :test => [ + :syntax, + :lint, + :spec, +] \ No newline at end of file diff --git a/puppet/modules/swap_file/manifests/files.pp b/puppet/modules/swap_file/manifests/files.pp new file mode 100755 index 0000000..30024e9 --- /dev/null +++ b/puppet/modules/swap_file/manifests/files.pp @@ -0,0 +1,88 @@ +# Define: swap_file::files +# +# This is a defined type to create a swap_file +# +# == Parameters +# [*ensure*] +# Allows creation or removal of swapspace and the corresponding file. +# [*swapfile*] +# Location of swapfile, defaults to /mnt +# [*swapfilesize*] +# Size of the swapfile as a string (eg. 10 MB, 1.2 GB). +# Defaults to $::memorysize fact on the node +# [*add_mount*] +# Add a mount to the swapfile so it persists on boot +# [*options*] +# Mount options for the swapfile +# +# == Examples +# +# swap_file::files { 'default': +# ensure => present, +# swapfile => '/mnt/swap.55', +# } +# +# +# == Authors +# @petems - Peter Souter +# +define swap_file::files ( + $ensure = 'present', + $swapfile = '/mnt/swap.1', + $swapfilesize = $::memorysize, + $add_mount = true, + $options = 'defaults' +) +{ + # Parameter validation + validate_re($ensure, ['^absent$', '^present$'], "Invalid ensure: ${ensure} - (Must be 'present' or 'absent')") + validate_string($swapfile) + $swapfilesize_mb = to_bytes($swapfilesize) / 1000000 + validate_bool($add_mount) + + if $ensure == 'present' { + exec { "Create swap file ${swapfile}": + command => "/bin/dd if=/dev/zero of=${swapfile} bs=1M count=${swapfilesize_mb}", + creates => $swapfile, + } + file { $swapfile: + owner => root, + group => root, + mode => '0600', + require => Exec["Create swap file ${swapfile}"], + } + exec { "Attach swap file ${swapfile}": + command => "/sbin/mkswap ${swapfile} && /sbin/swapon ${swapfile}", + require => File[$swapfile], + unless => "/sbin/swapon -s | grep ${swapfile}", + } + if $add_mount { + mount { $swapfile: + ensure => present, + fstype => swap, + device => $swapfile, + options => $options, + dump => 0, + pass => 0, + require => Exec["Attach swap file ${swapfile}"], + } + } + } + elsif $ensure == 'absent' { + exec { 'Detach swap file ${swapfile}': + command => "/sbin/swapoff ${swapfile}", + onlyif => "/sbin/swapon -s | grep ${swapfile}", + } + file { $swapfile: + ensure => absent, + backup => false, + require => Exec["Detach swap file ${swapfile}"], + } + mount { $swapfile: + ensure => absent, + device => $swapfile, + } + } + + +} \ No newline at end of file diff --git a/puppet/modules/swap_file/manifests/init.pp b/puppet/modules/swap_file/manifests/init.pp new file mode 100755 index 0000000..a8943a8 --- /dev/null +++ b/puppet/modules/swap_file/manifests/init.pp @@ -0,0 +1,68 @@ +# Class: swap_file +# +# This class creates a swapspace on a node. +# +# Using this class is now deprecated, use the swap_file::files defined type +# +# == Parameters +# [*ensure*] +# Allows creation or removal of swapspace and the corresponding file. +# [*swapfile*] +# Location of swapfile, defaults to /mnt +# [*swapfilesize*] +# Size of the swapfile as a string (eg. 10 MB, 1.2 GB). +# Defaults to $::memorysize fact on the node +# [*add_mount*] +# Add a mount to the swapfile so it persists on boot +# [*options*] +# Mount options for the swapfile +# +# == Examples +# +# include swap_file +# +# class { 'swap_file': +# ensure => present, +# } +# +# class { 'swap_file': +# swapfile => '/mount/swapfile', +# swapfilesize => '100 MB', +# } +# +# == Authors +# @petems - Peter Souter +# @Yggdrasil +# +class swap_file ( + $ensure = 'present', + $swapfile = '/mnt/swap.1', + $swapfilesize = $::memorysize, + $add_mount = true, + $options = 'defaults' +) inherits swap_file::params { + + # Parameter validation + validate_re($ensure, ['^absent$', '^present$'], "Invalid ensure: ${ensure} - (Must be 'present' or 'absent')") + validate_string($swapfile) + $swapfilesize_mb = to_bytes($swapfilesize) / 1000000 + validate_bool($add_mount) + + warning('Use of swap_file class is now deprecated') + warning('Use the swap_file::files defined type (Or downgrade the swap_file module to 1.0.1') + + if $ensure == 'present' { + ::swap_file::files{ $swapfile: + ensure => 'present', + swapfile => $swapfile, + swapfilesize => $swapfilesize, + add_mount => $add_mount, + options => $options, + } + } + elsif $ensure == 'absent' { + ::swap_file::files{ $swapfile: + ensure => 'absent', + } + } +} diff --git a/puppet/modules/swap_file/manifests/params.pp b/puppet/modules/swap_file/manifests/params.pp new file mode 100755 index 0000000..5d696d3 --- /dev/null +++ b/puppet/modules/swap_file/manifests/params.pp @@ -0,0 +1,24 @@ +# == Class swap_file::params +# +# This class is meant to be called from swap_file +# It sets variables according to platform +# +class swap_file::params { + case $::osfamily { + 'Debian': { + + } + 'RedHat': { + + } + 'windows': { + fail('Swap files dont work on windows') + } + 'FreeBSD': { + fail('FreeBSD is not yet supported (See https://github.com/petems/puppet-swap_file/issues/9)') + } + default: { + warning("${::operatingsystem} not officially supported, but should work") + } + } +} diff --git a/puppet/modules/swap_file/metadata.json b/puppet/modules/swap_file/metadata.json new file mode 100755 index 0000000..e399dd9 --- /dev/null +++ b/puppet/modules/swap_file/metadata.json @@ -0,0 +1,59 @@ +{ + "name": "petems-swap_file", + "version": "1.1.1", + "author": "Peter Souter", + "summary": "Create swap files for Linux systems with Puppet", + "license": "Apache-2.0", + "source": "https://github.com/petems/puppet-swap_file", + "project_page": "https://github.com/petems/puppet-swap_file", + "issues_url": "https://github.com/petems/puppet-swap_file/issues", + "operatingsystem_support": [ + { + "operatingsystem": "RedHat", + "operatingsystemrelease": [ + "5", + "6", + "7" + ] + }, + { + "operatingsystem": "CentOS", + "operatingsystemrelease": [ + "5", + "6", + "7" + ] + }, + { + "operatingsystem": "Debian", + "operatingsystemrelease": [ + "6", + "7" + ] + }, + { + "operatingsystem": "Ubuntu", + "operatingsystemrelease": [ + "10.04", + "12.04", + "14.04" + ] + } + ], + "requirements": [ + { + "name": "pe", + "version_requirement": ">= 3.2.0 < 3.4.0" + }, + { + "name": "puppet", + "version_requirement": "3.x" + } + ], + "dependencies": [ + { + "name": "puppetlabs/stdlib", + "version_requirement": ">= 3.2.0" + } + ] +} \ No newline at end of file diff --git a/puppet/modules/swap_file/spec/acceptance/class_spec.rb b/puppet/modules/swap_file/spec/acceptance/class_spec.rb new file mode 100755 index 0000000..b4ae0dd --- /dev/null +++ b/puppet/modules/swap_file/spec/acceptance/class_spec.rb @@ -0,0 +1,45 @@ +require 'spec_helper_acceptance' + +describe 'swap_file class', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do + + context 'swap_file' do + context 'ensure => present' do + it 'should work with no errors' do + pp = <<-EOS + class { 'swap_file': } + EOS + + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) + end + it 'should contain the default swapfile' do + shell('/sbin/swapon -s | grep /mnt/swap.1', :acceptable_exit_codes => [0]) + end + it 'should contain the default fstab setting' do + shell('cat /etc/fstab | grep /mnt/swap.1', :acceptable_exit_codes => [0]) + shell('cat /etc/fstab | grep defaults', :acceptable_exit_codes => [0]) + end + end + context 'custom parameters' do + it 'should work with no errors' do + pp = <<-EOS + class { 'swap_file': + swapfile => '/tmp/swapfile', + swapfilesize => '5 MB', + } + EOS + + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) + end + it 'should contain the given swapfile' do + shell('/sbin/swapon -s | grep /tmp/swapfile', :acceptable_exit_codes => [0]) + shell('/sbin/swapon -s | grep 5116', :acceptable_exit_codes => [0]) + end + it 'should contain the default fstab setting' do + shell('cat /etc/fstab | grep /tmp/swapfile', :acceptable_exit_codes => [0]) + shell('cat /etc/fstab | grep defaults', :acceptable_exit_codes => [0]) + end + end + end +end \ No newline at end of file diff --git a/puppet/modules/swap_file/spec/acceptance/nodesets/centos-64-x64.yml b/puppet/modules/swap_file/spec/acceptance/nodesets/centos-64-x64.yml new file mode 100755 index 0000000..fb933cd --- /dev/null +++ b/puppet/modules/swap_file/spec/acceptance/nodesets/centos-64-x64.yml @@ -0,0 +1,11 @@ +HOSTS: + centos-64-x64: + roles: + - master + platform: el-6-x86_64 + box: centos-64-x64-vbox4210-nocm + box_url: http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box + hypervisor: vagrant +CONFIG: + log_level: verbose + type: foss diff --git a/puppet/modules/swap_file/spec/acceptance/nodesets/default.yml b/puppet/modules/swap_file/spec/acceptance/nodesets/default.yml new file mode 100755 index 0000000..901bb92 --- /dev/null +++ b/puppet/modules/swap_file/spec/acceptance/nodesets/default.yml @@ -0,0 +1,11 @@ +HOSTS: + ubuntu-server-12042-x64: + roles: + - master + platform: ubuntu-12.04-amd64 + box: ubuntu-server-12042-x64-vbox4210-nocm + box_url: http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box + hypervisor: vagrant +CONFIG: + log_level: verbose + type: foss diff --git a/puppet/modules/swap_file/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml b/puppet/modules/swap_file/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml new file mode 100755 index 0000000..901bb92 --- /dev/null +++ b/puppet/modules/swap_file/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml @@ -0,0 +1,11 @@ +HOSTS: + ubuntu-server-12042-x64: + roles: + - master + platform: ubuntu-12.04-amd64 + box: ubuntu-server-12042-x64-vbox4210-nocm + box_url: http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box + hypervisor: vagrant +CONFIG: + log_level: verbose + type: foss diff --git a/puppet/modules/swap_file/spec/acceptance/swap_file_files_spec.rb b/puppet/modules/swap_file/spec/acceptance/swap_file_files_spec.rb new file mode 100755 index 0000000..b5d7449 --- /dev/null +++ b/puppet/modules/swap_file/spec/acceptance/swap_file_files_spec.rb @@ -0,0 +1,73 @@ +require 'spec_helper_acceptance' + +describe 'swap_file class', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do + + context 'swap_file' do + context 'ensure => present' do + it 'should work with no errors' do + pp = <<-EOS + swap_file::files { 'default': + ensure => present, + } + EOS + + # Run it twice and test for idempotency + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) + end + it 'should contain the default swapfile' do + shell('/sbin/swapon -s | grep /mnt/swap.1', :acceptable_exit_codes => [0]) + end + it 'should contain the default fstab setting' do + shell('cat /etc/fstab | grep /mnt/swap.1', :acceptable_exit_codes => [0]) + shell('cat /etc/fstab | grep defaults', :acceptable_exit_codes => [0]) + end + end + context 'custom parameters' do + it 'should work with no errors' do + pp = <<-EOS + swap_file::files { 'tmp file swap': + ensure => present, + swapfile => '/tmp/swapfile', + } + EOS + + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) + end + it 'should contain the given swapfile' do + shell('/sbin/swapon -s | grep /tmp/swapfile', :acceptable_exit_codes => [0]) + end + it 'should contain the default fstab setting' do + shell('cat /etc/fstab | grep /tmp/swapfile', :acceptable_exit_codes => [0]) + shell('cat /etc/fstab | grep defaults', :acceptable_exit_codes => [0]) + end + end + context 'multiple swap_file::files' do + it 'should work with no errors' do + pp = <<-EOS + swap_file::files { 'tmp file swap 1': + ensure => present, + swapfile => '/tmp/swapfile1', + } + + swap_file::files { 'tmp file swap 2': + ensure => present, + swapfile => '/tmp/swapfile2', + } + EOS + + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) + end + it 'should contain the given swapfiles' do + shell('/sbin/swapon -s | grep /tmp/swapfile1', :acceptable_exit_codes => [0]) + shell('/sbin/swapon -s | grep /tmp/swapfile2', :acceptable_exit_codes => [0]) + end + it 'should contain the default fstab setting' do + shell('cat /etc/fstab | grep /tmp/swapfile1', :acceptable_exit_codes => [0]) + shell('cat /etc/fstab | grep /tmp/swapfile2', :acceptable_exit_codes => [0]) + end + end + end +end \ No newline at end of file diff --git a/puppet/modules/swap_file/spec/classes/coverage_spec.rb b/puppet/modules/swap_file/spec/classes/coverage_spec.rb new file mode 100755 index 0000000..12513b8 --- /dev/null +++ b/puppet/modules/swap_file/spec/classes/coverage_spec.rb @@ -0,0 +1 @@ +at_exit { RSpec::Puppet::Coverage.report! } diff --git a/puppet/modules/swap_file/spec/classes/swap_file_spec.rb b/puppet/modules/swap_file/spec/classes/swap_file_spec.rb new file mode 100755 index 0000000..62a15f4 --- /dev/null +++ b/puppet/modules/swap_file/spec/classes/swap_file_spec.rb @@ -0,0 +1,111 @@ +require 'spec_helper' + +describe 'swap_file' do + + shared_examples "compiles and contains classes" do + it { should compile.with_all_deps } + it { should contain_class('Swap_file::Params') } + it { should contain_class('Swap_file') } + end + + shared_examples "with default parameters" do |osfamily| + let(:facts) {{ + :osfamily => osfamily, :memorysize => '1 GB', + }} + it { should compile.with_all_deps } + it { should contain_file('/mnt/swap.1') } + + it { should contain_swap_file__files('/mnt/swap.1') } + it { + should contain_exec('Create swap file /mnt/swap.1'). + with_command('/bin/dd if=/dev/zero of=/mnt/swap.1 bs=1M count=1073') + } + it { should contain_exec('Attach swap file /mnt/swap.1') } + it { should contain_mount('/mnt/swap.1').with_ensure('present') } + end + + shared_examples "with swapfile and size parameters" do |osfamily| + let(:params) {{ :swapfile => '/foo/bar', :swapfilesize => '2 GB' }} + let(:facts) {{ + :osfamily => osfamily, :memorysize => '1 GB', + }} + it { should compile.with_all_deps } + it { should contain_file('/foo/bar') } + + it { should contain_swap_file__files('/foo/bar') } + it { + should contain_exec('Create swap file /foo/bar'). + with_command('/bin/dd if=/dev/zero of=/foo/bar bs=1M count=2147') + } + it { should contain_exec('Attach swap file /foo/bar') } + it { should contain_mount('/foo/bar').with_ensure('present') } + end + + shared_examples "can specify no mount" do |osfamily| + let(:params) {{ :add_mount => false, }} + let(:facts) {{ + :osfamily => osfamily, :memorysize => '1 GB', + }} + it { should compile.with_all_deps } + it { should contain_file('/foo/bar') } + + it { should contain_swap_file__files('/foo/bar') } + it { + should contain_exec('Create swap file /foo/bar'). + with_command('/bin/dd if=/dev/zero of=/foo/bar bs=1M count=1073') + } + it { should contain_exec('Attach swap file /foo/bar') } + it { should_not contain_mount('/foo/bar').with_ensure('present') } + end + + context 'officially support operating system' do + describe 'Debian' do + it_behaves_like "compiles and contains classes" + + it_behaves_like "with default parameters", :osfamily => 'Debian' + + it_behaves_like "with swapfile and size parameters", :osfamily => 'Debian' + end + + describe 'RedHat' do + it_behaves_like "compiles and contains classes" + + it_behaves_like "with default parameters", :osfamily => 'RedHat' + + it_behaves_like "with swapfile and size parameters", :osfamily => 'RedHat' + end + end + + context 'not officially support operating system' do + describe 'Solaris' do + it_behaves_like "compiles and contains classes" + + it_behaves_like "with default parameters", :osfamily => 'Solaris' + + it_behaves_like "with swapfile and size parameters", :osfamily => 'Solaris' + end + end + + context 'windows operating system' do + describe 'swap_file class without any parameters on Windows' do + let(:facts) {{ + :osfamily => 'windows', + :operatingsystem => 'windows', + }} + + it { expect { should contain_class('swap_file') }.to raise_error(/Swap files dont work on windows/) } + end + end + + context 'FreeBSD operating system' do + describe 'swap_file class without any parameters on FreeBSD' do + let(:facts) {{ + :osfamily => 'FreeBSD', + :operatingsystem => 'FreeBSD', + }} + + it { expect { should contain_class('swap_file') }.to raise_error(/FreeBSD is not yet supported/) } + end + end + +end diff --git a/puppet/modules/swap_file/spec/spec_helper.rb b/puppet/modules/swap_file/spec/spec_helper.rb new file mode 100755 index 0000000..2c6f566 --- /dev/null +++ b/puppet/modules/swap_file/spec/spec_helper.rb @@ -0,0 +1 @@ +require 'puppetlabs_spec_helper/module_spec_helper' diff --git a/puppet/modules/swap_file/spec/spec_helper_acceptance.rb b/puppet/modules/swap_file/spec/spec_helper_acceptance.rb new file mode 100755 index 0000000..c13a5e0 --- /dev/null +++ b/puppet/modules/swap_file/spec/spec_helper_acceptance.rb @@ -0,0 +1,32 @@ +require 'beaker-rspec' + +unless ENV['RS_PROVISION'] == 'no' + hosts.each do |host| + if host.is_pe? + install_pe + else + install_puppet + on host, "mkdir -p #{host['distmoduledir']}" + end + end +end + +UNSUPPORTED_PLATFORMS = ['windows'] + +RSpec.configure do |c| + # Project root + proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) + + # Readable test descriptions + c.formatter = :documentation + + # Configure all nodes in nodeset + c.before :suite do + # Install module and dependencies + puppet_module_install(:source => proj_root, :module_name => 'swap_file') + hosts.each do |host| + shell('/bin/touch /etc/puppet/hiera.yaml') + shell('puppet module install puppetlabs-stdlib --version 3.2.0', { :acceptable_exit_codes => [0,1] }) + end + end +end diff --git a/puppet/modules/swap_file/tests/init.pp b/puppet/modules/swap_file/tests/init.pp new file mode 100755 index 0000000..b8e5d34 --- /dev/null +++ b/puppet/modules/swap_file/tests/init.pp @@ -0,0 +1,12 @@ +# The baseline for module testing used by Puppet Labs is that each manifest +# should have a corresponding test manifest that declares that class or defined +# type. +# +# Tests are then run by using puppet apply --noop (to check for compilation +# errors and view a log of events) or by fully applying the test in a virtual +# environment (to compare the resulting system state to the desired state). +# +# Learn more about module testing here: +# http://docs.puppetlabs.com/guides/tests_smoke.html +# +include swap_file
- - - (vversion; ?>) + + name ?> + (type ?> vversion; ?>)