Browse Source

Add support for management of osc-placement package

This patch introduces a new class, placement::client, so that operators
can manage pythonN-osc-placement package.

Change-Id: I76eb105ca532e427e4f48f84ccb5c15532456fda
tags/4.2.0
Takashi Kajinami 3 weeks ago
parent
commit
0a59d6767a
5 changed files with 93 additions and 0 deletions
  1. +24
    -0
      manifests/client.pp
  2. +11
    -0
      manifests/deps.pp
  3. +2
    -0
      manifests/params.pp
  4. +5
    -0
      releasenotes/notes/osc-placement-c9df6c2ce40537d0.yaml
  5. +51
    -0
      spec/classes/placement_client_spec.rb

+ 24
- 0
manifests/client.pp View File

@@ -0,0 +1,24 @@
# == Class placement::client
#
# installs placement client
#
# === Parameters:
#
# [*ensure*]
# (optional) The state for the placement client package
# Defaults to 'present'
#
class placement::client(
$ensure = 'present'
) {
include placement::deps
include placement::params

package { 'python-osc-placement':
ensure => $ensure,
name => $::placement::params::osc_package_name,
tag => ['openstack', 'placement-support-package'],
}

include 'openstacklib::openstackclient'
}

+ 11
- 0
manifests/deps.pp View File

@@ -24,6 +24,17 @@ class placement::deps {
~> Service<| tag == 'placement-service' |>
~> anchor { 'placement::service::end': }

# Support packages need to be installed in the install phase, but we don't
# put them in the chain above because we don't want any false dependencies
# between packages with the placement-package tag and the placement-support-package
# tag. Note: the package resources here will have a 'before' relationship on
# the placement::install::end anchor. The line between placement-support-package
# and placement-package should be whether or not placement services would
# need to be restarted if the package state was changed.
Anchor['placement::install::begin']
-> Package<| tag == 'placement-support-package'|>
-> Anchor['placement::install::end']

# all db settings should be applied and all packages should be installed
# before dbsync starts
Oslo::Db<||> -> Anchor['placement::dbsync::begin']


+ 2
- 0
manifests/params.pp View File

@@ -19,6 +19,7 @@ class placement::params {
$package_name = 'openstack-placement-api'
$common_package_name = 'openstack-placement-common'
$python_package_name = "python${pyvers_real}-placement"
$osc_package_name = "python${pyvers_real}-osc-placement"
$service_name = false
$public_url = 'http://127.0.0.1/placement'
$internal_url = 'http://127.0.0.1/placement'
@@ -31,6 +32,7 @@ class placement::params {
$package_name = 'placement-api'
$common_package_name = 'placement-common'
$python_package_name = "python${pyvers_real}-placement"
$osc_package_name = "python${pyvers_real}-osc-placement"
case $::os_package_type {
'debian': {
$service_name = 'placement-api'


+ 5
- 0
releasenotes/notes/osc-placement-c9df6c2ce40537d0.yaml View File

@@ -0,0 +1,5 @@
---
features:
- |
The new ``placement::client`` class has been added to manage osc-placement
package.

+ 51
- 0
spec/classes/placement_client_spec.rb View File

@@ -0,0 +1,51 @@
require 'spec_helper'

describe 'placement::client' do

shared_examples_for 'placement client' do

it { is_expected.to contain_class('placement::deps') }
it { is_expected.to contain_class('placement::params') }

it 'installs placement client package' do
is_expected.to contain_package('python-osc-placement').with(
:ensure => 'present',
:name => platform_params[:client_package_name],
:tag => ['openstack', 'placement-support-package']
)
end

it { is_expected.to contain_class('openstacklib::openstackclient') }
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'
{ :client_package_name => 'python3-osc-placement' }
when 'RedHat'
if facts[:operatingsystem] == 'Fedora'
{ :client_package_name => 'python3-osc-placement' }
else
if facts[:operatingsystemmajrelease] > '7'
{ :client_package_name => 'python3-osc-placement' }
else
{ :client_package_name => 'python-osc-placement' }
end
end
end
end

it_behaves_like 'placement client'
end
end

end


Loading…
Cancel
Save