From cddbe5e38bd131a1350db2c58c6f81a78b299ef9 Mon Sep 17 00:00:00 2001
From: Takashi Kajinami <kajinamit@oss.nttdata.com>
Date: Wed, 28 Feb 2024 15:28:07 +0900
Subject: [PATCH] Remove puppet-ec2api

The EC2-API project was marked inactive, because of lack of appropriate
maintenance effort[1] and the project was excluded from Caracal
deliverables. This removes testing with the puppet-ec2api module
because we are also retiring this module for the unmaintained project.

[1] https://review.opendev.org/c/openstack/governance/+/902625

Change-Id: Ic8c89e096e9b3acd5a71ec0be1bff20936977bcf
---
 Puppetfile              |  4 --
 README.md               |  1 -
 fixtures/scenario002.pp | 13 +-----
 manifests/ec2api.pp     | 87 -----------------------------------------
 manifests/tempest.pp    |  7 ----
 openstack_modules.txt   |  1 -
 run_tests.sh            |  6 ---
 zuul.d/base.yaml        |  1 -
 8 files changed, 2 insertions(+), 118 deletions(-)
 delete mode 100644 manifests/ec2api.pp

diff --git a/Puppetfile b/Puppetfile
index 977efa18b..f08d50bac 100644
--- a/Puppetfile
+++ b/Puppetfile
@@ -29,10 +29,6 @@ mod 'designate',
   :git => 'https://opendev.org/openstack/puppet-designate',
   :ref => 'master'
 
-mod 'ec2api',
-  :git => 'https://opendev.org/openstack/puppet-ec2api',
-  :ref => 'master'
-
 mod 'glance',
   :git => 'https://opendev.org/openstack/puppet-glance',
   :ref => 'master'
diff --git a/README.md b/README.md
index 79c8043a9..202858d48 100644
--- a/README.md
+++ b/README.md
@@ -59,7 +59,6 @@ scenario](#all-in-one).
 | designate  |             |             |     bind    |             |             |              |
 | backup     |    ceph     |    swift    |             |             |             |              |
 | gnocchi    |     rbd     |    swift    |             |             |             |              |
-| ec2api     |             |       X     |             |             |             |              |
 | heat       |      X      |             |       X     |             |             |              |
 | swift      |             |       X     |             |             |             |              |
 | trove      |             |             |       X     |             |             |              |
diff --git a/fixtures/scenario002.pp b/fixtures/scenario002.pp
index 0e1d45f03..55c7650c7 100644
--- a/fixtures/scenario002.pp
+++ b/fixtures/scenario002.pp
@@ -22,13 +22,10 @@ if $facts['os']['name'] == 'Ubuntu' {
 
 case $facts['os']['family'] {
   'Debian': {
-    $ipv6           = false
-    # ec2api is not packaged on UCA
-    $ec2api_enabled = false
+    $ipv6 = false
   }
   'RedHat': {
-    $ipv6           = true
-    $ec2api_enabled = true
+    $ipv6 = true
   }
   default: {
     fail("Unsupported osfamily (${facts['os']['family']})")
@@ -81,10 +78,6 @@ class { 'openstack_integration::cinder':
 
 include openstack_integration::barbican
 
-if $ec2api_enabled {
-  include openstack_integration::ec2api
-}
-
 class { 'openstack_integration::ceilometer':
   separate_polling => true,
 }
@@ -109,6 +102,4 @@ class { 'openstack_integration::tempest':
   ironic                  => true,
   zaqar                   => true,
   attach_encrypted_volume => true,
-  # Enable this once bug 2050063 is fixed
-  ec2api                  => false,
 }
diff --git a/manifests/ec2api.pp b/manifests/ec2api.pp
deleted file mode 100644
index c12769202..000000000
--- a/manifests/ec2api.pp
+++ /dev/null
@@ -1,87 +0,0 @@
-# Configure the ec2api service
-#
-class openstack_integration::ec2api {
-
-  include openstack_integration::config
-  include openstack_integration::params
-
-  if $::openstack_integration::config::ssl {
-    openstack_integration::ssl_key { 'ec2api':
-      notify  => Anchor['ec2api::service::begin'],
-      require => Anchor['ec2api::install::end'],
-    }
-    Exec['update-ca-certificates'] ~> Service<| tag == 'ec2api-service' |>
-  }
-
-  class { 'ec2api::keystone::auth':
-    public_url   => "${::openstack_integration::config::base_url}:8788",
-    internal_url => "${::openstack_integration::config::base_url}:8788",
-    admin_url    => "${::openstack_integration::config::base_url}:8788",
-    password     => 'a_big_secret',
-    roles        => ['admin', 'service'],
-  }
-  class { 'ec2api::db::mysql':
-    charset  => $::openstack_integration::params::mysql_charset,
-    collate  => $::openstack_integration::params::mysql_collate,
-    password => 'ec2api',
-    host     => $::openstack_integration::config::host,
-  }
-
-  case $facts['os']['family'] {
-    'RedHat': {
-      class { 'ec2api::cache':
-        backend          => 'dogpile.cache.pymemcache',
-        enabled          => true,
-        memcache_servers => $::openstack_integration::config::memcache_servers,
-      }
-      class { 'ec2api::db':
-        database_connection => os_database_connection({
-          'dialect'  => 'mysql+pymysql',
-          'host'     => $::openstack_integration::config::ip_for_url,
-          'username' => 'ec2api',
-          'password' => 'ec2api',
-          'database' => 'ec2api',
-          'charset'  => 'utf8',
-          'extra'    => $::openstack_integration::config::db_extra,
-        }),
-      }
-      class { 'ec2api::db::sync': }
-      class { 'ec2api::logging':
-        debug => true,
-      }
-      class { 'ec2api': }
-      class { 'ec2api::keystone::authtoken':
-        password                     => 'a_big_secret',
-        user_domain_name             => 'Default',
-        project_domain_name          => 'Default',
-        auth_url                     => $::openstack_integration::config::keystone_admin_uri,
-        www_authenticate_uri         => $::openstack_integration::config::keystone_auth_uri,
-        memcached_servers            => $::openstack_integration::config::memcached_servers,
-        service_token_roles_required => true,
-      }
-      class { 'ec2api::api':
-        my_ip                   => $::openstack_integration::config::host,
-        ec2_host                => $::openstack_integration::config::host,
-        ec2api_listen           => $::openstack_integration::config::host,
-        keystone_ec2_tokens_url => "${::openstack_integration::config::keystone_auth_uri}/v3/ec2tokens",
-        external_network        => 'public',
-        ec2api_use_ssl          => $::openstack_integration::config::ssl,
-        ssl_cert_file           => $::openstack_integration::params::cert_path,
-        ssl_key_file            => "/etc/ec2api/ssl/private/${facts['networking']['fqdn']}.pem",
-        ec2api_workers          => 2,
-      }
-      class { 'ec2api::metadata':
-        nova_metadata_ip => $::openstack_integration::config::host,
-        metadata_listen  => $::openstack_integration::config::host,
-        metadata_use_ssl => $::openstack_integration::config::ssl,
-        metadata_workers => 2,
-      }
-    }
-    'Debian': {
-      warning('ec2api is not yet packaged on Ubuntu systems.')
-    }
-    default: {
-      fail("Unsupported osfamily (${facts['os']['family']})")
-    }
-  }
-}
diff --git a/manifests/tempest.pp b/manifests/tempest.pp
index 318d8889d..c7b709404 100644
--- a/manifests/tempest.pp
+++ b/manifests/tempest.pp
@@ -28,10 +28,6 @@
 #   (optional) Define if Designate needs to be tested.
 #   Default to false.
 #
-# [*ec2api*]
-#   (optional) Define if EC2-API needs to be tested.
-#   Default to false.
-#
 # [*glance*]
 #   (optional) Define if Glance needs to be tested.
 #   Default to true.
@@ -163,7 +159,6 @@ class openstack_integration::tempest (
   $cinder                  = false,
   $cinder_backup           = false,
   $designate               = false,
-  $ec2api                  = false,
   $glance                  = true,
   $gnocchi                 = false,
   $heat                    = false,
@@ -335,7 +330,6 @@ class openstack_integration::tempest (
     mistral_available                  => $mistral,
     vitrage_available                  => $vitrage,
     gnocchi_available                  => $gnocchi,
-    ec2api_available                   => $ec2api,
     watcher_available                  => $watcher,
     public_network_name                => 'public',
     neutron_api_extensions             => join(any2array($neutron_api_extensions_real), ','),
@@ -358,7 +352,6 @@ class openstack_integration::tempest (
     run_ssh                            => true,
     l2gw_switch                        => $l2gw_switch,
     disable_dashboard_ssl_validation   => true,
-    ec2api_tester_roles                => ['member'],
     aws_ec2_url                        => "${::openstack_integration::config::base_url}:8788/",
     aws_region                         => 'regionOne',
     # TODO(tkajinam): we have to configure image id parameters but we have to
diff --git a/openstack_modules.txt b/openstack_modules.txt
index 57fc38d62..298a593da 100644
--- a/openstack_modules.txt
+++ b/openstack_modules.txt
@@ -5,7 +5,6 @@ ceph
 cinder
 cloudkitty
 designate
-ec2api
 glance
 gnocchi
 heat
diff --git a/run_tests.sh b/run_tests.sh
index b572bef7b..c38cef149 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -309,12 +309,6 @@ echo "magnum_tempest_plugin.tests.api.v1.test_magnum_service.MagnumServiceTest"
 # Zaqar
 echo "v2.test_queues.TestManageQueue" >> /tmp/openstack/tempest/test-include-list.txt
 
-# ec2api
-# VPN tests require VPNaaS, which doesn't work yet in puppet-tempest.
-# As soon as enabling neutron_vpnaas_available works there, the VPN tests can
-# be included.
-echo "ec2api_tempest_plugin.api.*test_create_delete(?!.*_vpn_connection)" >> /tmp/openstack/tempest/test-include-list.txt
-
 # Cinder Backup
 echo "VolumesBackupsAdminTest" >> /tmp/openstack/tempest/test-include-list.txt
 
diff --git a/zuul.d/base.yaml b/zuul.d/base.yaml
index 80ad9c6b0..00f92b5b4 100644
--- a/zuul.d/base.yaml
+++ b/zuul.d/base.yaml
@@ -12,7 +12,6 @@
       - name: openstack/puppet-cinder
       - name: openstack/puppet-cloudkitty
       - name: openstack/puppet-designate
-      - name: openstack/puppet-ec2api
       - name: openstack/puppet-glance
       - name: openstack/puppet-gnocchi
       - name: openstack/puppet-heat