Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Perform explicit db migrations

The db sync script should be used to create
the initial db schema so that it will create
a migration revision table.

This migration revision table allows for schema upgrades.

This commit adds an exec resource for glance-manage db_sync
and ensures that it only occurs if the registry.conf file,
package, or db resource change.
  • Loading branch information...
commit 4b95b9dae7d39034e5046c982b628ea05e4d99c0 1 parent 52cbb6f
@bodepd bodepd authored
Showing with 26 additions and 9 deletions.
  1. +11 −0 manifests/registry.pp
  2. +15 −9 spec/classes/glance_registry_spec.rb
View
11 manifests/registry.pp
@@ -33,6 +33,17 @@
content => template('glance/glance-registry-paste.ini.erb'),
}
+ Database<| title == 'glance' |> ~> Exec['glance-manage db_sync']
+
+ exec { 'glance-manage db_sync':
+ path => '/usr/bin',
+ refreshonly => true,
+ logoutput => on_failure,
+ subscribe => [Package['glance'], File['/etc/glance/glance-registry.conf']],
+ notify => Service['glance-registry'],
+ }
+
+
service { 'glance-registry':
name => $::glance::params::registry_service_name,
ensure => running,
View
24 spec/classes/glance_registry_spec.rb
@@ -44,16 +44,22 @@
it { should contain_class 'glance::registry' }
- it do
- should contain_service('glance-registry').with(
- 'ensure' => 'running',
- 'enable' => 'true',
- 'hasstatus' => 'true',
+ it { should contain_service('glance-registry').with(
+ 'ensure' => 'running',
+ 'enable' => 'true',
+ 'hasstatus' => 'true',
'hasrestart' => 'true',
- 'subscribe' => 'File[/etc/glance/glance-registry.conf]',
- 'require' => 'Class[Glance]'
- )
- end
+ 'subscribe' => 'File[/etc/glance/glance-registry.conf]',
+ 'require' => 'Class[Glance]'
+ )}
+
+ it { should contain_exec('glance-manage db_sync').with(
+ 'path' => '/usr/bin',
+ 'refreshonly' => true,
+ 'logoutput' => 'on_failure',
+ 'subscribe' => ['Package[glance]', 'File[/etc/glance/glance-registry.conf]'],
+ 'notify' => 'Service[glance-registry]'
+ )}
it 'should compile the template based on the class parameters' do
content = param_value(subject, 'file', '/etc/glance/glance-registry.conf', 'content')
Please sign in to comment.
Something went wrong with that request. Please try again.