diff options
author | James Shubin <james@shubin.ca> | 2013-09-23 16:10:56 -0400 |
---|---|---|
committer | James Shubin <james@shubin.ca> | 2013-09-23 16:10:56 -0400 |
commit | 2aa4163f52eb55cdd376946ad05c5d74a45c14f8 (patch) | |
tree | 39dba26f2fab0809bde43b4813f307ce14c77697 /manifests | |
parent | 17aff1a33a001cbb56735ff9f61a9bbcaa40cb04 (diff) | |
download | puppet-gluster-2aa4163f52eb55cdd376946ad05c5d74a45c14f8.tar.gz puppet-gluster-2aa4163f52eb55cdd376946ad05c5d74a45c14f8.tar.xz puppet-gluster-2aa4163f52eb55cdd376946ad05c5d74a45c14f8.zip |
Add gluster version fact and operating-version templating.
Puppet-gluster now correctly picks the operating-version value from a
table of known version -> value correspondences. Future value additions
should be added to this table.
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/host.pp | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/manifests/host.pp b/manifests/host.pp index e85f971..cbccbf4 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -57,9 +57,33 @@ define gluster::host( if "${valid_uuid}" == '' { fail('No valid UUID exists yet!') } else { - # set a unique uuid per host - # FIXME: set appropriate version based on gluster version - $valid_version = '2' + # get shorter version string for loose matching... + $gluster_main_version = regsubst( + "${gluster_version}", # eg: 3.4.0 + '^(\d+)\.(\d+)\.(\d+)$', # int.int.int + '\1.\2' # print int.int + ) + + # TODO: add additional values to this table... + $operating_version = "${gluster_version}" ? { + '' => '', # gluster not yet installed... + # specific version matches go here... + '3.4.0' => '2', + default => "${gluster_main_version}" ? { + # loose version matches go here... + #'3.3' => '1', # blank... + '3.4' => '2', + #'3.5' => '3', # guessing... + default => '-1', # unknown... + }, + } + + # this catches unknown gluster versions to add to table + if "${operating_version}" == '-1' { + warning("Gluster version '${gluster_version}' is unknown.") + } + + # set a unique uuid per host, and operating version... file { '/var/lib/glusterd/glusterd.info': content => template('gluster/glusterd.info.erb'), owner => root, |