summaryrefslogtreecommitdiffstats
path: root/manifests/repo.pp
diff options
context:
space:
mode:
authorJames Shubin <james@shubin.ca>2013-12-22 18:38:04 -0500
committerJames Shubin <james@shubin.ca>2013-12-22 18:38:04 -0500
commitca290d42f9d97e4db3a85429a0374319fc4a4b91 (patch)
tree93f61598e40ee965b99ee0e1cbe1d3153bf971e4 /manifests/repo.pp
parent8ebe677878f9195e0cfe7d9512e8f466b3aab9e0 (diff)
downloadpuppet-gluster-ca290d42f9d97e4db3a85429a0374319fc4a4b91.tar.gz
puppet-gluster-ca290d42f9d97e4db3a85429a0374319fc4a4b91.tar.xz
puppet-gluster-ca290d42f9d97e4db3a85429a0374319fc4a4b91.zip
Improved auto repo management and version selection.
Introduced a split between repo management and version choosing. You can now: * Choose a package version or leave it at the default (latest). If you choose a package version it must include the release string. eg: in foobar-3.2.1-42.el6 the release is 42.el6 This doesn't check to see if your version is valid! * Choose whether you want a gluster repo added automatically. If you did specify a version, it will pick the correct repo. This doesn't check that the repo for your os/version exists!
Diffstat (limited to 'manifests/repo.pp')
-rw-r--r--manifests/repo.pp17
1 files changed, 13 insertions, 4 deletions
diff --git a/manifests/repo.pp b/manifests/repo.pp
index e9b53de..2c24593 100644
--- a/manifests/repo.pp
+++ b/manifests/repo.pp
@@ -29,13 +29,22 @@ class gluster::repo(
# latest
$base_v = "${base}LATEST/"
} else {
- if "${version}" =~ /^(\d+)\.(\d+)$/ { # x.y
+ notice("GlusterFS version: '${version}' was chosen.")
+
+ # parse out the -release if it exists. example: 3.4.2-13.el6
+ # \1 is the major/minor version, eg: 3.4.2
+ # \2 is the release with a leading dash, eg: -13.el6
+ # \3 is the first part of the release, eg: 13
+ # \4 is the second part of the release, eg: el6
+ $real_v = regsubst("${version}", '^([\d\.]*)(\-([\d]{1,})\.([a-zA-Z\d]{1,}))?$', '\1')
+
+ if "${real_v}" =~ /^(\d+)\.(\d+)$/ { # x.y
#$base_v = "${base}${1}.${2}/LATEST/" # same!
- $base_v = "${base}${version}/LATEST/"
+ $base_v = "${base}${real_v}/LATEST/"
- } elsif "${version}" =~ /^(\d+)\.(\d+)\.(\d+)$/ { # x.y.z
+ } elsif "${real_v}" =~ /^(\d+)\.(\d+)\.(\d+)$/ { # x.y.z
#$base_v = "${base}${1}.${2}/${1}.${2}.${3}/" # same!
- $base_v = "${base}${1}.${2}/${version}/"
+ $base_v = "${base}${1}.${2}/${real_v}/"
} else {
fail('The version string is invalid.')
}