Skip to content

Commit 57da044

Browse files
author
Emilien Macchi
committed
don't create a cinder type if already it exist
Avoid Puppet warnings by checking if a volume type exist before trying to actually create it. Closes-bug #1319857 Signed-off-by: Emilien Macchi <emilien.macchi@enovance.com> Change-Id: Ib31db545d1d761fc6abed0a42dd7ae8e6cc0f25f (cherry picked from commit 1569926)
1 parent cdce3d8 commit 57da044

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

manifests/type.pp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
exec {"cinder type-create ${volume_name}":
4444
path => '/usr/bin',
4545
command => "cinder type-create ${volume_name}",
46+
unless => "cinder type-list | grep ${volume_name}",
4647
environment => [
4748
"OS_TENANT_NAME=${os_tenant_name}",
4849
"OS_USERNAME=${os_username}",
@@ -64,4 +65,4 @@
6465
os_auth_url => $os_auth_url,
6566
}
6667
}
67-
}
68+
}

spec/defines/cinder_type_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
'OS_USERNAME=admin',
2525
'OS_PASSWORD=asdf',
2626
'OS_AUTH_URL=http://127.127.127.1:5000/v2.0/'],
27+
:unless => 'cinder type-list | grep hippo',
2728
:require => 'Package[python-cinderclient]')
2829
should contain_exec('cinder type-key hippo set volume_backend_name=name1')
2930
should contain_exec('cinder type-key hippo set volume_backend_name=name2')

0 commit comments

Comments
 (0)