add fetcher::gnocchi class to configure the gnocchi tenant fetcher
Change-Id: I4fd3366755c19ce95498442291ee4be1952f3853
This commit is contained in:
parent
8556da0c4d
commit
91133480d8
57
manifests/fetcher/gnocchi.pp
Normal file
57
manifests/fetcher/gnocchi.pp
Normal file
@ -0,0 +1,57 @@
|
||||
#
|
||||
# Class to configure the gnocchi tenant/project fetcher
|
||||
#
|
||||
# == Parameters
|
||||
# [*scope_attribute*]
|
||||
# Attribute from which scope_ids should be collected. (string value)
|
||||
#
|
||||
# [*resource_types*]
|
||||
# List of gnocchi resource types. All if left blank (list value)
|
||||
#
|
||||
# [*gnocchi_auth_type*]
|
||||
# Gnocchi auth type (keystone or basic). Keystone credentials can be
|
||||
# specified through the "auth_section" parameter (string value)
|
||||
#
|
||||
# [*gnocchi_user*]
|
||||
# Gnocchi user (for basic auth only) (string value)
|
||||
#
|
||||
# [*gnocchi_endpoint*]
|
||||
# Gnocchi endpoint (for basic auth only) (string value)
|
||||
#
|
||||
# [*interface*]
|
||||
# Endpoint URL type (for keystone auth only) (string value)
|
||||
#
|
||||
# [*region_name*]
|
||||
# Region Name (string value)
|
||||
#
|
||||
# [*auth_type*]
|
||||
# Authentication type to load (string value)
|
||||
# [*auth_section*]
|
||||
# Config Section from which to load plugin specific options (string
|
||||
# value)
|
||||
#
|
||||
class cloudkitty::fetcher::gnocchi(
|
||||
String $scope_attribute = $::os_service_default,
|
||||
String $resource_types = $::os_service_default,
|
||||
String $gnocchi_auth_type = $::os_service_default,
|
||||
String $gnocchi_user = $::os_service_default,
|
||||
String $gnocchi_endpoint = $::os_service_default,
|
||||
String $interface = $::os_service_default,
|
||||
String $region_name = $::os_service_default,
|
||||
String $auth_type = $::os_service_default,
|
||||
String $auth_section = $::os_service_default,
|
||||
){
|
||||
include cloudkitty::deps
|
||||
|
||||
cloudkitty_config {
|
||||
'fetcher_gnocchi/scope_attribute': value => $scope_attribute;
|
||||
'fetcher_gnocchi/resource_types': value => $resource_types;
|
||||
'fetcher_gnocchi/gnocchi_auth_type': value => $gnocchi_auth_type;
|
||||
'fetcher_gnocchi/gnocchi_user': value => $gnocchi_user;
|
||||
'fetcher_gnocchi/gnocchi_endpoint': value => $gnocchi_endpoint;
|
||||
'fetcher_gnocchi/interface': value => $interface;
|
||||
'fetcher_gnocchi/region_name': value => $region_name;
|
||||
'fetcher_gnocchi/auth_type': value => $auth_type;
|
||||
'fetcher_gnocchi/auth_section': value => $auth_section;
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
---
|
||||
features:
|
||||
- Add cloudkitty::fetcher::gnocchi class to configure the gnocchi tenant fetcher.
|
63
spec/classes/cloudkitty_fetcher_gnocchi_spec.rb
Normal file
63
spec/classes/cloudkitty_fetcher_gnocchi_spec.rb
Normal file
@ -0,0 +1,63 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cloudkitty::fetcher::gnocchi' do
|
||||
|
||||
let :params do
|
||||
{ :scope_attribute => '<SERVICE DEFAULT>',
|
||||
:resource_types => '<SERVICE DEFAULT>',
|
||||
:gnocchi_auth_type => '<SERVICE DEFAULT>',
|
||||
:gnocchi_user => '<SERVICE DEFAULT>',
|
||||
:gnocchi_endpoint => '<SERVICE DEFAULT>',
|
||||
:interface => '<SERVICE DEFAULT>',
|
||||
:region_name => '<SERVICE DEFAULT>',
|
||||
:auth_type => '<SERVICE DEFAULT>',
|
||||
:auth_section => '<SERVICE DEFAULT>',
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
shared_examples_for 'cloudkitty::fetcher::gnocchi' do
|
||||
it { should contain_class('cloudkitty::deps') }
|
||||
|
||||
it { is_expected.to contain_cloudkitty_config('fetcher_gnocchi/scope_attribute').with_value( params[:scope_attribute])}
|
||||
it { is_expected.to contain_cloudkitty_config('fetcher_gnocchi/resource_types').with_value( params[:resource_types])}
|
||||
it { is_expected.to contain_cloudkitty_config('fetcher_gnocchi/gnocchi_auth_type').with_value( params[:gnocchi_auth_type])}
|
||||
it { is_expected.to contain_cloudkitty_config('fetcher_gnocchi/gnocchi_user').with_value( params[:gnocchi_user])}
|
||||
it { is_expected.to contain_cloudkitty_config('fetcher_gnocchi/gnocchi_endpoint').with_value( params[:gnocchi_endpoint])}
|
||||
it { is_expected.to contain_cloudkitty_config('fetcher_gnocchi/interface').with_value( params[:interface])}
|
||||
it { is_expected.to contain_cloudkitty_config('fetcher_gnocchi/region_name').with_value( params[:region_name])}
|
||||
it { is_expected.to contain_cloudkitty_config('fetcher_gnocchi/auth_type').with_value( params[:auth_type])}
|
||||
it { is_expected.to contain_cloudkitty_config('fetcher_gnocchi/auth_section').with_value( params[:auth_section])}
|
||||
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
|
||||
|
||||
context 'with default parameters' do
|
||||
it_behaves_like 'cloudkitty::fetcher::gnocchi'
|
||||
end
|
||||
|
||||
context 'when overriding parameters' do
|
||||
before do
|
||||
params.merge!({
|
||||
:scope_attribute => 'project_id',
|
||||
:resource_types => 'some_types',
|
||||
:gnocchi_auth_type => 'basic',
|
||||
:gnocchi_user => 'myuser',
|
||||
:gnocchi_endpoint => 'https://somwhere/',
|
||||
:interface => 'external',
|
||||
:region_name => 'myregion',
|
||||
:auth_type => 'typeA',
|
||||
:auth_section => 'ks_auth',
|
||||
})
|
||||
end
|
||||
it_behaves_like 'cloudkitty::fetcher::gnocchi'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user