]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Avoid calling zonegroup modify if realm/zonegroup/zone are not present in the spec 67598/head
authorKushal Deb <Kushal.Deb@ibm.com>
Mon, 2 Mar 2026 08:12:39 +0000 (13:42 +0530)
committerKushal Deb <Kushal.Deb@ibm.com>
Mon, 2 Mar 2026 08:12:56 +0000 (13:42 +0530)
Skip rgw zonegroup modify when zonegroup_hostnames is set
but rgw_realm/rgw_zonegroup/rgw_zone are not provided, to avoid sending null identifiers.

Signed-off-by: Kushal Deb <Kushal.Deb@ibm.com>
src/pybind/mgr/cephadm/services/cephadmservice.py

index 482414db4869aca8008d001f31f087e1a37df939..57f5ebd8dd4e749c468dd2acc84cf04de628ecab 100644 (file)
@@ -1333,15 +1333,24 @@ class RgwService(CephService):
             san_list = spec.zonegroup_hostnames or []
             hostnames = san_list + [f"*.{h}" for h in san_list] if spec.wildcard_enabled else san_list
 
-            zg_update_cmd = {
-                'prefix': 'rgw zonegroup modify',
-                'realm_name': spec.rgw_realm,
-                'zonegroup_name': spec.rgw_zonegroup,
-                'zone_name': spec.rgw_zone,
-                'hostnames': hostnames,
-            }
-            logger.debug(f'rgw cmd: {zg_update_cmd}')
-            ret, out, err = self.mgr.check_mon_command(zg_update_cmd)
+            # zonegroup modify requires explicit realm/zonegroup/zone identifiers.
+            # on single-site deployments, these values may be unset, avoid calling.
+            if not (spec.rgw_realm and spec.rgw_zonegroup and spec.rgw_zone):
+                logger.warning(
+                    f"Skipping 'rgw zonegroup modify' for {spec.service_name()}: "
+                    "zonegroup_hostnames is set but rgw_realm/rgw_zonegroup/rgw_zone "
+                    "were not provided in the spec."
+                )
+            else:
+                zg_update_cmd = {
+                    'prefix': 'rgw zonegroup modify',
+                    'realm_name': spec.rgw_realm,
+                    'zonegroup_name': spec.rgw_zonegroup,
+                    'zone_name': spec.rgw_zone,
+                    'hostnames': hostnames,
+                }
+                logger.debug(f'rgw cmd: {zg_update_cmd}')
+                ret, out, err = self.mgr.check_mon_command(zg_update_cmd)
 
         # TODO: fail, if we don't have a spec
         logger.info('Saving service %s spec with placement %s' % (