-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #260 from rhefner1/manila-service-instance-config
Bring puppet-manila up to date
- Loading branch information
Showing
11 changed files
with
170 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,45 @@ | ||
# == Class: manila::db::postgresql | ||
# | ||
# Class that configures postgresql for manila | ||
# | ||
# Requires the Puppetlabs postgresql module. | ||
# | ||
# === Parameters | ||
# | ||
# [*password*] | ||
# (Required) Password to connect to the database. | ||
# | ||
# [*dbname*] | ||
# (Optional) Name of the database. | ||
# Defaults to 'manila'. | ||
# | ||
# [*user*] | ||
# (Optional) User to connect to the database. | ||
# Defaults to 'manila'. | ||
# | ||
# [*encoding*] | ||
# (Optional) The charset to use for the database. | ||
# Default to undef. | ||
# | ||
# [*privileges*] | ||
# (Optional) Privileges given to the database user. | ||
# Default to 'ALL' | ||
# | ||
class manila::db::postgresql( | ||
$password, | ||
$dbname = 'manila', | ||
$user = 'manila' | ||
$dbname = 'manila', | ||
$user = 'manila', | ||
$encoding = undef, | ||
$privileges = 'ALL', | ||
) { | ||
|
||
require postgresql::python | ||
|
||
Postgresql::Db[$dbname] ~> Exec<| title == 'manila-manage db_sync' |> | ||
Package['python-psycopg2'] -> Exec<| title == 'manila-manage db_sync' |> | ||
|
||
postgresql::db { $dbname: | ||
user => $user, | ||
password => $password, | ||
::openstacklib::db::postgresql { 'manila': | ||
password_hash => postgresql_password($user, $password), | ||
dbname => $dbname, | ||
user => $user, | ||
encoding => $encoding, | ||
privileges => $privileges, | ||
} | ||
|
||
::Openstacklib::Db::Postgresql['manila'] ~> Exec<| title == 'manila-manage db_sync' |> | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
require 'spec_helper' | ||
|
||
describe 'manila::service_instance' do | ||
|
||
let(:title) {'DEFAULT'} | ||
|
||
let :params do | ||
{ | ||
:service_instance_name_template => 'manila_service_instance_%s', | ||
:service_instance_user => 'user1', | ||
:service_instance_password => 'pass1', | ||
:manila_service_keypair_name => 'manila-service', | ||
:path_to_public_key => '~/.ssh/id_rsa.pub', | ||
:path_to_private_key => '~/.ssh/id_rsa', | ||
:max_time_to_build_instance => 300, | ||
:service_instance_security_group => 'manila-service', | ||
:service_instance_flavor_id => 1, | ||
:service_network_name => 'manila_service_network', | ||
:service_network_cidr => '10.254.0.0/16', | ||
:service_network_division_mask => 28, | ||
:interface_driver => 'manila.network.linux.interface.OVSInterfaceDriver', | ||
:connect_share_server_to_tenant_network => false, | ||
} | ||
end | ||
|
||
context 'with default parameters' do | ||
it 'configures service instance' do | ||
expect { | ||
params.each_pair do |config,value| | ||
should contain_manila_config("DEFAULT/#{config}").with_value( value ) | ||
end | ||
}.to raise_error(Puppet::Error, /Missing required parameter service_image_location/) | ||
end | ||
end | ||
|
||
context 'with service image provided' do | ||
let (:req_params) { params.merge!({ | ||
:service_image_name => 'manila-service-image', | ||
:service_image_location => 'http://example.com/manila_service_image.iso', | ||
}) } | ||
|
||
it 'creates Glance image' do | ||
should contain_glance_image(req_params[:service_image_name]).with( | ||
:ensure => 'present', | ||
:is_public => 'yes', | ||
:container_format => 'bare', | ||
:disk_format => 'qcow2', | ||
:source => req_params[:service_image_location] | ||
) | ||
end | ||
end | ||
end |