From 31f0e17a1369f94fe55c51d005d66793445149f6 Mon Sep 17 00:00:00 2001 From: Adam Rozman Date: Fri, 1 Dec 2023 11:09:15 +0200 Subject: [PATCH] fix nits related to image server bauth This commit: - fixes a few nits that were pointed out after the feature was merged - doesn't affect the functionality of the feature Closes-Bug: #2021947 Change-Id: I1dd024b9994df2b367f61cea75eb71fabe57abfd --- doc/source/admin/index.rst | 2 +- doc/source/admin/user-image-basic-auth.rst | 10 ++++++---- ironic/drivers/modules/agent.py | 3 +-- ironic/tests/unit/drivers/modules/test_agent.py | 4 ++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/doc/source/admin/index.rst b/doc/source/admin/index.rst index ae4eb7cc17..236d0a26ee 100644 --- a/doc/source/admin/index.rst +++ b/doc/source/admin/index.rst @@ -33,7 +33,7 @@ the services. Hardware Burn-in Vendor Passthru Servicing - Basic Auth Support For User-image Servers + Authentication Support for Instance Images Drivers, Hardware Types and Hardware Interfaces ----------------------------------------------- diff --git a/doc/source/admin/user-image-basic-auth.rst b/doc/source/admin/user-image-basic-auth.rst index 8d0c208c64..59331ab9dd 100644 --- a/doc/source/admin/user-image-basic-auth.rst +++ b/doc/source/admin/user-image-basic-auth.rst @@ -26,13 +26,15 @@ string. The variables belong to the ``deploy`` configuration group and could be configured via the global Ironic configuration file. The authentication strategy configuration affects the download process -for ``disk`` images, ``live ISO`` images and the ``deploy`` images. +for images downloaded by the conductor or the ironic-python-agent. Example ------- Example of activating the ``http-basic`` strategy via -``/etc/ironic/ironic.conf``:: +``/etc/ironic/ironic.conf``: + +.. code-block:: ini [deploy] ... @@ -45,8 +47,8 @@ Known limitations ----------------- This implementation of the authentication strategy for user image handling is -implemented via the global Ironic configuration process thus it doesn't -provide node specific customization options. +implemented via the global Ironic configuration thus it doesn't provide node +specific customization options. When ``image_server_auth_strategy`` is set to any valid value all image sources will be treated with the same authentication strategy and Ironic will diff --git a/ironic/drivers/modules/agent.py b/ironic/drivers/modules/agent.py index 47f00aeabb..a33913ffbe 100644 --- a/ironic/drivers/modules/agent.py +++ b/ironic/drivers/modules/agent.py @@ -508,8 +508,7 @@ class AgentDeploy(CustomAgentDeploy): 'stream_raw_images': CONF.agent.stream_raw_images, } - if (CONF.deploy.image_server_auth_strategy != 'noauth' - and CONF.deploy.image_server_auth_strategy is not None): + if (CONF.deploy.image_server_auth_strategy != 'noauth'): image_info['image_server_auth_strategy'] = \ CONF.deploy.image_server_auth_strategy image_info['image_server_user'] = CONF.deploy.image_server_user diff --git a/ironic/tests/unit/drivers/modules/test_agent.py b/ironic/tests/unit/drivers/modules/test_agent.py index 2f37595a17..bfb045131b 100644 --- a/ironic/tests/unit/drivers/modules/test_agent.py +++ b/ironic/tests/unit/drivers/modules/test_agent.py @@ -1259,7 +1259,7 @@ class TestAgentDeploy(CommonTestsMixin, db_base.DbTestCase): 'no_proxy': '.eggs.com'} ) - def test_wirte_image_basic_auth_success(self): + def test_write_image_basic_auth_success(self): cfg.CONF.set_override('image_server_auth_strategy', 'http_basic', 'deploy') @@ -1277,7 +1277,7 @@ class TestAgentDeploy(CommonTestsMixin, db_base.DbTestCase): } ) - def test_wirte_image_basic_auth_success_blocked(self): + def test_write_image_basic_auth_success_blocked(self): cfg.CONF.set_override('image_server_user', 'SpongeBob', 'deploy')