Fix db sync command
Cloudkitty uses cloudkitty-dbsync command for executing DB schema operations instead of cloudkitty-manage, and add rspec test for cloudkitty::db::sync Change-Id: Ifec20dd417778b537170e0b226ca0eee06b0105d
This commit is contained in:
		@@ -12,12 +12,13 @@ class cloudkitty::db::sync(
 | 
			
		||||
  $extra_params  = undef,
 | 
			
		||||
) {
 | 
			
		||||
  exec { 'cloudkitty-db-sync':
 | 
			
		||||
    command     => "cloudkitty-manage db_sync ${extra_params}",
 | 
			
		||||
    command     => "cloudkitty-dbsync upgrade ${extra_params}",
 | 
			
		||||
    path        => [ '/bin', '/usr/bin', ],
 | 
			
		||||
    user        => 'cloudkitty',
 | 
			
		||||
    refreshonly => true,
 | 
			
		||||
    try_sleep   => 5,
 | 
			
		||||
    tries       => 10,
 | 
			
		||||
    logoutput   => on_failure,
 | 
			
		||||
    subscribe   => [Package['cloudkitty'], Cloudkitty_config['database/connection']],
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										34
									
								
								spec/classes/cloudkitty_db_sync_spec.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								spec/classes/cloudkitty_db_sync_spec.rb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,34 @@
 | 
			
		||||
require 'spec_helper'
 | 
			
		||||
 | 
			
		||||
describe 'cloudkitty::db::sync' do
 | 
			
		||||
 | 
			
		||||
  shared_examples_for 'cloudkitty-dbsync' do
 | 
			
		||||
 | 
			
		||||
    it 'runs cloudkitty-db-sync' do
 | 
			
		||||
      is_expected.to contain_exec('cloudkitty-db-sync').with(
 | 
			
		||||
        :command     => 'cloudkitty-dbsync upgrade ',
 | 
			
		||||
        :path        => [ '/bin', '/usr/bin', ],
 | 
			
		||||
        :refreshonly => 'true',
 | 
			
		||||
        :user        => 'cloudkitty',
 | 
			
		||||
        :logoutput   => 'on_failure'
 | 
			
		||||
      )
 | 
			
		||||
    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({
 | 
			
		||||
          :os_workers     => 8,
 | 
			
		||||
          :concat_basedir => '/var/lib/puppet/concat'
 | 
			
		||||
        }))
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      it_configures 'cloudkitty-dbsync'
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
end
 | 
			
		||||
		Reference in New Issue
	
	Block a user