From 3ef3fb14198c3bba01c2ffc0d4fab1742a4671a7 Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Fri, 26 Aug 2016 12:08:53 +0200 Subject: [PATCH] Move parameters from ironic::drivers::deploy to ironic::conductor Both http_url and http_root are no longer specific to the PXE driver, they can be used by several drivers for different purpose. Also ironic::drivers::deploy is a confusing name: there is no "deploy driver" in Ironic, we have deploy interface, with several implementations. This change deprecates ironic::drivers::deploy and moves its parameters to ironic::conductor where they actually belong. Change-Id: I513d826e3af2dd3b9e754f8845e3a6602b142550 --- manifests/conductor.pp | 16 ++++++ manifests/drivers/deploy.pp | 22 ++++---- .../drivers-deploy-e97b41f507b402fb.yaml | 5 ++ spec/acceptance/ironic_wsgi_apache_spec.rb | 1 - spec/classes/ironic_conductor_spec.rb | 6 +++ spec/classes/ironic_drivers_deploy_spec.rb | 53 ------------------- 6 files changed, 40 insertions(+), 63 deletions(-) create mode 100644 releasenotes/notes/drivers-deploy-e97b41f507b402fb.yaml delete mode 100644 spec/classes/ironic_drivers_deploy_spec.rb diff --git a/manifests/conductor.pp b/manifests/conductor.pp index b47faa91..6e209871 100644 --- a/manifests/conductor.pp +++ b/manifests/conductor.pp @@ -38,6 +38,14 @@ # state (False). # Defaults to true. # +# [*http_url*] +# (optional) ironic-conductor node's HTTP server URL. +# Defaults to $::os_service_default +# +# [*http_root*] +# (optional) ironic-conductor node's HTTP root path. +# Defaults to $::os_service_default +# # [*automated_clean*] # (optional) Whether to enable automated cleaning on nodes. # Defaults to $::os_service_default @@ -79,6 +87,8 @@ class ironic::conductor ( $enabled = true, $max_time_interval = '120', $force_power_state_during_sync = true, + $http_url = $::os_service_default, + $http_root = $::os_service_default, $automated_clean = $::os_service_default, $swift_account = $::os_service_default, $cleaning_network_uuid = $::os_service_default, @@ -89,6 +99,7 @@ class ironic::conductor ( ) { include ::ironic::params + include ::ironic::drivers::deploy Ironic_config<||> ~> Service['ironic-conductor'] @@ -115,6 +126,9 @@ class ironic::conductor ( } } + $http_url_real = pick($::ironic::drivers::deploy::http_url, $http_url) + $http_root_real = pick($::ironic::drivers::deploy::http_root, $http_root) + # Configure ironic.conf ironic_config { 'conductor/max_time_interval': value => $max_time_interval; @@ -124,6 +138,8 @@ class ironic::conductor ( 'glance/swift_account': value => $swift_account; 'neutron/cleaning_network_uuid': value => $cleaning_network_uuid; 'neutron/provisioning_network_uuid': value => $provisioning_network_uuid; + 'deploy/http_url': value => $http_url_real; + 'deploy/http_root': value => $http_root_real; 'deploy/erase_devices_priority': value => $erase_devices_priority; 'deploy/erase_devices_metadata_priority': value => $erase_devices_metadata_priority; 'deploy/continue_if_disk_secure_erase_fails': value => $continue_if_disk_secure_erase_fails; diff --git a/manifests/drivers/deploy.pp b/manifests/drivers/deploy.pp index 4758d671..ccdd2571 100644 --- a/manifests/drivers/deploy.pp +++ b/manifests/drivers/deploy.pp @@ -11,26 +11,30 @@ # under the License. # Configure the deploy_utils in Ironic +# This manifest is deprecated, use ironic::conductor directly instead. # # === Parameters # # [*http_url*] -# (optional) ironic-conductor node's HTTP server URL. -# Defaults to $::os_service_default +# (optional) ironic-conductor node's HTTP server URL. DEPRECATED. +# Defaults to undef # # [*http_root*] -# (optional) ironic-conductor node's HTTP root path. -# Defaults to $::os_service_default +# (optional) ironic-conductor node's HTTP root path. DEPRECATED. +# Defaults to undef # class ironic::drivers::deploy ( - $http_url = $::os_service_default, - $http_root = $::os_service_default, + $http_url = undef, + $http_root = undef, ) { - ironic_config { - 'deploy/http_url': value => $http_url; - 'deploy/http_root': value => $http_root; + if $http_url { + warning('http_url is deprecated and will be removed after Newton cycle.') + } + + if $http_root { + warning('http_root is deprecated and will be removed after Newton cycle.') } } diff --git a/releasenotes/notes/drivers-deploy-e97b41f507b402fb.yaml b/releasenotes/notes/drivers-deploy-e97b41f507b402fb.yaml new file mode 100644 index 00000000..9c7a7be5 --- /dev/null +++ b/releasenotes/notes/drivers-deploy-e97b41f507b402fb.yaml @@ -0,0 +1,5 @@ +--- +deprecations: + - | + Deprecated ``ironic::drivers::deploy`` manifest, use parameters from + ``ironic::conductor`` instead. diff --git a/spec/acceptance/ironic_wsgi_apache_spec.rb b/spec/acceptance/ironic_wsgi_apache_spec.rb index 1163b5f1..580bb0e7 100644 --- a/spec/acceptance/ironic_wsgi_apache_spec.rb +++ b/spec/acceptance/ironic_wsgi_apache_spec.rb @@ -59,7 +59,6 @@ describe 'basic ironic' do ssl => false, } class { '::ironic::drivers::ipmi': } - class { '::ironic::drivers::deploy': } # Ironic inspector resources case $::osfamily { diff --git a/spec/classes/ironic_conductor_spec.rb b/spec/classes/ironic_conductor_spec.rb index 0b5ddc66..2936fb97 100644 --- a/spec/classes/ironic_conductor_spec.rb +++ b/spec/classes/ironic_conductor_spec.rb @@ -67,6 +67,8 @@ describe 'ironic::conductor' do is_expected.to contain_ironic_config('neutron/cleaning_network_uuid').with(:value => '') is_expected.to contain_ironic_config('neutron/provisioning_network_uuid').with(:value => '') is_expected.to contain_ironic_config('deploy/continue_if_disk_secure_erase_fails').with(:value => '') + is_expected.to contain_ironic_config('deploy/http_url').with(:value => '') + is_expected.to contain_ironic_config('deploy/http_root').with(:value => '') end context 'when overriding parameters' do @@ -80,6 +82,8 @@ describe 'ironic::conductor' do :api_url => 'https://127.0.0.1:6385', :provisioning_network_uuid => '00000000-0000-0000-0000-000000000000', :cleaning_disk_erase => 'metadata', + :http_url => 'http://host:port', + :http_root => '/src/www', ) end it 'should replace default parameter with new value' do @@ -92,6 +96,8 @@ describe 'ironic::conductor' do is_expected.to contain_ironic_config('neutron/provisioning_network_uuid').with_value('00000000-0000-0000-0000-000000000000') is_expected.to contain_ironic_config('deploy/erase_devices_priority').with_value(0) is_expected.to contain_ironic_config('deploy/erase_devices_metadata_priority').with_value(10) + is_expected.to contain_ironic_config('deploy/http_url').with_value(p[:http_url]) + is_expected.to contain_ironic_config('deploy/http_root').with_value(p[:http_root]) end end diff --git a/spec/classes/ironic_drivers_deploy_spec.rb b/spec/classes/ironic_drivers_deploy_spec.rb deleted file mode 100644 index b4262b08..00000000 --- a/spec/classes/ironic_drivers_deploy_spec.rb +++ /dev/null @@ -1,53 +0,0 @@ -# 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::deploy class -# - -require 'spec_helper' - -describe 'ironic::drivers::deploy' do - - shared_examples_for 'ironic deploy utils' do - - context 'with default parameters' do - it { is_expected.to contain_ironic_config('deploy/http_url').with_value('') } - it { is_expected.to contain_ironic_config('deploy/http_root').with_value('') } - end - - context 'when overriding parameters' do - let :params do - { :http_url => 'http://foo', - :http_root => '/httpboot' } - end - - it { is_expected.to contain_ironic_config('deploy/http_url').with_value('http://foo') } - it { is_expected.to contain_ironic_config('deploy/http_root').with_value('/httpboot') } - 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({ - :processorcount => 8, - :concat_basedir => '/var/lib/puppet/concat' - })) - end - it_configures 'ironic deploy utils' - end - end - -end