]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: still set container_image when --no-assimilate-config is provided
authorAdam King <adking@redhat.com>
Mon, 21 Feb 2022 21:34:47 +0000 (16:34 -0500)
committerAdam King <adking@redhat.com>
Tue, 3 May 2022 00:48:33 +0000 (20:48 -0400)
Fixes: https://tracker.ceph.com/issues/54141
Signed-off-by: Adam King <adking@redhat.com>
(cherry picked from commit 59d004cb901eb6d84fb6907cb88314fd31b87904)

src/cephadm/cephadm
src/cephadm/tests/test_cephadm.py

index f04abf5d2c62910403faee8fdef9cee8d85aacb0..4f8d1e478cdd8b5314058db0c463a78d73bdbb74 100755 (executable)
@@ -4872,6 +4872,9 @@ def finish_bootstrap_config(
             'restart',
             get_unit_name(fsid, 'mon', mon_id)
         ])
+    elif 'image' in ctx and ctx.image:
+        # we still want to assimilate the given container image if provided
+        cli(['config', 'set', 'global', 'container_image', f'{ctx.image}'])
 
     if mon_network:
         logger.info(f'Setting mon public_network to {mon_network}')
index 2508d14c3d8a8b7aa86b39474a94f1c53dcbfed9..f025fb9b2c99905461e0db56922b9c408f59ef09 100644 (file)
@@ -561,6 +561,26 @@ ff792c06d8544b983.scope not found.: OCI runtime error"""
         with mock.patch('os.listdir', return_value=test_input):
             assert cd.get_ceph_cluster_count(ctx) == expected
 
+    def test_set_image_minimize_config(self):
+        def throw_cmd(cmd):
+            raise cd.Error(' '.join(cmd))
+        ctx = cd.CephadmContext()
+        ctx.image = 'test_image'
+        ctx.no_minimize_config = True
+        fake_cli = lambda cmd, __=None, ___=None: throw_cmd(cmd)
+        with pytest.raises(cd.Error, match='config set global container_image test_image'):
+            cd.finish_bootstrap_config(
+                ctx=ctx,
+                fsid=cd.make_fsid(),
+                config='',
+                mon_id='a', mon_dir='mon_dir',
+                mon_network=None, ipv6=False,
+                cli=fake_cli,
+                cluster_network=None,
+                ipv6_cluster_network=False
+            )
+
+
 class TestCustomContainer(unittest.TestCase):
     cc: cd.CustomContainer