Add vitrage auth and client class
* auth.pp for vitrage authentication * client.pp for vitrage client installation Change-Id: I7bb2a372908614871eaca8c1aed82aaf002e4b90
This commit is contained in:
parent
df32501f11
commit
223d161b44
61
manifests/auth.pp
Normal file
61
manifests/auth.pp
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
# The vitrage::auth class helps configure auth settings
|
||||||
|
#
|
||||||
|
# == Parameters
|
||||||
|
# [*auth_url*]
|
||||||
|
# the keystone public endpoint
|
||||||
|
# Optional. Defaults to 'http://localhost:5000'
|
||||||
|
#
|
||||||
|
# [*auth_region*]
|
||||||
|
# the keystone region of this node
|
||||||
|
# Optional. Defaults to 'RegionOne'
|
||||||
|
#
|
||||||
|
# [*auth_user*]
|
||||||
|
# the keystone user for vitrage services
|
||||||
|
# Optional. Defaults to 'vitrage'
|
||||||
|
#
|
||||||
|
# [*auth_password*]
|
||||||
|
# the keystone password for vitrage services
|
||||||
|
# Required.
|
||||||
|
#
|
||||||
|
# [*auth_tenant_name*]
|
||||||
|
# the keystone tenant name for vitrage services
|
||||||
|
# Optional. Defaults to 'services'
|
||||||
|
#
|
||||||
|
# [*auth_tenant_id*]
|
||||||
|
# the keystone tenant id for vitrage services.
|
||||||
|
# Optional. Defaults to $::os_service_default.
|
||||||
|
#
|
||||||
|
# [*auth_cacert*]
|
||||||
|
# Certificate chain for SSL validation.
|
||||||
|
# Optional. Defaults to $::os_service_default.
|
||||||
|
#
|
||||||
|
# [*auth_endpoint_type*]
|
||||||
|
# Type of endpoint in Identity service catalog to use for
|
||||||
|
# communication with OpenStack services.
|
||||||
|
# Optional. Defaults to $::os_service_default.
|
||||||
|
#
|
||||||
|
class vitrage::auth (
|
||||||
|
$auth_password,
|
||||||
|
$auth_url = 'http://localhost:5000',
|
||||||
|
$auth_region = 'RegionOne',
|
||||||
|
$auth_user = 'vitrage',
|
||||||
|
$auth_tenant_name = 'services',
|
||||||
|
$auth_tenant_id = $::os_service_default,
|
||||||
|
$auth_cacert = $::os_service_default,
|
||||||
|
$auth_endpoint_type = $::os_service_default,
|
||||||
|
) {
|
||||||
|
|
||||||
|
|
||||||
|
vitrage_config {
|
||||||
|
'service_credentials/os_auth_url' : value => $auth_url;
|
||||||
|
'service_credentials/os_region_name' : value => $auth_region;
|
||||||
|
'service_credentials/os_username' : value => $auth_user;
|
||||||
|
'service_credentials/os_password' : value => $auth_password, secret => true;
|
||||||
|
'service_credentials/os_tenant_name' : value => $auth_tenant_name;
|
||||||
|
'service_credentials/os_tenant_id' : value => $auth_tenant_id;
|
||||||
|
'service_credentials/os_endpoint_type' : value => $auth_endpoint_type;
|
||||||
|
'service_credentials/os_cacert' : value => $auth_cacert
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
21
manifests/client.pp
Normal file
21
manifests/client.pp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#
|
||||||
|
# Installs the vitrage python library.
|
||||||
|
#
|
||||||
|
# == parameters
|
||||||
|
# [*ensure*]
|
||||||
|
# ensure state for package.
|
||||||
|
#
|
||||||
|
class vitrage::client (
|
||||||
|
$ensure = 'present'
|
||||||
|
) {
|
||||||
|
|
||||||
|
include ::vitrage::params
|
||||||
|
|
||||||
|
package { 'python-vitrageclient':
|
||||||
|
ensure => $ensure,
|
||||||
|
name => $::vitrage::params::client_package_name,
|
||||||
|
tag => 'openstack',
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -2,6 +2,8 @@
|
|||||||
#
|
#
|
||||||
class vitrage::params {
|
class vitrage::params {
|
||||||
|
|
||||||
|
$client_package_name = 'python-vitrageclient'
|
||||||
|
|
||||||
case $::osfamily {
|
case $::osfamily {
|
||||||
'RedHat': {
|
'RedHat': {
|
||||||
$api_package_name = 'openstack-vitrage-api'
|
$api_package_name = 'openstack-vitrage-api'
|
||||||
|
51
spec/classes/vitrage_auth_spec.rb
Normal file
51
spec/classes/vitrage_auth_spec.rb
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe 'vitrage::auth' do
|
||||||
|
|
||||||
|
let :params do
|
||||||
|
{ :auth_url => 'http://localhost:5000',
|
||||||
|
:auth_region => 'RegionOne',
|
||||||
|
:auth_user => 'vitrage',
|
||||||
|
:auth_password => 'password',
|
||||||
|
:auth_tenant_name => 'services',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
shared_examples_for 'vitrage-auth' do
|
||||||
|
|
||||||
|
it 'configures authentication' do
|
||||||
|
is_expected.to contain_vitrage_config('service_credentials/os_auth_url').with_value('http://localhost:5000')
|
||||||
|
is_expected.to contain_vitrage_config('service_credentials/os_region_name').with_value('RegionOne')
|
||||||
|
is_expected.to contain_vitrage_config('service_credentials/os_username').with_value('vitrage')
|
||||||
|
is_expected.to contain_vitrage_config('service_credentials/os_password').with_value('password')
|
||||||
|
is_expected.to contain_vitrage_config('service_credentials/os_password').with_value(params[:auth_password]).with_secret(true)
|
||||||
|
is_expected.to contain_vitrage_config('service_credentials/os_tenant_name').with_value('services')
|
||||||
|
is_expected.to contain_vitrage_config('service_credentials/os_cacert').with_value('<SERVICE DEFAULT>')
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when overriding parameters' do
|
||||||
|
before do
|
||||||
|
params.merge!(
|
||||||
|
:auth_cacert => '/tmp/dummy.pem',
|
||||||
|
:auth_endpoint_type => 'internalURL',
|
||||||
|
)
|
||||||
|
end
|
||||||
|
it { is_expected.to contain_vitrage_config('service_credentials/os_cacert').with_value(params[:auth_cacert]) }
|
||||||
|
it { is_expected.to contain_vitrage_config('service_credentials/os_endpoint_type').with_value(params[:auth_endpoint_type]) }
|
||||||
|
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())
|
||||||
|
end
|
||||||
|
|
||||||
|
it_configures 'vitrage-auth'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
30
spec/classes/vitrage_client_spec.rb
Normal file
30
spec/classes/vitrage_client_spec.rb
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe 'vitrage::client' do
|
||||||
|
|
||||||
|
shared_examples_for 'vitrage client' do
|
||||||
|
|
||||||
|
it { is_expected.to contain_class('vitrage::params') }
|
||||||
|
|
||||||
|
it 'installs vitrage client package' do
|
||||||
|
is_expected.to contain_package('python-vitrageclient').with(
|
||||||
|
:ensure => 'present',
|
||||||
|
:name => 'python-vitrageclient',
|
||||||
|
:tag => 'openstack',
|
||||||
|
)
|
||||||
|
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())
|
||||||
|
end
|
||||||
|
|
||||||
|
it_configures 'vitrage client'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user