From 65faf63162c842c6e4c3eefff49cd0d2ee9ce5f6 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Fri, 29 Nov 2013 21:58:27 +0100 Subject: [PATCH] API, Conductor, Drivers, Specs Signed-off-by: Emilien Macchi --- README.md | 4 + examples/ironic.pp | 25 ++++ .../provider/ironic_config/ini_setting.rb | 7 +- lib/puppet/type/ironic_config.rb | 26 +++- manifests/api.pp | 83 ++++++++++++ manifests/conductor.pp | 68 ++++++++++ manifests/drivers/ipmi.pp | 37 ++++++ manifests/drivers/pxe.pp | 125 ++++++++++++++++++ manifests/init.pp | 4 +- manifests/params.pp | 2 +- spec/classes/ironic_api_spec.rb | 106 +++++++++++++++ spec/classes/ironic_conductor_spec.rb | 98 ++++++++++++++ spec/classes/ironic_drivers_ipmi_spec.rb | 69 ++++++++++ spec/classes/ironic_drivers_pxe_spec.rb | 101 ++++++++++++++ 14 files changed, 751 insertions(+), 4 deletions(-) create mode 100644 examples/ironic.pp create mode 100644 manifests/api.pp create mode 100644 manifests/conductor.pp create mode 100644 manifests/drivers/ipmi.pp create mode 100644 manifests/drivers/pxe.pp create mode 100644 spec/classes/ironic_api_spec.rb create mode 100644 spec/classes/ironic_conductor_spec.rb create mode 100644 spec/classes/ironic_drivers_ipmi_spec.rb create mode 100644 spec/classes/ironic_drivers_pxe_spec.rb diff --git a/README.md b/README.md index 6dcc4707..fdb8636c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ puppet-ironic (Work in progress) =================================== +ToDo: +- init.pp + init unit tests +- move to Stackforge + #### Table of Contents 1. [Overview - What is the ironic module?](#overview) diff --git a/examples/ironic.pp b/examples/ironic.pp new file mode 100644 index 00000000..099a7a56 --- /dev/null +++ b/examples/ironic.pp @@ -0,0 +1,25 @@ +# +# Copyright (C) 2013 eNovance SAS +# +# Author: Emilien Macchi +# +# 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. +# +# Deploy Ironic on a single node +# + +class { 'ironic': } +class { 'ironic::api': } +class { 'ironic::conductor': } +class { 'ironic::drivers::pxe': } +class { 'ironic::drivers::ipmi': } diff --git a/lib/puppet/provider/ironic_config/ini_setting.rb b/lib/puppet/provider/ironic_config/ini_setting.rb index 92ab9e20..28b819d1 100644 --- a/lib/puppet/provider/ironic_config/ini_setting.rb +++ b/lib/puppet/provider/ironic_config/ini_setting.rb @@ -15,8 +15,13 @@ Puppet::Type.type(:ironic_config).provide( '=' end - def file_path + def self.file_path '/etc/ironic/ironic.conf' end + # added for backwards compatibility with older versions of inifile + def file_path + self.class.file_path + end + end diff --git a/lib/puppet/type/ironic_config.rb b/lib/puppet/type/ironic_config.rb index e40e221d..c5ea8eb0 100644 --- a/lib/puppet/type/ironic_config.rb +++ b/lib/puppet/type/ironic_config.rb @@ -3,7 +3,7 @@ Puppet::Type.newtype(:ironic_config) do ensurable newparam(:name, :namevar => true) do - desc 'Section/setting name to manage from ironic.conf' + desc 'Section/setting name to manage from /etc/ironic/ironic.conf' newvalues(/\S+\/\S+/) end @@ -14,5 +14,29 @@ Puppet::Type.newtype(:ironic_config) do value.capitalize! if value =~ /^(true|false)$/i value end + + def is_to_s( currentvalue ) + if resource.secret? + return '[old secret redacted]' + else + return currentvalue + end + end + + def should_to_s( newvalue ) + if resource.secret? + return '[new secret redacted]' + else + return newvalue + end + end + end + + newparam(:secret, :boolean => true) do + desc 'Whether to hide the value from Puppet logs. Defaults to `false`.' + + newvalues(:true, :false) + + defaultto false end end diff --git a/manifests/api.pp b/manifests/api.pp new file mode 100644 index 00000000..c94242a2 --- /dev/null +++ b/manifests/api.pp @@ -0,0 +1,83 @@ +# +# Copyright (C) 2013 eNovance SAS +# +# Author: Emilien Macchi +# +# 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. + +# Configure the API service in Ironic +# +# === Parameters +# +# [*host_ip*] +# (optional) The listen IP for the Ironic API server. +# Should be an valid IP address +# Defaults to '0.0.0.0'. +# +# [*port*] +# (optional) The port for the Ironic API server. +# Should be an valid port +# Defaults to '0.0.0.0'. +# +# [*max_limit*] +# (optional) The maximum number of items returned in a single response +# from a collection resource. +# Should be an valid interger +# Defaults to '1000'. +# + +class ironic::api ( + $package_ensure = 'present', + $enabled = true, + $host_ip = '0.0.0.0', + $port = '6385', + $max_limit = '1000' +) { + + include ironic::params + + Ironic_config<||> ~> Service['ironic-api'] + + # Configure ironic.conf + ironic_config { + 'api/host_ip': value => $host_ip; + 'api/port': value => $port; + 'api/max_limit': value => $max_limit; + } + + # Install package + if $::ironic::params::api_package { + Package['ironic-api'] -> Service['ironic-api'] + Package['ironic-api'] -> Ironic_config<||> + package { 'ironic-api': + ensure => $package_ensure, + name => $::ironic::params::api_package, + } + } + + if $enabled { + $ensure = 'running' + } else { + $ensure = 'stopped' + } + + # Manage service + service { 'ironic-api': + ensure => $ensure, + name => $::ironic::params::api_service, + enable => $enabled, + hasstatus => true, + require => Class['api'], + } + +} diff --git a/manifests/conductor.pp b/manifests/conductor.pp new file mode 100644 index 00000000..c014b4c3 --- /dev/null +++ b/manifests/conductor.pp @@ -0,0 +1,68 @@ +# +# Copyright (C) 2013 eNovance SAS +# +# Author: Emilien Macchi +# +# 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. + +# Configure the conductor service in Ironic +# +# === Parameters +# +# [*max_time_interval*] +# (optional) Maximum time, in seconds, since the last check-in of a conductor. +# Should be an interger value +# Defaults to '120'. +# + +class ironic::conductor ( + $package_ensure = 'present', + $enabled = true, + $max_time_interval = '120' +) { + + include ironic::params + + Ironic_config<||> ~> Service['ironic-conductor'] + + # Configure ironic.conf + ironic_config { + 'conductor/max_time_interval': value => $max_time_interval; + } + + # Install package + if $::ironic::params::conductor_package { + Package['ironic-conductor'] -> Service['ironic-conductor'] + Package['ironic-conductor'] -> Ironic_config<||> + package { 'ironic-conductor': + ensure => $package_ensure, + name => $::ironic::params::conductor_package, + } + } + + if $enabled { + $ensure = 'running' + } else { + $ensure = 'stopped' + } + + # Manage service + service { 'ironic-conductor': + ensure => $ensure, + name => $::ironic::params::conductor_service, + enable => $enabled, + hasstatus => true, + require => Class['conductor'], + } + +} diff --git a/manifests/drivers/ipmi.pp b/manifests/drivers/ipmi.pp new file mode 100644 index 00000000..2baf03ee --- /dev/null +++ b/manifests/drivers/ipmi.pp @@ -0,0 +1,37 @@ +# +# Copyright (C) 2013 eNovance SAS +# +# Author: Emilien Macchi +# +# 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. + +# Configure the IPMI driver in Ironic +# +# === Parameters +# +# [*retry_timeout*] +# (optional) Maximum time in seconds to retry IPMI operations. +# Should be an interger value +# Defaults to '10'. +# + +class ironic::drivers::ipmi ( + $retry_timeout = '10' +) { + + # Configure ironic.conf + ironic_config { + 'ipmi/retry_timeout': value => $retry_timeout; + } + +} diff --git a/manifests/drivers/pxe.pp b/manifests/drivers/pxe.pp new file mode 100644 index 00000000..e532d0c0 --- /dev/null +++ b/manifests/drivers/pxe.pp @@ -0,0 +1,125 @@ +# +# Copyright (C) 2013 eNovance SAS +# +# Author: Emilien Macchi +# +# 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. + +# Configure the PXE driver in Ironic +# +# === Parameters +# +# [*deploy_kernel*] +# (optional) Default kernel image ID used in deployment phase. +# Should be an valid id +# Defaults to undef. +# +# [*deploy_ramdisk*] +# (optional) Default kernel image ID used in deployment phase. +# Should be an valid id +# Defaults to undef. +# +# [*pxe_append_params*] +# (optional) Additional append parameters for baremetal PXE boot. +# Should be valid pxe parameters +# Defaults to 'nofb nomodeset vga=normal'. +# +# [*pxe_config_template*] +# (optional) Template file for PXE configuration. +# Should be an valid template file +# Defaults to '$pybasedir/drivers/modules/pxe_config.template'. +# +# [*pxe_deploy_timeout*] +# (optional) Timeout for PXE deployments. +# Should be an valid integer +# Defaults to '0' for unlimited. +# +# [*pxe_config_template*] +# (optional) Template file for PXE configuration. +# Should be an valid template file +# Defaults to undef. +# +# [*pxe_config_template*] +# (optional) Template file for PXE configuration. +# Should be an valid template file +# Defaults to undef. +# +# [*pxe_config_template*] +# (optional) Template file for PXE configuration. +# Should be an valid template file +# Defaults to undef. +# +# [*tftp_server*] +# (optional) IP address of Ironic compute node's tftp server. +# Should be an valid IP address +# Defaults to '$my_ip'. +# +# [*tftp_root*] +# (optional) Ironic compute node's tftp root path. +# Should be an valid path +# Defaults to '/tftpboot'. +# +# [*images_path*] +# (optional) Directory where images are stored on disk. +# Should be an valid directory +# Defaults to '/tftpboot'. +# +# [*tftp_master_path*] +# (optional) Directory where master tftp images are stored on disk. +# Should be an valid directory +# Defaults to '/tftpboot/master_images'. +# +# [*instance_master_path*] +# (optional) Directory where master tftp images are stored on disk. +# Should be an valid directory +# Defaults to '/var/lib/ironic/master_images'. +# + +class ironic::drivers::pxe ( + $deploy_kernel = undef, + $deploy_ramdisk = undef, + $pxe_append_params = 'nofb nomodeset vga=normal', + $pxe_config_template = '$pybasedir/drivers/modules/pxe_config.template', + $pxe_deploy_timeout = '0', + $tftp_server = '$my_ip', + $tftp_root = '/tftpboot', + $images_path = '/var/lib/ironic/images/', + $tftp_master_path = '/tftpboot/master_images', + $instance_master_path = '/var/lib/ironic/master_images', +) { + + # Configure ironic.conf + ironic_config { + 'pxe/pxe_append_params': value => $pxe_append_params; + 'pxe/pxe_config_template': value => $pxe_config_template; + 'pxe/pxe_deploy_timeout': value => $pxe_deploy_timeout; + 'pxe/tftp_server': value => $tftp_server; + 'pxe/tftp_root': value => $tftp_root; + 'pxe/images_path': value => $images_path; + 'pxe/tftp_master_path': value => $tftp_master_path; + 'pxe/instance_master_path': value => $instance_master_path; + } + + if $deploy_kernel { + ironic_config { + 'pxe/deploy_kernel': value => $deploy_kernel; + } + } + + if $deploy_ramdisk { + ironic_config { + 'pxe/deploy_ramdisk': value => $deploy_ramdisk; + } + } + +} diff --git a/manifests/init.pp b/manifests/init.pp index 7af8a391..92631cec 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -14,8 +14,10 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. + +# Ironic # -# ironic +# === Parameters # class ironic ( diff --git a/manifests/params.pp b/manifests/params.pp index eb293042..a9dc9f5a 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -40,6 +40,6 @@ class ironic::params { default: { fail("Unsupported osfamily ${::osfamily}") } - } # Case $::osfamily + } } diff --git a/spec/classes/ironic_api_spec.rb b/spec/classes/ironic_api_spec.rb new file mode 100644 index 00000000..0d21c325 --- /dev/null +++ b/spec/classes/ironic_api_spec.rb @@ -0,0 +1,106 @@ +# +# Copyright (C) 2013 eNovance SAS +# +# Author: Emilien Macchi +# +# 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::api class +# + +require 'spec_helper' + +describe 'ironic::api' do + + let :default_params do + { :package_ensure => 'present', + :enabled => true, + :port => '6385', + :max_limit => '1000', + :host_ip => '0.0.0.0' } + end + + let :params do + {} + end + + shared_examples_for 'ironic api' do + let :p do + default_params.merge(params) + end + + it { should include_class('ironic::params') } + + it 'installs ironic api package' do + if platform_params.has_key?(:api_package) + should contain_package('ironic-api').with( + :name => platform_params[:api_package], + :ensure => p[:package_ensure] + ) + should contain_package('ironic-api').with_before(/Ironic_config\[.+\]/) + should contain_package('ironic-api').with_before(/Service\[ironic-api\]/) + end + end + + it 'ensure ironic api service is running' do + should contain_service('ironic-api').with('hasstatus' => true) + end + + it 'configures ironic.conf' do + should contain_ironic_config('api/port').with_value(p[:port]) + should contain_ironic_config('api/host_ip').with_value(p[:host_ip]) + should contain_ironic_config('api/max_limit').with_value(p[:max_limit]) + + end + + context 'when overriding parameters' do + before :each do + params.merge!(:port => '3430') + params.merge!(:host_ip => '127.0.0.1') + params.merge!(:max_limit => '10') + end + it 'should replace default parameter with new value' do + should contain_ironic_config('api/port').with_value(p[:port]) + should contain_ironic_config('api/host_ip').with_value(p[:host_ip]) + should contain_ironic_config('api/max_limit').with_value(p[:max_limit]) + end + end + + end + + context 'on Debian platforms' do + let :facts do + { :osfamily => 'Debian' } + end + + let :platform_params do + { :api_package => 'ironic-api', + :api_service => 'ironic-api' } + end + + it_configures 'ironic api' + end + + context 'on RedHat platforms' do + let :facts do + { :osfamily => 'RedHat' } + end + + let :platform_params do + { :api_service => 'ironic-api' } + end + + it_configures 'ironic api' + end + +end diff --git a/spec/classes/ironic_conductor_spec.rb b/spec/classes/ironic_conductor_spec.rb new file mode 100644 index 00000000..92b8b25f --- /dev/null +++ b/spec/classes/ironic_conductor_spec.rb @@ -0,0 +1,98 @@ +# +# Copyright (C) 2013 eNovance SAS +# +# Author: Emilien Macchi +# +# 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::conductor class +# + +require 'spec_helper' + +describe 'ironic::conductor' do + + let :default_params do + { :package_ensure => 'present', + :enabled => true, + :max_time_interval => '120' } + end + + let :params do + {} + end + + shared_examples_for 'ironic conductor' do + let :p do + default_params.merge(params) + end + + it { should include_class('ironic::params') } + + it 'installs ironic conductor package' do + if platform_params.has_key?(:conductor_package) + should contain_package('ironic-conductor').with( + :name => platform_params[:conductor_package], + :ensure => p[:package_ensure] + ) + should contain_package('ironic-conductor').with_before(/Ironic_config\[.+\]/) + should contain_package('ironic-conductor').with_before(/Service\[ironic-conductor\]/) + end + end + + it 'ensure ironic conductor service is running' do + should contain_service('ironic-conductor').with('hasstatus' => true) + end + + it 'configures ironic.conf' do + should contain_ironic_config('conductor/max_time_interval').with_value(p[:max_time_interval]) + + end + + context 'when overriding parameters' do + before :each do + params.merge!(:max_time_interval => '50') + end + it 'should replace default parameter with new value' do + should contain_ironic_config('conductor/max_time_interval').with_value(p[:max_time_interval]) + end + end + + end + + context 'on Debian platforms' do + let :facts do + { :osfamily => 'Debian' } + end + + let :platform_params do + { :conductor_package => 'ironic-conductor', + :conductor_service => 'ironic-conductor' } + end + + it_configures 'ironic conductor' + end + + context 'on RedHat platforms' do + let :facts do + { :osfamily => 'RedHat' } + end + + let :platform_params do + { :conductor_service => 'ironic-conductor' } + end + + it_configures 'ironic conductor' + end + +end diff --git a/spec/classes/ironic_drivers_ipmi_spec.rb b/spec/classes/ironic_drivers_ipmi_spec.rb new file mode 100644 index 00000000..b4b072ac --- /dev/null +++ b/spec/classes/ironic_drivers_ipmi_spec.rb @@ -0,0 +1,69 @@ +# +# Copyright (C) 2013 eNovance SAS +# +# Author: Emilien Macchi +# +# 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::drivers::ipmi class +# + +require 'spec_helper' + +describe 'ironic::drivers::ipmi' do + + let :default_params do + {:retry_timeout => '10' } + end + + let :params do + {} + end + + shared_examples_for 'ironic ipmi driver' do + let :p do + default_params.merge(params) + end + + it 'configures ironic.conf' do + should contain_ironic_config('ipmi/retry_timeout').with_value(p[:retry_timeout]) + end + + context 'when overriding parameters' do + before :each do + params.merge!(:retry_timeout => '50') + end + it 'should replace default parameter with new value' do + should contain_ironic_config('ipmi/retry_timeout').with_value(p[:retry_timeout]) + end + end + + end + + context 'on Debian platforms' do + let :facts do + { :osfamily => 'Debian' } + end + + it_configures 'ironic ipmi driver' + end + + context 'on RedHat platforms' do + let :facts do + { :osfamily => 'RedHat' } + end + + it_configures 'ironic ipmi driver' + end + +end diff --git a/spec/classes/ironic_drivers_pxe_spec.rb b/spec/classes/ironic_drivers_pxe_spec.rb new file mode 100644 index 00000000..6975f1f4 --- /dev/null +++ b/spec/classes/ironic_drivers_pxe_spec.rb @@ -0,0 +1,101 @@ +# +# Copyright (C) 2013 eNovance SAS +# +# Author: Emilien Macchi +# +# 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::drivers::pxe class +# + +require 'spec_helper' + +describe 'ironic::drivers::pxe' do + + let :default_params do + {:pxe_append_params => 'nofb nomodeset vga=normal', + :pxe_config_template => '$pybasedir/drivers/modules/pxe_config.template', + :pxe_deploy_timeout => '0', + :tftp_server => '$my_ip', + :tftp_root => '/tftpboot', + :images_path => '/var/lib/ironic/images/', + :tftp_master_path => '/tftpboot/master_images', + :instance_master_path => '/var/lib/ironic/master_images'} + end + + let :params do + {} + end + + shared_examples_for 'ironic pxe driver' do + let :p do + default_params.merge(params) + end + + it 'configures ironic.conf' do + should contain_ironic_config('pxe/pxe_append_params').with_value(p[:pxe_append_params]) + should contain_ironic_config('pxe/pxe_config_template').with_value(p[:pxe_config_template]) + should contain_ironic_config('pxe/pxe_deploy_timeout').with_value(p[:pxe_deploy_timeout]) + should contain_ironic_config('pxe/tftp_server').with_value(p[:tftp_server]) + should contain_ironic_config('pxe/tftp_root').with_value(p[:tftp_root]) + should contain_ironic_config('pxe/images_path').with_value(p[:images_path]) + should contain_ironic_config('pxe/tftp_master_path').with_value(p[:tftp_master_path]) + should contain_ironic_config('pxe/instance_master_path').with_value(p[:instance_master_path]) + end + + context 'when overriding parameters' do + before :each do + params.merge!(:deploy_kernel => 'foo') + params.merge!(:deploy_ramdisk => 'bar') + params.merge!(:pxe_append_params => 'foo') + params.merge!(:pxe_config_template => 'bar') + params.merge!(:pxe_deploy_timeout => '40') + params.merge!(:tftp_server => '192.168.0.1') + params.merge!(:tftp_root => '/mnt/ftp') + params.merge!(:images_path => '/mnt/images') + params.merge!(:tftp_master_path => '/mnt/master_images') + params.merge!(:instance_master_path => '/mnt/ironic/master_images') + end + it 'should replace default parameter with new value' do + should contain_ironic_config('pxe/deploy_kernel').with_value(p[:deploy_kernel]) + should contain_ironic_config('pxe/deploy_ramdisk').with_value(p[:deploy_ramdisk]) + should contain_ironic_config('pxe/pxe_append_params').with_value(p[:pxe_append_params]) + should contain_ironic_config('pxe/pxe_config_template').with_value(p[:pxe_config_template]) + should contain_ironic_config('pxe/pxe_deploy_timeout').with_value(p[:pxe_deploy_timeout]) + should contain_ironic_config('pxe/tftp_server').with_value(p[:tftp_server]) + should contain_ironic_config('pxe/tftp_root').with_value(p[:tftp_root]) + should contain_ironic_config('pxe/images_path').with_value(p[:images_path]) + should contain_ironic_config('pxe/tftp_master_path').with_value(p[:tftp_master_path]) + should contain_ironic_config('pxe/instance_master_path').with_value(p[:instance_master_path]) + end + end + + end + + context 'on Debian platforms' do + let :facts do + { :osfamily => 'Debian' } + end + + it_configures 'ironic pxe driver' + end + + context 'on RedHat platforms' do + let :facts do + { :osfamily => 'RedHat' } + end + + it_configures 'ironic pxe driver' + end + +end