Load Glance DB metadefs
This will load default metadata definitions into Glance when syncing the DB. Closes-Bug: 1664995 Change-Id: Id043e36b32516ae077239f5af0b6017104e99b83
This commit is contained in:
parent
8061a018a6
commit
bdd52684d6
@ -351,6 +351,7 @@ class glance::api(
|
||||
|
||||
if $sync_db {
|
||||
include ::glance::db::sync
|
||||
include ::glance::db::metadefs
|
||||
}
|
||||
|
||||
if ( $glance::params::api_package_name != $glance::params::registry_package_name ) {
|
||||
|
34
manifests/db/metadefs.pp
Normal file
34
manifests/db/metadefs.pp
Normal file
@ -0,0 +1,34 @@
|
||||
#
|
||||
# Class to load default Glance metadata definitions
|
||||
#
|
||||
# == Parameters
|
||||
#
|
||||
# [*extra_params*]
|
||||
# (optional) String of extra command line parameters to append to the
|
||||
# glance-manage db_load_metadefs command. These will be inserted in the
|
||||
# command line between 'glance-manage' and 'db_load_metadefs'.
|
||||
# Defaults to ''
|
||||
#
|
||||
class glance::db::metadefs(
|
||||
$extra_params = '',
|
||||
) {
|
||||
|
||||
include ::glance::deps
|
||||
include ::glance::params
|
||||
|
||||
exec { 'glance-manage db_load_metadefs':
|
||||
command => "glance-manage ${extra_params} db_load_metadefs",
|
||||
path => '/usr/bin',
|
||||
user => 'glance',
|
||||
refreshonly => true,
|
||||
try_sleep => 5,
|
||||
tries => 10,
|
||||
logoutput => on_failure,
|
||||
subscribe => [
|
||||
Anchor['glance::install::end'],
|
||||
Anchor['glance::config::end'],
|
||||
Anchor['glance::dbsync::end']
|
||||
],
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
fixes:
|
||||
- Load the default predefined namespaces for the Glance
|
||||
Metadata Definitions Catalog when syncing the Glance DB.
|
57
spec/classes/glance_db_metadefs_spec.rb
Normal file
57
spec/classes/glance_db_metadefs_spec.rb
Normal file
@ -0,0 +1,57 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'glance::db::metadefs' do
|
||||
|
||||
shared_examples_for 'glance-metadefs' do
|
||||
|
||||
it 'runs glance-manage db_load_metadefs' do
|
||||
is_expected.to contain_exec('glance-manage db_load_metadefs').with(
|
||||
:command => 'glance-manage db_load_metadefs',
|
||||
:path => '/usr/bin',
|
||||
:user => 'glance',
|
||||
:refreshonly => 'true',
|
||||
:try_sleep => 5,
|
||||
:tries => 10,
|
||||
:logoutput => 'on_failure',
|
||||
:subscribe => ['Anchor[glance::install::end]',
|
||||
'Anchor[glance::config::end]',
|
||||
'Anchor[glance::dbsync::end]'],
|
||||
)
|
||||
end
|
||||
|
||||
describe "overriding extra_params" do
|
||||
let :params do
|
||||
{
|
||||
:extra_params => '--config-file /etc/glance/glance.conf',
|
||||
}
|
||||
end
|
||||
|
||||
it {is_expected.to contain_exec('glance-manage db_load_metadefs').with(
|
||||
:command => 'glance-manage --config-file /etc/glance/glance.conf db_load_metadefs',
|
||||
:path => '/usr/bin',
|
||||
:user => 'glance',
|
||||
:refreshonly => 'true',
|
||||
:try_sleep => 5,
|
||||
:tries => 10,
|
||||
:logoutput => 'on_failure',
|
||||
:subscribe => ['Anchor[glance::install::end]',
|
||||
'Anchor[glance::config::end]',
|
||||
'Anchor[glance::dbsync::end]'],
|
||||
)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts({ :concat_basedir => '/var/lib/puppet/concat' }))
|
||||
end
|
||||
|
||||
it_configures 'glance-metadefs'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in New Issue
Block a user