From 3e0f6ed2404e8e48bea77c1dbc0f84ddd1841c2c Mon Sep 17 00:00:00 2001
From: Jay Faulkner <jay@jvf.cc>
Date: Mon, 31 Mar 2025 13:26:28 -0700
Subject: [PATCH] Rename ironic cmd module

This module being 'cmd' means that when using unittest native test
discovery, it tries to load our cmd module instead of the built-in. This
obviously does not impact test running in CI or via tox, but by renaming
this we'll make our ironic tests compatible with vscode (and I presume
any other unittest-discover based IDE testing setups).

Change fully generated by cursor IDE with review and minimal editing by
me.

Generated-By: Cursor
Change-Id: I6c9b92e6b0bee366ff40795c722bd70d16cf0e4f
---
 doc/source/contributor/releasing.rst               |  2 +-
 doc/source/contributor/rolling-upgrades.rst        |  7 ++++---
 ironic/{cmd => command}/__init__.py                |  0
 ironic/{cmd => command}/api.py                     |  0
 ironic/{cmd => command}/conductor.py               |  0
 ironic/{cmd => command}/dbsync.py                  |  0
 ironic/{cmd => command}/novncproxy.py              |  0
 ironic/{cmd => command}/pxe_filter.py              |  0
 ironic/{cmd => command}/singleprocess.py           |  2 +-
 ironic/{cmd => command}/status.py                  |  2 +-
 ironic/tests/unit/{cmd => command}/__init__.py     |  0
 .../tests/unit/{cmd => command}/test_conductor.py  |  2 +-
 ironic/tests/unit/{cmd => command}/test_dbsync.py  |  2 +-
 ironic/tests/unit/{cmd => command}/test_status.py  |  4 ++--
 setup.cfg                                          | 14 +++++++-------
 15 files changed, 18 insertions(+), 17 deletions(-)
 rename ironic/{cmd => command}/__init__.py (100%)
 rename ironic/{cmd => command}/api.py (100%)
 rename ironic/{cmd => command}/conductor.py (100%)
 rename ironic/{cmd => command}/dbsync.py (100%)
 rename ironic/{cmd => command}/novncproxy.py (100%)
 rename ironic/{cmd => command}/pxe_filter.py (100%)
 rename ironic/{cmd => command}/singleprocess.py (97%)
 rename ironic/{cmd => command}/status.py (99%)
 rename ironic/tests/unit/{cmd => command}/__init__.py (100%)
 rename ironic/tests/unit/{cmd => command}/test_conductor.py (98%)
 rename ironic/tests/unit/{cmd => command}/test_dbsync.py (99%)
 rename ironic/tests/unit/{cmd => command}/test_status.py (99%)

diff --git a/doc/source/contributor/releasing.rst b/doc/source/contributor/releasing.rst
index 0983a9c047..283f7ad391 100644
--- a/doc/source/contributor/releasing.rst
+++ b/doc/source/contributor/releasing.rst
@@ -397,7 +397,7 @@ We need to submit patches for changes on master to:
     support upgrades between adjacent named releases, the master branch will
     only support upgrades from the most recent named release to master.
 
-  * remove any DB migration scripts from ``ironic.cmd.dbsync.ONLINE_MIGRATIONS``
+  * remove any DB migration scripts from ``ironic.command.dbsync.ONLINE_MIGRATIONS``
     and remove the corresponding code from Ironic. (These migration scripts
     are used to migrate from an old release to this latest release; they
     shouldn't be needed after that.)
diff --git a/doc/source/contributor/rolling-upgrades.rst b/doc/source/contributor/rolling-upgrades.rst
index a331fb6230..9560c11d54 100644
--- a/doc/source/contributor/rolling-upgrades.rst
+++ b/doc/source/contributor/rolling-upgrades.rst
@@ -374,7 +374,8 @@ following needs to be considered:
   ``ironic/common/release_mappings.py``.
 - New objects must be added to ``ironic/common/release_mappings.py``. Also for
   the first releases they should be excluded from the version check by adding
-  their class names to the ``NEW_MODELS`` list in ``ironic/cmd/dbsync.py``.
+  their class names to the ``NEW_MODELS`` list in
+  ``ironic/command/dbsync.py``.
 - The arguments of remotable methods (methods which are remoted to the
   conductor via RPC) can only be added as optional. They cannot be removed or
   changed in an incompatible way (to the previous release).
@@ -479,7 +480,7 @@ In this method, the version column can be used to select and update old
 objects.
 
 The method name should be added to the list of ``ONLINE_MIGRATIONS`` in
-``ironic/cmd/dbsync.py``.
+``ironic/command/dbsync.py``.
 
 The method should be removed in the next named release after this one.
 
@@ -504,4 +505,4 @@ versions are the versions specified in
 ``ironic.common.release_mappings.RELEASE_MAPPING``.
 The newly created tables cannot pass this check and thus have to be excluded by
 adding their object class names (e.g. ``Node``) to
-``ironic.cmd.dbsync.NEW_MODELS``.
+``ironic.command.dbsync.NEW_MODELS``.
diff --git a/ironic/cmd/__init__.py b/ironic/command/__init__.py
similarity index 100%
rename from ironic/cmd/__init__.py
rename to ironic/command/__init__.py
diff --git a/ironic/cmd/api.py b/ironic/command/api.py
similarity index 100%
rename from ironic/cmd/api.py
rename to ironic/command/api.py
diff --git a/ironic/cmd/conductor.py b/ironic/command/conductor.py
similarity index 100%
rename from ironic/cmd/conductor.py
rename to ironic/command/conductor.py
diff --git a/ironic/cmd/dbsync.py b/ironic/command/dbsync.py
similarity index 100%
rename from ironic/cmd/dbsync.py
rename to ironic/command/dbsync.py
diff --git a/ironic/cmd/novncproxy.py b/ironic/command/novncproxy.py
similarity index 100%
rename from ironic/cmd/novncproxy.py
rename to ironic/command/novncproxy.py
diff --git a/ironic/cmd/pxe_filter.py b/ironic/command/pxe_filter.py
similarity index 100%
rename from ironic/cmd/pxe_filter.py
rename to ironic/command/pxe_filter.py
diff --git a/ironic/cmd/singleprocess.py b/ironic/command/singleprocess.py
similarity index 97%
rename from ironic/cmd/singleprocess.py
rename to ironic/command/singleprocess.py
index 7a8fbcd114..04782e8ed2 100644
--- a/ironic/cmd/singleprocess.py
+++ b/ironic/command/singleprocess.py
@@ -16,7 +16,7 @@ from oslo_config import cfg
 from oslo_log import log
 from oslo_service import service
 
-from ironic.cmd import conductor as conductor_cmd
+from ironic.command import conductor as conductor_cmd
 from ironic.common import service as ironic_service
 from ironic.common import wsgi_service
 from ironic.conductor import rpc_service
diff --git a/ironic/cmd/status.py b/ironic/command/status.py
similarity index 99%
rename from ironic/cmd/status.py
rename to ironic/command/status.py
index 63cfcc746f..c875d49366 100644
--- a/ironic/cmd/status.py
+++ b/ironic/command/status.py
@@ -21,7 +21,7 @@ from oslo_upgradecheck import common_checks
 from oslo_upgradecheck import upgradecheck
 import sqlalchemy
 
-from ironic.cmd import dbsync
+from ironic.command import dbsync
 from ironic.common import driver_factory
 from ironic.common.i18n import _
 from ironic.common import policy  # noqa importing to load policy config.
diff --git a/ironic/tests/unit/cmd/__init__.py b/ironic/tests/unit/command/__init__.py
similarity index 100%
rename from ironic/tests/unit/cmd/__init__.py
rename to ironic/tests/unit/command/__init__.py
diff --git a/ironic/tests/unit/cmd/test_conductor.py b/ironic/tests/unit/command/test_conductor.py
similarity index 98%
rename from ironic/tests/unit/cmd/test_conductor.py
rename to ironic/tests/unit/command/test_conductor.py
index ef0f8b0859..bb1c6488f8 100644
--- a/ironic/tests/unit/cmd/test_conductor.py
+++ b/ironic/tests/unit/command/test_conductor.py
@@ -15,7 +15,7 @@ from unittest import mock
 
 from oslo_config import cfg
 
-from ironic.cmd import conductor
+from ironic.command import conductor
 from ironic.tests.unit.db import base as db_base
 
 
diff --git a/ironic/tests/unit/cmd/test_dbsync.py b/ironic/tests/unit/command/test_dbsync.py
similarity index 99%
rename from ironic/tests/unit/cmd/test_dbsync.py
rename to ironic/tests/unit/command/test_dbsync.py
index 618b8bcd50..b90080a3d6 100644
--- a/ironic/tests/unit/cmd/test_dbsync.py
+++ b/ironic/tests/unit/command/test_dbsync.py
@@ -15,7 +15,7 @@
 
 from unittest import mock
 
-from ironic.cmd import dbsync
+from ironic.command import dbsync
 from ironic.common import context
 from ironic.db import migration
 from ironic.tests.unit.db import base as db_base
diff --git a/ironic/tests/unit/cmd/test_status.py b/ironic/tests/unit/command/test_status.py
similarity index 99%
rename from ironic/tests/unit/cmd/test_status.py
rename to ironic/tests/unit/command/test_status.py
index 42ebe339c0..80e7bac1d2 100644
--- a/ironic/tests/unit/cmd/test_status.py
+++ b/ironic/tests/unit/command/test_status.py
@@ -18,8 +18,8 @@ from oslo_db import sqlalchemy
 from oslo_upgradecheck.upgradecheck import Code
 from sqlalchemy.engine import url as sa_url
 
-from ironic.cmd import dbsync
-from ironic.cmd import status
+from ironic.command import dbsync
+from ironic.command import status
 from ironic.tests.unit.db import base as db_base
 
 
diff --git a/setup.cfg b/setup.cfg
index 6e8a192367..b320607f25 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -45,14 +45,14 @@ oslo.policy.policies =
     ironic.api = ironic.common.policy:list_policies
 
 console_scripts =
-    ironic = ironic.cmd.singleprocess:main
-    ironic-api = ironic.cmd.api:main
-    ironic-dbsync = ironic.cmd.dbsync:main
-    ironic-conductor = ironic.cmd.conductor:main
-    ironic-novncproxy = ironic.cmd.novncproxy:main
+    ironic = ironic.command.singleprocess:main
+    ironic-api = ironic.command.api:main
+    ironic-dbsync = ironic.command.dbsync:main
+    ironic-conductor = ironic.command.conductor:main
+    ironic-novncproxy = ironic.command.novncproxy:main
     ironic-rootwrap = oslo_rootwrap.cmd:main
-    ironic-status = ironic.cmd.status:main
-    ironic-pxe-filter = ironic.cmd.pxe_filter:main
+    ironic-status = ironic.command.status:main
+    ironic-pxe-filter = ironic.command.pxe_filter:main
 
 wsgi_scripts =
     ironic-api-wsgi = ironic.api.wsgi:initialize_wsgi_app