From c44f7f023fb80cac0bda52a038cb2f8d33ac4e8e Mon Sep 17 00:00:00 2001 From: Giulio Fidente Date: Mon, 30 Mar 2015 15:59:55 +0200 Subject: [PATCH] Fix behaviour of 'set-secret-value virsh' exec Aims at fixing two issues: we had an unless clause which was only checking if the secret was already defined, not if the value for the secret was set; when providing the value for the secret, we were mistakenly referring to the secret by its XML dump instead of its UUID. Change-Id: I513599735e974c07a6a0e46fd319930740f259cc Closes-Bug: #1425601 --- manifests/compute/rbd.pp | 4 ++-- spec/classes/nova_compute_rbd_spec.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/compute/rbd.pp b/manifests/compute/rbd.pp index 6d7b3abdd..d520c0ecf 100644 --- a/manifests/compute/rbd.pp +++ b/manifests/compute/rbd.pp @@ -76,8 +76,8 @@ class nova::compute::rbd ( } exec { 'set-secret-value virsh': - command => "/usr/bin/virsh secret-set-value --secret $(cat /etc/nova/virsh.secret) --base64 $(ceph auth get-key ${rbd_keyring})", - unless => "/usr/bin/virsh secret-list | grep ${libvirt_rbd_secret_uuid}", + command => "/usr/bin/virsh secret-set-value --secret ${libvirt_rbd_secret_uuid} --base64 $(ceph auth get-key ${rbd_keyring})", + unless => "/usr/bin/virsh secret-get-value ${libvirt_rbd_secret_uuid}", require => Exec['get-or-set virsh secret'] } diff --git a/spec/classes/nova_compute_rbd_spec.rb b/spec/classes/nova_compute_rbd_spec.rb index 25e6a84e7..f442810f8 100644 --- a/spec/classes/nova_compute_rbd_spec.rb +++ b/spec/classes/nova_compute_rbd_spec.rb @@ -85,7 +85,7 @@ describe 'nova::compute::rbd' do :require => 'File[/etc/nova/secret.xml]' ) is_expected.to contain_exec('set-secret-value virsh').with( - :command => "/usr/bin/virsh secret-set-value --secret $(cat /etc/nova/virsh.secret) --base64 $(ceph auth get-key client.rbd_test)" + :command => "/usr/bin/virsh secret-set-value --secret UUID --base64 $(ceph auth get-key client.rbd_test)" ) end end