From ca290d42f9d97e4db3a85429a0374319fc4a4b91 Mon Sep 17 00:00:00 2001 From: James Shubin Date: Sun, 22 Dec 2013 18:38:04 -0500 Subject: 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! --- manifests/repo.pp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'manifests/repo.pp') 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.') } -- cgit