def safe_zkfc_op(action, env): """ Idempotent operation on the zkfc process to either start or stop it. :param action: start or stop :param env: environment """ Logger.info("Performing action {0} on zkfc.".format(action)) zkfc = None if action == "start": try: zkfc = ZkfcSlave() zkfc.status(env) except ComponentIsNotRunning: if zkfc: zkfc.start(env) if action == "stop": try: zkfc = ZkfcSlave() zkfc.status(env) except ComponentIsNotRunning: pass else: if zkfc: zkfc.stop(env)
def safe_zkfc_op(action, env): """ Idempotent operation on the zkfc process to either start or stop it. :param action: start or stop :param env: environment """ Logger.info("Performing action {0} on zkfc.".format(action)) zkfc = None zkfc_slave = ZkfcSlave() if action == "start": try: zkfc_slave.status(env) except ComponentIsNotRunning: zkfc_slave.start(env) if action == "stop": try: zkfc_slave.status(env) except ComponentIsNotRunning: pass else: zkfc_slave.stop(env)
def safe_zkfc_op(action, env): """ Idempotent operation on the zkfc process to either start or stop it. :param action: start or stop :param env: environment """ zkfc = None if action == "start": try: zkfc = ZkfcSlave() zkfc.status(env) except ComponentIsNotRunning: if zkfc: zkfc.start(env) if action == "stop": try: zkfc = ZkfcSlave() zkfc.status(env) except ComponentIsNotRunning: pass else: if zkfc: zkfc.stop(env)