Create type-key only if it doesn't exist

* class cinder::type_set.pp
* Add check to create type-key only if it doesn't exist

Closes-Bug: #1354467

Change-Id: If089bca0d784fc7bda6f76cd18f1ba29a82f2df2
This commit is contained in:
Nicolas Hicher 2014-08-08 11:53:03 -04:00
parent c93baffe7b
commit eea144eb8e
2 changed files with 2 additions and 0 deletions

View File

@ -58,6 +58,7 @@ define cinder::type_set (
exec {"cinder type-key ${type} set ${key}=${name}": exec {"cinder type-key ${type} set ${key}=${name}":
path => ['/usr/bin', '/bin'], path => ['/usr/bin', '/bin'],
command => "cinder type-key ${type} set ${key}=${name}", command => "cinder type-key ${type} set ${key}=${name}",
unless => "cinder extra-specs-list | grep -Eq '\b${type}\b.*\b${key}\b.*\b${name}\b'",
environment => concat($cinder_env, $region_env), environment => concat($cinder_env, $region_env),
require => Package['python-cinderclient'] require => Package['python-cinderclient']
} }

View File

@ -19,6 +19,7 @@ describe 'cinder::type_set' do
it 'should have its execs' do it 'should have its execs' do
should contain_exec('cinder type-key sith set monchichi=hippo').with( should contain_exec('cinder type-key sith set monchichi=hippo').with(
:command => 'cinder type-key sith set monchichi=hippo', :command => 'cinder type-key sith set monchichi=hippo',
:unless => "cinder extra-specs-list | grep -Eq '\\bsith\\b.*\\bmonchichi\\b.*\\bhippo\\b'",
:environment => [ :environment => [
'OS_TENANT_NAME=admin', 'OS_TENANT_NAME=admin',
'OS_USERNAME=admin', 'OS_USERNAME=admin',