Permalink
Browse files

Better volume property management.

This patch adds the beginning of better property management. Many
properties need types and testing filled in to work properly. This is
preliminary support to make it easier for others to test and offer
patches for options they use.
1 parent 1d423ad commit 7e00d90ecc38812e0f24fc711523b778955d39c8 @purpleidea committed Sep 16, 2013
Showing with 353 additions and 15 deletions.
  1. +20 −15 manifests/volume/property.pp
  2. +333 −0 manifests/volume/property/data.pp
@@ -23,6 +23,8 @@
) {
include gluster::xml
include gluster::vardir
+ include gluster::volume::property::data
+
#$vardir = $::gluster::vardir::module_vardir # with trailing slash
$vardir = regsubst($::gluster::vardir::module_vardir, '\/$', '')
@@ -34,17 +36,18 @@
fail('The property $name must match a $volume#$key pattern.')
}
- # TODO: can we split out $etype lookup into a separate file, like?
- # also do the same for jchar
- #$etype = gluster::volume::property::etype # pull in etype hash
-
- # expected type # XXX: add more variables
- $etype = $key ? {
- 'auth.allow' => 'array',
- 'auth.reject' => 'array',
- #'XXX' => 'string', # XXX
- #'XXXX' => 'array', # XXX
- default => 'undefined',
+ # split out $etype and $jchar lookup into a separate file
+ $etypes = $::gluster::volume::property::data::etypes
+ $jchars = $::gluster::volume::property::data::jchars
+
+ # expected type
+ if has_key($etypes, "${key}") {
+ $etype = $etypes["${key}"] ? {
+ '' => 'undefined',
+ default => $etypes["${key}"],
+ }
+ } else {
+ $etype = 'undefined'
}
if (! $autotype) {
@@ -63,10 +66,12 @@
if $etype == 'string' {
$safe_value = shellquote($value) # TODO: is this the safe thing?
} elsif $etype == 'array' {
- $jchar = $key ? {
- 'auth.allow' => ',',
- 'auth.reject' => ',',
- default => '',
+
+ # join char
+ if has_key($jchars, "${key}") {
+ $jchar = $jchars["${key}"]
+ } else {
+ $jchar = ''
}
$safe_value = inline_template('<%= value.join(jchar) %>')
Oops, something went wrong.

0 comments on commit 7e00d90

Please sign in to comment.