From 3454de6d47e31250b8d2911cbe1cdbc0190e4335 Mon Sep 17 00:00:00 2001 From: Markus Opolka Date: Wed, 21 Sep 2016 14:45:23 +0200 Subject: [PATCH] Change download URL to GitHub so it won't change all the time --- .fixtures.yml | 3 --- data/common.yaml | 7 +++---- manifests/extract.pp | 46 +++++++++++++++++++++++++++++--------------- manifests/init.pp | 17 ++++------------ metadata.json | 3 +-- 5 files changed, 39 insertions(+), 37 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index 5cfc486..16c562b 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -4,9 +4,6 @@ fixtures: stdlib: ref: "4.12.0" repo: "https://github.com/puppetlabs/puppetlabs-stdlib" - archive: - ref: "v1.1.1" - repo: "https://github.com/voxpupuli/puppet-archive" mysql: ref: "3.8.0" repo: "http://github.com/puppetlabs/puppetlabs-mysql" diff --git a/data/common.yaml b/data/common.yaml index 9617de9..3d8b851 100644 --- a/data/common.yaml +++ b/data/common.yaml @@ -1,9 +1,8 @@ --- -limesurvey::archive_path: '/tmp/limesurvey.tar.gz' -limesurvey::dir_name: 'limesurvey' limesurvey::dbhost: 'localhost' -limesurvey::download_url: 'https://www.limesurvey.org/stable-release?download=1853:limesurvey2514%20160908targz' -limesurvey::extract_path: '/opt/' +limesurvey::download_url: 'https://github.com/LimeSurvey/LimeSurvey/archive/' +limesurvey::version: '2.51.4_160908' +limesurvey::install_path: '/opt/limesurvey' limesurvey::manage_database: true limesurvey::manage_webserver: true limesurvey::manage_php: true diff --git a/manifests/extract.pp b/manifests/extract.pp index 54d1cae..40be8f7 100644 --- a/manifests/extract.pp +++ b/manifests/extract.pp @@ -6,9 +6,6 @@ # Parameters # ---------- # -# * `sample parameter` -# Explanation of what this parameter affects and what it defaults to. -# # Examples # -------- # @@ -28,9 +25,8 @@ # class limesurvey::extract ( - String $archive_path = $limesurvey::archive_path, String $download_url = $limesurvey::download_url, - String $extract_path = $limesurvey::extract_path, + String $version = $limesurvey::version, String $install_path = $limesurvey::install_path, String $runtime_dir_mode = $limesurvey::runtime_dir_mode, String $www_group = $limesurvey::www_group, @@ -44,21 +40,41 @@ class limesurvey::extract ( group => $www_group, } - archive { $archive_path: - ensure => present, - extract => true, - extract_path => $extract_path, - source => $download_url, - creates => "${install_path}/tmp", - user => $www_user, - group => $www_group, - require => File[$install_path], + exec { 'limesurvey-download': + path => '/bin:/usr/bin', + creates => "${install_path}/tmp/runtime", + command => "bash -c 'cd /tmp; wget ${download_url}${version}.tar.gz'", + require => File[$install_path], + user => $www_user, + } + + exec { 'limesurvey-unzip': + path => '/bin:/usr/bin', + cwd => '/tmp', + creates => "${install_path}/tmp/runtime", + command => "bash -c 'cd /tmp; tar zxf /tmp/${version}.tar.gz'", + require => Exec['limesurvey-download'], + user => $www_user, + } + + exec { 'limesurvey-copy': + path => '/bin:/usr/bin', + cwd => '/tmp', + creates => "${install_path}/tmp/runtime", + command => "bash -c 'cp -rf /tmp/LimeSurvey-${version}/* ${install_path}'", + require => Exec['limesurvey-unzip'], + user => $www_user, + } + + file { "/tmp/${version}.tar.gz": + ensure => absent, + require => Exec['limesurvey-copy'], } file { "${install_path}/tmp/runtime/": ensure => directory, mode => $runtime_dir_mode, - require => File[$install_path], + require => Exec['limesurvey-copy'], } } diff --git a/manifests/init.pp b/manifests/init.pp index 351b4cc..3377439 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -7,21 +7,14 @@ # Parameters # ---------- # -# * `archive_path` -# Name of path to extract to -# -# * `dir_name` -# Name of directory to extract to -# # * `install_path` # Combination of archive_path and dir_name # # * `download_url` # Where to download the limesurey code from. -# Note: They seem to change that quite often. Be aware. # -# * `extract_path` -# Target folder path to extract archive +# * `version` +# What version to download. # # * `runtime_dir_mode` # Mode of the limesurey runtime directory. Default is 0766, @@ -69,10 +62,9 @@ # class limesurvey ( - String $archive_path, - String $dir_name, + String $install_path, String $download_url, - String $extract_path, + String $version, String $runtime_dir_mode, String $www_group, String $www_user, @@ -95,7 +87,6 @@ class limesurvey ( String $webserver_class = 'limesurvey::webserver', String $php_class = 'limesurvey::php', - String $install_path = "${extract_path}${dir_name}", String $vhost_docroot = $install_path, ) { diff --git a/metadata.json b/metadata.json index f61726b..a70d73f 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "martialblog-limesurvey", - "version": "0.1.1", + "version": "0.1.2", "author": "martialblog", "summary": "Installation and Configuration of Limesurvey", "license": "Apache-2.0", @@ -9,7 +9,6 @@ "issues_url": "https://github.com/martialblog/puppet-limesurvey/issues", "dependencies": [ {"name":"puppetlabs-stdlib","version_requirement":">= 1.0.0"}, - {"name":"puppet-archive","version_requirement":">= 1.1.1"}, {"name":"puppetlabs-concat","version_requirement":">= 2.2.0"}, {"name":"puppetlabs-apache","version_requirement":">= 1.10.0"}, {"name":"puppetlabs-mysql","version_requirement":">= 3.8.0"}