From fc2adf7fb8700769dca6fba3c9d650761cb5be2d Mon Sep 17 00:00:00 2001 From: Xingchao Yu Date: Tue, 25 Apr 2017 16:36:11 +0800 Subject: [PATCH] Add support of ironic-inspector-client Change-Id: Ibe76a9535f6fab9cbd20abed55318047a6e83152 --- manifests/inspector/client.pp | 24 ++++++++ manifests/params.pp | 1 + ...ector-client-support-170474ec8e08046c.yaml | 3 + spec/classes/ironic_inspector_client_spec.rb | 56 +++++++++++++++++++ 4 files changed, 84 insertions(+) create mode 100644 manifests/inspector/client.pp create mode 100644 releasenotes/notes/add-inspector-client-support-170474ec8e08046c.yaml create mode 100644 spec/classes/ironic_inspector_client_spec.rb diff --git a/manifests/inspector/client.pp b/manifests/inspector/client.pp new file mode 100644 index 00000000..289cfa8e --- /dev/null +++ b/manifests/inspector/client.pp @@ -0,0 +1,24 @@ +# Class ironic::inspector::client +# +# Manages the ironic inspector client package on systems +# +# === Parameters: +# +# [*package_ensure*] +# (optional) The state of the package +# Defaults to present +# +class ironic::inspector::client ( + $package_ensure = present +) { + + include ::ironic::deps + include ::ironic::params + + package { 'python-ironic-inspector-client': + ensure => $package_ensure, + name => $::ironic::params::inspector_client_package, + tag => ['openstack', 'ironic-support-package'], + } + +} diff --git a/manifests/params.pp b/manifests/params.pp index bb20f493..e1b2c172 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -27,6 +27,7 @@ class ironic::params { $inspector_dbsync_command = 'ironic-inspector-dbsync --config-file /etc/ironic-inspector/inspector.conf upgrade' $client_package = 'python-ironicclient' + $inspector_client_package = 'python-ironic-inspector-client' $lib_package_name = 'python-ironic-lib' case $::osfamily { diff --git a/releasenotes/notes/add-inspector-client-support-170474ec8e08046c.yaml b/releasenotes/notes/add-inspector-client-support-170474ec8e08046c.yaml new file mode 100644 index 00000000..d1679b36 --- /dev/null +++ b/releasenotes/notes/add-inspector-client-support-170474ec8e08046c.yaml @@ -0,0 +1,3 @@ +--- +features: + - Add support of ironic-inspector-client. diff --git a/spec/classes/ironic_inspector_client_spec.rb b/spec/classes/ironic_inspector_client_spec.rb new file mode 100644 index 00000000..781149be --- /dev/null +++ b/spec/classes/ironic_inspector_client_spec.rb @@ -0,0 +1,56 @@ +# 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. +# +# Unit tests for ironic::inspector::client +# +require 'spec_helper' + +describe 'ironic::inspector::client' do + + let :params do + {} + end + + let :default_params do + { :package_ensure => 'present' } + end + + shared_examples_for 'inspector client' do + let :p do + default_params.merge(params) + end + + it { is_expected.to contain_class('ironic::deps') } + it { is_expected.to contain_class('ironic::params') } + + it 'installs ironic inspector client package' do + is_expected.to contain_package('python-ironic-inspector-client').with( + :ensure => 'present', + :name => 'python-ironic-inspector-client', + :tag => ['openstack', 'ironic-support-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 + + it_configures 'inspector client' + end + end + +end