From 3ec029703254c6f9c9b778fb6a09202631a719aa Mon Sep 17 00:00:00 2001 From: Adam King Date: Tue, 24 Sep 2024 12:16:14 -0400 Subject: cephadm: make bootstrap default to "global" section for public_network setting Fixes: https://tracker.ceph.com/issues/68212 Signed-off-by: Adam King --- src/cephadm/cephadm.py | 10 +++++++--- 1 file 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]) -- cgit v1.2.3