From 610433b11ba3819869a892489546d9f8b2b743c2 Mon Sep 17 00:00:00 2001
From: Mark Goddard <mark@stackhpc.com>
Date: Tue, 20 Aug 2024 11:23:52 +0100
Subject: [PATCH] CI: Return to openstack-python3-jobs, fix pep8 failures

Since I8f5338b7eee31f1b8bc3e783d10666e3092a6540 we have not been running
pep8 jobs in CI.

This change fixes the issues introduced since then, returning to use the
openstack-python3-jobs template, which includes openstack-tox-pep8.

Change-Id: Ie15019f91b9e7b7f8cf97b628886f6b0beeb24fa
---
 kayobe/cli/commands.py                        | 23 +++++++++++++------
 kayobe/plugins/filter/networks.py             |  4 +++-
 .../unit/plugins/filter/test_networks.py      |  4 ++--
 kayobe/tests/unit/test_utils.py               |  4 ++--
 zuul.d/project.yaml                           |  6 +----
 5 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/kayobe/cli/commands.py b/kayobe/cli/commands.py
index 170a5698..19ff2ed0 100644
--- a/kayobe/cli/commands.py
+++ b/kayobe/cli/commands.py
@@ -731,7 +731,8 @@ class SeedServiceDeploy(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
         playbooks = _build_playbook_list(
             "seed-manage-containers")
         extra_vars = {"kayobe_action": "deploy"}
-        self.run_kayobe_playbooks(parsed_args, playbooks, extra_vars=extra_vars)
+        self.run_kayobe_playbooks(parsed_args, playbooks,
+                                  extra_vars=extra_vars)
         self.generate_kolla_ansible_config(parsed_args, service_config=False,
                                            bifrost_config=True)
 
@@ -740,10 +741,12 @@ class SeedServiceDeploy(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
             "seed-credentials",
             "seed-introspection-rules",
             "dell-switch-bmp")
-        self.run_kayobe_playbooks(parsed_args, playbooks, extra_vars=extra_vars)
+        self.run_kayobe_playbooks(parsed_args, playbooks,
+                                  extra_vars=extra_vars)
+
 
 class SeedServiceDestroy(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
-                        Command):
+                         Command):
     """Destroy the seed services.
 
     * Destroys user defined containers
@@ -762,13 +765,15 @@ class SeedServiceDestroy(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
         self.generate_kolla_ansible_config(parsed_args, service_config=False,
                                            bifrost_config=False)
         extra_args = ["--yes-i-really-really-mean-it"]
-        self.run_kolla_ansible_seed(parsed_args, "destroy", extra_args=extra_args)
+        self.run_kolla_ansible_seed(parsed_args, "destroy",
+                                    extra_args=extra_args)
 
         extra_vars = {"kayobe_action": "destroy"}
         playbooks = _build_playbook_list(
             "seed-manage-containers",
             "docker-registry")
-        self.run_kayobe_playbooks(parsed_args, playbooks, extra_vars=extra_vars)
+        self.run_kayobe_playbooks(parsed_args, playbooks,
+                                  extra_vars=extra_vars)
 
     def get_parser(self, prog_name):
         parser = super(SeedServiceDestroy, self).get_parser(prog_name)
@@ -779,6 +784,7 @@ class SeedServiceDestroy(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
                                 "permanently destroy all services and data.")
         return parser
 
+
 class SeedServiceUpgrade(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
                          Command):
     """Upgrade the seed services.
@@ -800,7 +806,8 @@ class SeedServiceUpgrade(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
         playbooks = _build_playbook_list(
             "seed-manage-containers")
         extra_vars = {"kayobe_action": "deploy"}
-        self.run_kayobe_playbooks(parsed_args, playbooks, extra_vars=extra_vars)
+        self.run_kayobe_playbooks(parsed_args, playbooks,
+                                  extra_vars=extra_vars)
         self.generate_kolla_ansible_config(parsed_args, service_config=False,
                                            bifrost_config=True)
 
@@ -1896,6 +1903,7 @@ class NetworkConnectivityCheck(KayobeAnsibleMixin, VaultMixin, Command):
         playbooks = _build_playbook_list("network-connectivity")
         self.run_kayobe_playbooks(parsed_args, playbooks)
 
+
 class BaremetalComputeRegister(KayobeAnsibleMixin, VaultMixin, Command):
     """Register baremetal compute nodes in Ironic."""
 
@@ -1915,7 +1923,8 @@ class BaremetalComputeInspect(KayobeAnsibleMixin, VaultMixin, Command):
         self.run_kayobe_playbooks(parsed_args, playbooks)
 
 
-class BaremetalComputeIntrospectionDataSave(KayobeAnsibleMixin, VaultMixin, Command):
+class BaremetalComputeIntrospectionDataSave(KayobeAnsibleMixin, VaultMixin,
+                                            Command):
     """Save hardware introspection data for the baremetal compute nodes.
 
     Save hardware introspection data from the overcloud's ironic inspector
diff --git a/kayobe/plugins/filter/networks.py b/kayobe/plugins/filter/networks.py
index bdf591c3..51b63ddb 100644
--- a/kayobe/plugins/filter/networks.py
+++ b/kayobe/plugins/filter/networks.py
@@ -748,6 +748,7 @@ def net_ovs_veths(context, names, inventory_hostname=None):
         for veth in veths
     ]
 
+
 @jinja2.pass_context
 def net_physical_interface(context, name, inventory_hostname=None):
     """Return a list of bridge ports, bond slaves or a direct interface name
@@ -757,11 +758,12 @@ def net_physical_interface(context, name, inventory_hostname=None):
     """
     if _net_interface_type(context, name, inventory_hostname) == 'bridge':
         return net_bridge_ports(context, name, inventory_hostname)
-    elif  _net_interface_type(context, name, inventory_hostname) == 'bond':
+    elif _net_interface_type(context, name, inventory_hostname) == 'bond':
         return net_bond_slaves(context, name, inventory_hostname)
     else:
         return [net_attr(context, name, 'interface', inventory_hostname)]
 
+
 def get_filters():
     return {
         'net_attr': net_attr,
diff --git a/kayobe/tests/unit/plugins/filter/test_networks.py b/kayobe/tests/unit/plugins/filter/test_networks.py
index c09d937a..283049ea 100644
--- a/kayobe/tests/unit/plugins/filter/test_networks.py
+++ b/kayobe/tests/unit/plugins/filter/test_networks.py
@@ -205,7 +205,8 @@ class TestNetworks(BaseNetworksTest):
                           self.context, "net3")
 
     def test_physical_interface_bond(self):
-        self._update_context({"net6_interface": "bond0", "net6_bond_slaves": ["eth3", "eth4"]})
+        self._update_context({"net6_interface": "bond0",
+                              "net6_bond_slaves": ["eth3", "eth4"]})
         interface = networks.net_physical_interface(self.context, "net6")
         expected = ['eth3', 'eth4']
         self.assertEqual(expected, interface)
@@ -219,4 +220,3 @@ class TestNetworks(BaseNetworksTest):
         interface = networks.net_physical_interface(self.context, "net1")
         expected = ['eth0']
         self.assertEqual(expected, interface)
-
diff --git a/kayobe/tests/unit/test_utils.py b/kayobe/tests/unit/test_utils.py
index 88fb96da..34f92a83 100644
--- a/kayobe/tests/unit/test_utils.py
+++ b/kayobe/tests/unit/test_utils.py
@@ -54,7 +54,7 @@ class TestCase(unittest.TestCase):
                                           "/path/to/collections",
                                           "--requirements-file",
                                           "/path/to/collection/file"],
-                                          env=env)
+                                         env=env)
 
     @mock.patch.object(utils, "run_command")
     @mock.patch.object(utils, "read_yaml_file")
@@ -85,7 +85,7 @@ class TestCase(unittest.TestCase):
                                           "/path/to/collections",
                                           "--requirements-file",
                                           "/path/to/collection/file"],
-                                          env=env)
+                                         env=env)
 
     @mock.patch.object(utils, "run_command")
     @mock.patch.object(utils, "read_yaml_file")
diff --git a/zuul.d/project.yaml b/zuul.d/project.yaml
index ab115dda..a09d68e5 100644
--- a/zuul.d/project.yaml
+++ b/zuul.d/project.yaml
@@ -3,6 +3,7 @@
     queue: kayobe
     templates:
       - openstack-cover-jobs
+      - openstack-python3-jobs
       - publish-openstack-docs-pti
       - release-notes-jobs-python3
     check:
@@ -28,11 +29,6 @@
         - kayobe-seed-vm-ubuntu-jammy
         - kayobe-infra-vm-rocky9
         - kayobe-infra-vm-ubuntu-jammy
-        - openstack-tox-py39
-        - openstack-tox-py310
-        - openstack-tox-py311
-        - openstack-tox-py312:
-            voting: false
     gate:
       jobs:
         - kayobe-tox-ansible-syntax
-- 
GitLab