Skip to content

Commit 3ca8a6f

Browse files
Part of review changes to retrigger package build
1 parent 220f03f commit 3ca8a6f

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

cmapi/cmapi_server/failover_agent.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,10 @@ def enterStandbyMode(self, test_mode = False):
9595
try:
9696
# TODO: remove test_mode condition and add mock for testing
9797
if not test_mode:
98-
MCSProcessManager.stop_node(is_primary=nc.is_primary_node(), is_read_only=nc.is_read_only())
98+
MCSProcessManager.stop_node(
99+
is_primary=nc.is_primary_node(),
100+
is_read_only=nc.is_read_only(),
101+
)
99102
logger.info(
100103
'FA.enterStandbyMode(): successfully stopped node.'
101104
)

cmapi/cmapi_server/handlers/cluster.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,10 @@ def add_node(
219219
:return: result of adding node
220220
:rtype: dict
221221
"""
222-
logger.debug('Cluster add node command called. Adding node %s in %s mode.', node, 'read-only' if read_only else 'read-write')
222+
logger.debug(
223+
'Cluster add node command called. '
224+
f'Adding node {node} in {"read-only" if read_only else "read-write"} mode.'
225+
)
223226

224227
response = {'timestamp': str(datetime.now())}
225228
transaction_id = get_id()
@@ -251,7 +254,7 @@ def add_node(
251254
output_config_filename=config
252255
)
253256
else:
254-
logger.debug("Node %s is read-only, skipping dbroot addition", node)
257+
logger.debug(f"Node {node} is read-only, skipping dbroot addition")
255258

256259
except Exception as err:
257260
rollback_transaction(transaction_id, cs_config_filename=config)

cmapi/cmapi_server/helpers.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,7 @@ def get_desired_nodes(config=DEFAULT_MCS_CONF_PATH):
519519

520520

521521
def get_read_only_nodes(root) -> list[str]:
522+
"""Get names of read-only nodes from config"""
522523
return [node.text for node in root.findall("./ReadOnlyNodes/Node")]
523524

524525

@@ -580,8 +581,8 @@ def get_dbroots(node, config=DEFAULT_MCS_CONF_PATH):
580581
)
581582

582583
if dbroots and nc.is_read_only():
583-
logger = logging.getLogger("dbroots")
584-
logger.warning("Config contains dbroots %s for this read-only node, ignoring", dbroots)
584+
logger = logging.getLogger('dbroots')
585+
logger.warning(f'Config contains dbroots {dbroots} for this read-only node, ignoring')
585586
return []
586587

587588
return dbroots

cmapi/cmapi_server/managers/process.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,12 @@ def is_node_processes_ok(
405405
return set(node_progs) == set(p['name'] for p in running_procs)
406406

407407
@classmethod
408-
def start_node(cls, is_primary: bool, use_sudo: bool = True, is_read_only: bool = False) -> None:
408+
def start_node(
409+
cls,
410+
is_primary: bool,
411+
use_sudo: bool = True,
412+
is_read_only: bool = False,
413+
) -> None:
409414
"""Start mcs node processes.
410415
411416
:param is_primary: is node primary or not, defaults to True
@@ -431,7 +436,10 @@ def start_node(cls, is_primary: bool, use_sudo: bool = True, is_read_only: bool
431436
cls._wait_for_workernodes()
432437
if prog_name in (MCSProgs.DML_PROC.value, MCSProgs.DDL_PROC.value):
433438
cls._wait_for_controllernode()
434-
if is_read_only and prog_name == MCSProgs.WRITE_ENGINE_SERVER.value:
439+
if (
440+
is_read_only and
441+
prog_name == MCSProgs.WRITE_ENGINE_SERVER.value
442+
):
435443
logging.debug('Node is in read-only mode, not starting WriteEngine')
436444
continue
437445
if not cls.start(prog_name, is_primary, use_sudo):

0 commit comments

Comments
 (0)