summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam King <adking@redhat.com>2024-09-24 18:16:14 +0200
committerAdam King <adking@redhat.com>2024-09-24 18:16:14 +0200
commit3ec029703254c6f9c9b778fb6a09202631a719aa (patch)
treee6ac511fb54a35030637590858c06bacf27ea292
parentMerge pull request #59891 from rhcs-dashboard/fix-68162-main (diff)
downloadceph-3ec029703254c6f9c9b778fb6a09202631a719aa.tar.xz
ceph-3ec029703254c6f9c9b778fb6a09202631a719aa.zip
cephadm: make bootstrap default to "global" section for public_network setting
Fixes: https://tracker.ceph.com/issues/68212 Signed-off-by: Adam King <adking@redhat.com>
-rwxr-xr-xsrc/cephadm/cephadm.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/cephadm/cephadm.py b/src/cephadm/cephadm.py
index 1ab98a0ac4f..135d50dc5f9 100755
--- a/src/cephadm/cephadm.py
+++ b/src/cephadm/cephadm.py
@@ -1986,11 +1986,15 @@ def get_image_info_from_inspect(out, image):
def get_public_net_from_cfg(ctx: CephadmContext) -> Optional[str]:
"""Get mon public network from configuration file."""
cp = read_config(ctx.config)
- if not cp.has_option('global', 'public_network'):
+ public_network = ''
+ if cp.has_option('mon', 'public_network'):
+ public_network = cp.get('mon', 'public_network').strip('"').strip("'")
+ elif cp.has_option('global', 'public_network'):
+ public_network = cp.get('global', 'public_network').strip('"').strip("'")
+ else:
return None
# Ensure all public CIDR networks are valid
- public_network = cp.get('global', 'public_network').strip('"').strip("'")
rc, _, err_msg = check_subnet(public_network)
if rc:
raise Error(f'Invalid public_network {public_network} parameter: {err_msg}')
@@ -2595,7 +2599,7 @@ def finish_bootstrap_config(
if mon_network:
cp = read_config(ctx.config)
- cfg_section = 'global' if cp.has_option('global', 'public_network') else 'mon'
+ cfg_section = 'mon' if cp.has_option('mon', 'public_network') else 'global'
logger.info(f'Setting public_network to {mon_network} in {cfg_section} config section')
cli(['config', 'set', cfg_section, 'public_network', mon_network])