def szig(params): sz_parser = argparse.ArgumentParser( prog='zorpctl szig', description="Display internal information from the given Zorp instance(s)") sz_parser.add_argument('-w', '--walk', help='Walk the specified tree', nargs='*') sz_parser.add_argument('-r', '--root', help='Set the root node of the walk operation', type=str) sz_args = sz_parser.parse_args(params) if not sz_args.walk: for result in ZorpHandler.szig_walk(sz_args.root): UInterface.informUser(json.dumps(result.value, indent=4) if result else result) else: algorithm = SzigWalkAlgorithm(sz_args.root) for instance in sz_args.walk: results = Zorpctl.runAlgorithmOnProcessOrInstance(instance, algorithm) if utils.isSequence(results): for result in results: UInterface.informUser(json.dumps(result.value, indent=4) if result else result) else: UInterface.informUser(json.dumps(results.value, indent=4) if results else results)
def reload_or_restart(listofinstances): """ Tries to reload Zorp instance(s) by instance name if not succeeded than tries to restart instance(s) expects sequence of name(s) """ UInterface.informUser("Reloading or Restarting Zorp Firewall Suite:") if not listofinstances: reload_result = ZorpHandler.reload() Zorpctl._restartWhichNotReloaded(reload_result) else: for instance_name in listofinstances: reload_result = Zorpctl.runAlgorithmOnProcessOrInstance(instance_name, ReloadAlgorithm()) if utils.isSequence(reload_result): Zorpctl._restartWhichNotReloaded(reload_result) else: if reload_result: UInterface.informUser(reload_result) else: Zorpctl.restart([instance_name])
def _strParams(self): return " ".join(self.params) if utils.isSequence(self.params) else self.params
def _strParams(self): return " ".join(self.params) if utils.isSequence( self.params) else self.params