From e82a668c4028c28c1aa49ecd703a968552aba8dc Mon Sep 17 00:00:00 2001
From: Takashi Kajinami <kajinamit@oss.nttdata.com>
Date: Sat, 20 Apr 2024 23:19:57 +0900
Subject: [PATCH] magnum: Deprecate tempest_config_file

... because we deprecated the same parameter of the tempest class.

Related-Bug: #2043210
Change-Id: I87c1db9a9d5297da4f5a716faa44f0228203893d
---
 manifests/magnum.pp                           | 45 ++++++++++---------
 ...-tempest_config_file-7d3344abfe895815.yaml |  5 +++
 spec/classes/tempest_magnum_spec.rb           |  8 ++++
 3 files changed, 38 insertions(+), 20 deletions(-)
 create mode 100644 releasenotes/notes/deprecate-magnum-tempest_config_file-7d3344abfe895815.yaml

diff --git a/manifests/magnum.pp b/manifests/magnum.pp
index 34693f73..79b8d394 100644
--- a/manifests/magnum.pp
+++ b/manifests/magnum.pp
@@ -6,9 +6,6 @@
 #
 # === Parameters
 #
-# [*tempest_config_file*]
-#   Defaults to '/var/lib/tempest/etc/tempest.conf'
-#
 # [*provision_image*]
 #   (Optional) If ::tempest::magnum should configure the testing image
 #   Defaults to true
@@ -71,32 +68,40 @@
 #   (Optional) The keypair_id parameter used in Magnum tempest configuration
 #   Defaults to undef
 #
+# [*tempest_config_file*]
+#   Defaults to undef
+#
 class tempest::magnum (
-  Stdlib::Absolutepath $tempest_config_file = '/var/lib/tempest/etc/tempest.conf',
-  Boolean $provision_image                  = true,
-  String[1] $image_source                   = 'https://fedorapeople.org/groups/magnum/fedora-atomic-latest.qcow2',
-  String[1] $image_name                     = 'fedora-atomic-latest',
-  String[1] $image_os_distro                = 'fedora-atomic',
-  Boolean $provision_flavors                = true,
-  String[1] $flavor_id                      = 's1.magnum',
-  String[1] $master_flavor_id               = 'm1.magnum',
-  Boolean $provision_keypair                = false,
-  $keypair_name                             = $facts['os_service_default'],
-  $nic_id                                   = $facts['os_service_default'],
-  $magnum_url                               = $facts['os_service_default'],
-  $copy_logs                                = $facts['os_service_default'],
-  $dns_nameserver                           = $facts['os_service_default'],
-  Boolean $manage_tests_packages            = true,
+  Boolean $provision_image       = true,
+  String[1] $image_source        = 'https://fedorapeople.org/groups/magnum/fedora-atomic-latest.qcow2',
+  String[1] $image_name          = 'fedora-atomic-latest',
+  String[1] $image_os_distro     = 'fedora-atomic',
+  Boolean $provision_flavors     = true,
+  String[1] $flavor_id           = 's1.magnum',
+  String[1] $master_flavor_id    = 'm1.magnum',
+  Boolean $provision_keypair     = false,
+  $keypair_name                  = $facts['os_service_default'],
+  $nic_id                        = $facts['os_service_default'],
+  $magnum_url                    = $facts['os_service_default'],
+  $copy_logs                     = $facts['os_service_default'],
+  $dns_nameserver                = $facts['os_service_default'],
+  Boolean $manage_tests_packages = true,
   # DEPRECATED PARAMETERS
-  $keypair_id                               = undef,
+  $keypair_id                    = undef,
+  $tempest_config_file           = undef,
 ) {
   include tempest::params
+  include tempest
 
   if $keypair_id != undef {
     warning("The keypair_id parameter is deprecated and has no effect. \
 Use the keypair_name parameter.")
   }
 
+  if $tempest_config_file != undef {
+    warning('The tempest_config_file parameter has been deprecated and has no effect')
+  }
+
   if $provision_image {
     $image_properties = { 'os_distro' => $image_os_distro }
     glance_image { $image_name:
@@ -138,7 +143,7 @@ Use the keypair_name parameter.")
   }
 
   Tempest_config {
-    path    => $tempest_config_file,
+    path => $::tempest::tempest_conf,
   }
 
   tempest_config {
diff --git a/releasenotes/notes/deprecate-magnum-tempest_config_file-7d3344abfe895815.yaml b/releasenotes/notes/deprecate-magnum-tempest_config_file-7d3344abfe895815.yaml
new file mode 100644
index 00000000..c459dc13
--- /dev/null
+++ b/releasenotes/notes/deprecate-magnum-tempest_config_file-7d3344abfe895815.yaml
@@ -0,0 +1,5 @@
+---
+deprecations:
+  - |
+    The ``tempest::magnum::tempest_config_file`` parameter is deprecated and
+    has no effect now.
diff --git a/spec/classes/tempest_magnum_spec.rb b/spec/classes/tempest_magnum_spec.rb
index 49a98e5b..82cfce2a 100644
--- a/spec/classes/tempest_magnum_spec.rb
+++ b/spec/classes/tempest_magnum_spec.rb
@@ -1,6 +1,14 @@
 require 'spec_helper'
 
 describe 'tempest::magnum' do
+  let :pre_condition do
+    "
+    class { 'tempest':
+      configure_networks => false,
+      configure_images   => false
+    }"
+  end
+
   let :params do
     { :nic_id => 'b2e6021a-4956-4a1f-8329-790b9add05a9', }
   end