Skip to content

Commit

Permalink
Fix output redirection for get_subsystems CLI output.
Browse files Browse the repository at this point in the history
Fixes #800

Signed-off-by: Gil Bregman <[email protected]>
  • Loading branch information
gbregman committed Aug 20, 2024
1 parent a7b0b7f commit 3314c23
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion control/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1824,14 +1824,16 @@ def namespace(self, args):
@cli.cmd()
def get_subsystems(self, args):
"""Get subsystems"""
out_func, err_func = self.get_output_functions(args)

subsystems = self.stub.get_subsystems(pb2.get_subsystems_req())
if args.format == "python":
return subsystems
subsystems_out = json_format.MessageToJson(
subsystems,
indent=4, including_default_value_fields=True,
preserving_proto_field_name=True)
self.logger.info(f"Get subsystems:\n{subsystems_out}")
out_func(f"Get subsystems:\n{subsystems_out}")

def main_common(client, args):
client.logger.setLevel(GatewayEnumUtils.get_value_from_key(pb2.GwLogLevel, args.log_level.lower()))
Expand Down

0 comments on commit 3314c23

Please sign in to comment.