Merge "Add support to install dashboards"
This commit is contained in:
commit
5100c3c748
51
manifests/dashboard.pp
Normal file
51
manifests/dashboard.pp
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2018 Binero
|
||||||
|
#
|
||||||
|
# Author: Tobias Urdin <tobias.urdin@binero.se>
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
#
|
||||||
|
# == Define: horizon::dashboard
|
||||||
|
#
|
||||||
|
# This resource installs additional horizon dashboard which is not
|
||||||
|
# shipped with the horizon packages, but as additional packages.
|
||||||
|
#
|
||||||
|
# == Example:
|
||||||
|
#
|
||||||
|
# This will install the correct heat-dashboard package for your deployment.
|
||||||
|
# horizon::dashboard { 'heat': }
|
||||||
|
#
|
||||||
|
define horizon::dashboard {
|
||||||
|
|
||||||
|
$dashboard = downcase($name)
|
||||||
|
|
||||||
|
case $::osfamily {
|
||||||
|
'Debian': {
|
||||||
|
$dashboard_package_name = $::os_package_type ? {
|
||||||
|
'debian' => "python3-${dashboard}-dashboard",
|
||||||
|
default => "python-${dashboard}-dashboard"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'RedHat': {
|
||||||
|
$dashboard_package_name = "openstack-${dashboard}-ui"
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
fail("Unsupported OS family: ${::osfamily}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ensure_packages($dashboard_package_name, {
|
||||||
|
'ensure' => present,
|
||||||
|
'tag' => ['horizon-dashboard-package']
|
||||||
|
})
|
||||||
|
}
|
@ -29,6 +29,9 @@ class horizon::deps {
|
|||||||
-> anchor { 'horizon::compress::begin': }
|
-> anchor { 'horizon::compress::begin': }
|
||||||
-> Exec<| tag == 'horizon-compress' |>
|
-> Exec<| tag == 'horizon-compress' |>
|
||||||
~> anchor { 'horizon::compress::end': }
|
~> anchor { 'horizon::compress::end': }
|
||||||
|
-> anchor { 'horizon::dashboard::begin': }
|
||||||
|
-> Package<| tag == 'horizon-dashboard-package' |>
|
||||||
|
~> anchor { 'horizon::dashboard::end': }
|
||||||
-> anchor { 'horizon::service::begin': }
|
-> anchor { 'horizon::service::begin': }
|
||||||
-> Service<| title == 'httpd' |>
|
-> Service<| title == 'httpd' |>
|
||||||
~> anchor { 'horizon::service::end': }
|
~> anchor { 'horizon::service::end': }
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Added new resource horizon::dashboard which can be used to install
|
||||||
|
additional dashboards that is not shipped with the horizon packages.
|
||||||
|
Example would be install the heat-dashboard using horizon::dashboard { 'heat': }
|
@ -17,6 +17,8 @@ describe 'horizon class' do
|
|||||||
allowed_hosts => [$::fqdn, 'localhost'],
|
allowed_hosts => [$::fqdn, 'localhost'],
|
||||||
server_aliases => [$::fqdn, 'localhost'],
|
server_aliases => [$::fqdn, 'localhost'],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
horizon::dashboard { 'heat': }
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
# Run it twice and test for idempotency
|
# Run it twice and test for idempotency
|
||||||
|
89
spec/defines/horizon_dashboard_spec.rb
Normal file
89
spec/defines/horizon_dashboard_spec.rb
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2018 Binero
|
||||||
|
#
|
||||||
|
# Author: Tobias Urdin <tobias.urdin@binero.se>
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe 'horizon::dashboard' do
|
||||||
|
# NOTE(tobasco): Intentionally set to uppercase to make sure
|
||||||
|
# it's corrected to lowercase in the code.
|
||||||
|
let (:title) { 'HeAt' }
|
||||||
|
|
||||||
|
shared_examples 'horizon::dashboard' do
|
||||||
|
context 'with default' do
|
||||||
|
it {
|
||||||
|
is_expected.to contain_package(platform_params[:heat_dashboard_package_name]).with(
|
||||||
|
:ensure => 'present',
|
||||||
|
:tag => ['horizon-dashboard-package'])
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
shared_examples 'horizon::dashboard on Debian' do
|
||||||
|
before do
|
||||||
|
facts.merge!({:os_package_type => 'debian'})
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with default' do
|
||||||
|
it {
|
||||||
|
is_expected.to contain_package('python3-heat-dashboard').with(
|
||||||
|
:ensure => 'present',
|
||||||
|
:tag => ['horizon-dashboard-package'])
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
shared_examples 'horizon::dashboard on Ubuntu' do
|
||||||
|
context 'with default' do
|
||||||
|
it {
|
||||||
|
is_expected.to contain_package('python-heat-dashboard').with(
|
||||||
|
:ensure => 'present',
|
||||||
|
:tag => ['horizon-dashboard-package'])
|
||||||
|
}
|
||||||
|
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
|
||||||
|
|
||||||
|
let(:platform_params) do
|
||||||
|
case facts[:osfamily]
|
||||||
|
when 'Debian'
|
||||||
|
if facts[:os_package_type] == 'debian'
|
||||||
|
pkg = 'python3-heat-dashboard'
|
||||||
|
else
|
||||||
|
pkg = 'python-heat-dashboard'
|
||||||
|
end
|
||||||
|
{ :heat_dashboard_package_name => pkg }
|
||||||
|
when 'RedHat'
|
||||||
|
{ :heat_dashboard_package_name => 'openstack-heat-ui' }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
it_behaves_like 'horizon::dashboard'
|
||||||
|
|
||||||
|
if facts[:osfamily] == 'Debian'
|
||||||
|
it_behaves_like "horizon::dashboard on #{facts[:operatingsystem]}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user