Add a deps file to handle dependencies

Adds the deps.pp file to handle all the the
dependency chains and anchors.

Change-Id: I6e2778512787b0b7a3011dc39dd5921dfde065f2
This commit is contained in:
Tobias Urdin 2018-04-27 16:44:06 +02:00
parent b0f6bde9a6
commit 8857bfe66f
4 changed files with 50 additions and 8 deletions

39
manifests/deps.pp Normal file
View File

@ -0,0 +1,39 @@
#
# 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.
#
# == Class: horizon::deps
#
# Horizon anchors and dependency management
#
class horizon::deps {
anchor { 'horizon::install::begin': }
-> Package<| tag == 'horizon-package' |>
~> anchor { 'horizon::install::end': }
-> anchor { 'horizon::config::begin': }
~> anchor { 'horizon::config::end': }
-> anchor { 'horizon::compress::begin': }
-> Exec<| tag == 'horizon-compress' |>
~> anchor { 'horizon::compress::end': }
-> anchor { 'horizon::service::begin': }
-> Service<| title == 'httpd' |>
~> anchor { 'horizon::service::end': }
# Installation or config changes will always restart services.
Anchor['horizon::install::end'] ~> Anchor['horizon::service::begin']
Anchor['horizon::config::end'] ~> Anchor['horizon::service::begin']
}

View File

@ -526,6 +526,8 @@ class horizon(
$tuskar_ui_deployment_mode = undef,
) inherits ::horizon::params {
include ::horizon::deps
$hypervisor_defaults = {
'can_set_mount_point' => true,
'can_set_password' => false,
@ -612,7 +614,7 @@ settings_local.py and parameter server_aliases for setting ServerAlias directive
if $cache_backend =~ /MemcachedCache/ {
ensure_resources('package', { 'python-memcache' =>
{ name => $::horizon::params::memcache_package,
tag => ['openstack']}})
tag => ['openstack', 'horizon-package']}})
}
package { 'horizon':
@ -625,7 +627,7 @@ settings_local.py and parameter server_aliases for setting ServerAlias directive
mode => '0640',
owner => $::horizon::params::wsgi_user,
group => $::horizon::params::wsgi_group,
require => Package['horizon'],
require => Anchor['horizon::config::begin'],
}
concat::fragment { 'local_settings.py':
@ -637,13 +639,13 @@ settings_local.py and parameter server_aliases for setting ServerAlias directive
exec { 'refresh_horizon_django_cache':
command => "${::horizon::params::manage_py} collectstatic --noinput --clear",
refreshonly => true,
require => Package['horizon'],
tag => ['horizon-compress'],
}
exec { 'refresh_horizon_django_compress':
command => "${::horizon::params::manage_py} compress --force",
refreshonly => true,
require => Package['horizon'],
tag => ['horizon-compress'],
}
if $compress_offline {

View File

@ -115,6 +115,7 @@ class horizon::wsgi::apache (
$root_path = "${::horizon::params::static_path}/openstack-dashboard",
) inherits horizon::params {
include ::horizon::deps
include ::apache
if $fqdn {
@ -138,7 +139,7 @@ class horizon::wsgi::apache (
# - ${priority}-${vhost_conf_name}.conf
# - ${priority}-${vhost_ssl_conf_name}.conf
#",
require => Package['horizon'],
require => Anchor['horizon::config::begin'],
}
@ -190,7 +191,7 @@ class horizon::wsgi::apache (
group => $unix_group,
before => Service['httpd'],
mode => '0751',
require => Package['horizon'],
require => Anchor['horizon::config::begin'],
}
file { "${::horizon::params::logdir}/horizon.log":
@ -199,7 +200,7 @@ class horizon::wsgi::apache (
group => $unix_group,
before => Service['httpd'],
mode => '0640',
require => [ File[$::horizon::params::logdir], Package['horizon'] ],
require => File[$::horizon::params::logdir],
}
$script_url = $root_url ? {

View File

@ -252,7 +252,7 @@ describe 'horizon' do
it {
is_expected.to contain_package('python-memcache').with(
:tag => ['openstack']
:tag => ['openstack', 'horizon-package']
)
}
end