Move glance paremeters related to temporary URLs to ironic::glance

This was missed when ironic::glance was created. These paremeters related
to how glance generates temporary URLs for images in swift.

Change-Id: Ia188f9b6618ef8a13d874729a9b556102cda57f0
Related-Bug: #1661250
This commit is contained in:
Dmitry Tantsur 2017-02-07 16:49:51 +01:00
parent a71d896cfc
commit 15d216c6b9
5 changed files with 90 additions and 54 deletions

View File

@ -54,21 +54,6 @@
# (optional) Whether to enable automated cleaning on nodes.
# Defaults to $::os_service_default
#
# [*swift_account*]
# (optional) The account that Glance uses to communicate with Swift.
# The format is "AUTH_uuid"
# Defaults to $::os_service_default
#
# [*swift_temp_url_key*]
# (optional) The secret token given to Swift to allow temporary URL
# downloads. Required for several drivers (e.g. agent_ipmitool).
# Defaults to $::os_service_default
#
# [*swift_temp_url_duration*]
# (optional) The length of time in seconds that the temporary URL will be
# valid for.
# Defaults to $::os_service_default
#
# [*cleaning_network*]
# (optional) UUID or name of the network to create Neutron ports on, when
# booting to a ramdisk for cleaning using Neutron DHCP.
@ -121,6 +106,21 @@
# (optional) Use provisioning_network instead.
# Defaults to undef
#
# [*swift_account*]
# (optional) The account that Glance uses to communicate with Swift.
# The format is "AUTH_uuid"
# Defaults to $::os_service_default
#
# [*swift_temp_url_key*]
# (optional) The secret token given to Swift to allow temporary URL
# downloads. Required for several drivers (e.g. agent_ipmitool).
# Defaults to $::os_service_default
#
# [*swift_temp_url_duration*]
# (optional) The length of time in seconds that the temporary URL will be
# valid for.
# Defaults to $::os_service_default
#
class ironic::conductor (
$package_ensure = 'present',
$enabled = true,
@ -130,9 +130,6 @@ class ironic::conductor (
$http_url = $::os_service_default,
$http_root = $::os_service_default,
$automated_clean = $::os_service_default,
$swift_account = $::os_service_default,
$swift_temp_url_key = $::os_service_default,
$swift_temp_url_duration = $::os_service_default,
$cleaning_network = $::os_service_default,
$cleaning_disk_erase = undef,
$continue_if_disk_secure_erase_fails = $::os_service_default,
@ -144,12 +141,18 @@ class ironic::conductor (
# DEPRECATED
$cleaning_network_uuid = undef,
$provisioning_network_uuid = undef,
$swift_account = undef,
$swift_temp_url_key = undef,
$swift_temp_url_duration = undef,
) {
include ::ironic::deps
include ::ironic::params
include ::ironic::drivers::deploy
# For backward compatibility
include ::ironic::glance
$enabled_drivers_real = pick($::ironic::enabled_drivers, $enabled_drivers)
if $cleaning_network_uuid {
@ -161,6 +164,11 @@ class ironic::conductor (
$cleaning_network_real = pick($cleaning_network_uuid, $cleaning_network)
$provisioning_network_real = pick($provisioning_network_uuid, $provisioning_network)
if $swift_account or $swift_temp_url_key or $swift_temp_url_duration {
warning("swift_account, swift_temp_url_key and swift_temp_url_duration were \
moved to ironic::glance manifest")
}
validate_array($enabled_drivers_real)
# NOTE(dtantsur): all in-tree drivers are IPA-based, so it won't hurt
@ -211,9 +219,6 @@ class ironic::conductor (
'conductor/force_power_state_during_sync': value => $force_power_state_during_sync;
'conductor/automated_clean': value => $automated_clean;
'conductor/api_url': value => $api_url;
'glance/swift_account': value => $swift_account;
'glance/swift_temp_url_key': value => $swift_temp_url_key, secret => true;
'glance/swift_temp_url_duration': value => $swift_temp_url_duration;
'neutron/cleaning_network': value => $cleaning_network_real;
'neutron/provisioning_network': value => $provisioning_network_real;
'deploy/http_url': value => $http_url_real;

View File

@ -45,15 +45,33 @@
# (optional) Allow to perform insecure SSL (https) requests to glance.
# Defaults to $::os_service_default
#
# [*swift_account*]
# (optional) The account that Glance uses to communicate with Swift.
# The format is "AUTH_uuid"
# Defaults to $::os_service_default
#
# [*swift_temp_url_key*]
# (optional) The secret token given to Swift to allow temporary URL
# downloads. Required for several drivers (e.g. agent_ipmitool).
# Defaults to $::os_service_default
#
# [*swift_temp_url_duration*]
# (optional) The length of time in seconds that the temporary URL will be
# valid for.
# Defaults to $::os_service_default
#
class ironic::glance (
$auth_type = 'password',
$auth_url = $::os_service_default,
$project_name = 'services',
$username = 'ironic',
$password = $::os_service_default,
$api_servers = $::os_service_default,
$num_retries = $::os_service_default,
$api_insecure = $::os_service_default,
$auth_type = 'password',
$auth_url = $::os_service_default,
$project_name = 'services',
$username = 'ironic',
$password = $::os_service_default,
$api_servers = $::os_service_default,
$num_retries = $::os_service_default,
$api_insecure = $::os_service_default,
$swift_account = $::os_service_default,
$swift_temp_url_key = $::os_service_default,
$swift_temp_url_duration = $::os_service_default,
) {
$api_servers_real = pick($::ironic::glance_api_servers, $api_servers)
@ -66,14 +84,21 @@ class ironic::glance (
$num_retries_real = pick($::ironic::glance_num_retries, $num_retries)
$api_insecure_real = pick($::ironic::glance_api_insecure, $api_insecure)
$swift_account_real = pick($::ironic::conductor::swift_account, $swift_account)
$swift_temp_url_key_real = pick($::ironic::conductor::swift_temp_url_key, $swift_temp_url_key)
$swift_temp_url_duration_real = pick($::ironic::conductor::swift_temp_url_duration, $swift_temp_url_duration)
ironic_config {
'glance/auth_type': value => $auth_type;
'glance/username': value => $username;
'glance/password': value => $password, secret => true;
'glance/auth_url': value => $auth_url;
'glance/project_name': value => $project_name;
'glance/glance_api_servers': value => $api_servers_converted;
'glance/glance_num_retries': value => $num_retries_real;
'glance/glance_api_insecure': value => $api_insecure_real;
'glance/auth_type': value => $auth_type;
'glance/username': value => $username;
'glance/password': value => $password, secret => true;
'glance/auth_url': value => $auth_url;
'glance/project_name': value => $project_name;
'glance/glance_api_servers': value => $api_servers_converted;
'glance/glance_num_retries': value => $num_retries_real;
'glance/glance_api_insecure': value => $api_insecure_real;
'glance/swift_account': value => $swift_account_real;
'glance/swift_temp_url_key': value => $swift_temp_url_key_real, secret => true;
'glance/swift_temp_url_duration': value => $swift_temp_url_duration_real;
}
}

View File

@ -0,0 +1,6 @@
---
deprecations:
- |
Parameters "swift_account", "swift_temp_url_key" and
"swift_temp_url_duration" were moved from "ironic::conductor" to
"ironic::glance" manifest.

View File

@ -67,9 +67,6 @@ describe 'ironic::conductor' do
is_expected.to contain_ironic_config('conductor/force_power_state_during_sync').with_value(p[:force_power_state_during_sync])
is_expected.to contain_ironic_config('conductor/automated_clean').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('conductor/api_url').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('glance/swift_account').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('glance/swift_temp_url_key').with(:value => '<SERVICE DEFAULT>').with_secret(true)
is_expected.to contain_ironic_config('glance/swift_temp_url_duration').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('neutron/cleaning_network').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('neutron/provisioning_network').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('deploy/continue_if_disk_secure_erase_fails').with(:value => '<SERVICE DEFAULT>')
@ -87,9 +84,6 @@ describe 'ironic::conductor' do
:max_time_interval => '50',
:force_power_state_during_sync => false,
:automated_clean => false,
:swift_account => '00000000-0000-0000-0000-000000000000',
:swift_temp_url_key => 'the-key',
:swift_temp_url_duration => 3600,
:cleaning_network => '00000000-0000-0000-0000-000000000000',
:api_url => 'https://127.0.0.1:6385',
:provisioning_network => '00000000-0000-0000-0000-000000000000',
@ -107,9 +101,6 @@ describe 'ironic::conductor' do
is_expected.to contain_ironic_config('conductor/force_power_state_during_sync').with_value(p[:force_power_state_during_sync])
is_expected.to contain_ironic_config('conductor/automated_clean').with_value(p[:automated_clean])
is_expected.to contain_ironic_config('conductor/api_url').with_value(p[:api_url])
is_expected.to contain_ironic_config('glance/swift_account').with_value(p[:swift_account])
is_expected.to contain_ironic_config('glance/swift_temp_url_key').with_value(p[:swift_temp_url_key]).with_secret(true)
is_expected.to contain_ironic_config('glance/swift_temp_url_duration').with_value(p[:swift_temp_url_duration])
is_expected.to contain_ironic_config('neutron/cleaning_network').with_value('00000000-0000-0000-0000-000000000000')
is_expected.to contain_ironic_config('neutron/provisioning_network').with_value('00000000-0000-0000-0000-000000000000')
is_expected.to contain_ironic_config('deploy/erase_devices_priority').with_value(0)

View File

@ -42,19 +42,25 @@ describe 'ironic::glance' do
is_expected.to contain_ironic_config('glance/glance_api_servers').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('glance/glance_api_insecure').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('glance/glance_num_retries').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('glance/swift_account').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('glance/swift_temp_url_key').with(:value => '<SERVICE DEFAULT>').with_secret(true)
is_expected.to contain_ironic_config('glance/swift_temp_url_duration').with(:value => '<SERVICE DEFAULT>')
end
context 'when overriding parameters' do
before :each do
params.merge!(
:auth_type => 'noauth',
:auth_url => 'http://example.com',
:project_name => 'project1',
:username => 'admin',
:password => 'pa$$w0rd',
:api_servers => '10.0.0.1:9292',
:api_insecure => true,
:num_retries => 42
:auth_type => 'noauth',
:auth_url => 'http://example.com',
:project_name => 'project1',
:username => 'admin',
:password => 'pa$$w0rd',
:api_servers => '10.0.0.1:9292',
:api_insecure => true,
:num_retries => 42,
:swift_account => '00000000-0000-0000-0000-000000000000',
:swift_temp_url_key => 'the-key',
:swift_temp_url_duration => 3600,
)
end
@ -67,6 +73,9 @@ describe 'ironic::glance' do
is_expected.to contain_ironic_config('glance/glance_api_servers').with_value(p[:api_servers])
is_expected.to contain_ironic_config('glance/glance_api_insecure').with_value(p[:api_insecure])
is_expected.to contain_ironic_config('glance/glance_num_retries').with_value(p[:num_retries])
is_expected.to contain_ironic_config('glance/swift_account').with_value(p[:swift_account])
is_expected.to contain_ironic_config('glance/swift_temp_url_key').with_value(p[:swift_temp_url_key]).with_secret(true)
is_expected.to contain_ironic_config('glance/swift_temp_url_duration').with_value(p[:swift_temp_url_duration])
end
end