Skip to content

Commit 272dedd

Browse files
Changed pam action rotate output to print gateway in use (#1365)
* changed pam action rotate output to print gateway in use * changed pam action rotate output to print gateway in use
1 parent 398de0b commit 272dedd

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

keepercommander/commands/discover/job_start.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,4 +233,4 @@ def execute(self, params, **kwargs):
233233
print(f"To stop and remove the current job, use the command "
234234
f"'{bcolors.OKGREEN}pam action discover remove -j <Job ID>'.")
235235
else:
236-
print_router_response(router_response, conversation_id)
236+
print_router_response(router_response, "job_info", conversation_id, gateway_uid=gateway_context.gateway_uid)

keepercommander/commands/discoveryrotation.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1975,7 +1975,7 @@ def execute(self, params, **kwargs):
19751975
message_type=pam_pb2.CMT_GENERAL,
19761976
is_streaming=False
19771977
)
1978-
print_router_response(router_response, conversation_id)
1978+
print_router_response(router_response, 'job_info', conversation_id)
19791979

19801980

19811981
class PAMGatewayActionJobCommand(Command):
@@ -2006,7 +2006,7 @@ def execute(self, params, **kwargs):
20062006
destination_gateway_uid_str=gateway_uid
20072007
)
20082008

2009-
print_router_response(router_response, original_conversation_id=conversation_id, response_type='job_info')
2009+
print_router_response(router_response, 'job_info', original_conversation_id=conversation_id, gateway_uid=gateway_uid)
20102010

20112011

20122012
class PAMGatewayActionRotateCommand(Command):
@@ -2134,7 +2134,7 @@ def execute(self, params, **kwargs):
21342134
encrypted_transmission_key=encrypted_transmission_key,
21352135
encrypted_session_token=encrypted_session_token)
21362136

2137-
print_router_response(router_response, 'job_info', conversation_id)
2137+
print_router_response(router_response, 'job_info', conversation_id, gateway_uid=gateway_uid)
21382138

21392139

21402140
class PAMGatewayActionServerInfoCommand(Command):
@@ -2156,7 +2156,7 @@ def execute(self, params, **kwargs):
21562156
destination_gateway_uid_str=destination_gateway_uid_str
21572157
)
21582158

2159-
print_router_response(router_response, response_type='gateway_info', is_verbose=is_verbose)
2159+
print_router_response(router_response, 'gateway_info', is_verbose=is_verbose, gateway_uid=destination_gateway_uid_str)
21602160

21612161

21622162
class PAMGatewayActionDiscoverCommandBase(Command):

keepercommander/commands/discoveryrotation_v1.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,7 +1497,7 @@ def execute(self, params, **kwargs):
14971497
message_type=pam_pb2.CMT_GENERAL,
14981498
is_streaming=False
14991499
)
1500-
print_router_response(router_response, conversation_id)
1500+
print_router_response(router_response, 'job_info', conversation_id)
15011501

15021502

15031503
class PAMGatewayActionJobCommand(Command):
@@ -1529,7 +1529,7 @@ def execute(self, params, **kwargs):
15291529
destination_gateway_uid_str=gateway_uid
15301530
)
15311531

1532-
print_router_response(router_response, original_conversation_id=conversation_id, response_type='job_info')
1532+
print_router_response(router_response, 'job_info', original_conversation_id=conversation_id, gateway_uid=gateway_uid)
15331533

15341534

15351535
class PAMGatewayActionRotateCommand(Command):
@@ -1629,7 +1629,7 @@ def execute(self, params, **kwargs):
16291629
gateway_destination=facade.controller_uid),
16301630
message_type=pam_pb2.CMT_ROTATE, is_streaming=False)
16311631

1632-
print_router_response(router_response, conversation_id)
1632+
print_router_response(router_response, 'job_info', conversation_id, gateway_uid=facade.controller_uid)
16331633

16341634

16351635
class PAMGatewayActionServerInfoCommand(Command):
@@ -1651,7 +1651,7 @@ def execute(self, params, **kwargs):
16511651
destination_gateway_uid_str=destination_gateway_uid_str
16521652
)
16531653

1654-
print_router_response(router_response, response_type='gateway_info', is_verbose=is_verbose)
1654+
print_router_response(router_response, 'gateway_info', is_verbose=is_verbose, gateway_uid=destination_gateway_uid_str)
16551655

16561656

16571657
class PAMGatewayRemoveCommand(Command):

keepercommander/commands/pam/router_helper.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ def get_dag_leafs(params, encrypted_session_token, encrypted_transmission_key, r
427427
return None
428428

429429

430-
def print_router_response(router_response, response_type, original_conversation_id=None, is_verbose=False):
430+
def print_router_response(router_response, response_type, original_conversation_id=None, is_verbose=False, gateway_uid=''):
431431
if not router_response:
432432
return
433433

@@ -463,8 +463,9 @@ def print_router_response(router_response, response_type, original_conversation_
463463
if router_response_response_payload_dict.get('isScheduled') or router_response_response_payload_dict.get('is_scheduled'):
464464
conversation_id = router_response_response_payload_dict.get('conversation_id')
465465

466+
gwinfo = f" --gateway={gateway_uid}" if gateway_uid else ""
466467
print(f"Scheduled action id: {bcolors.OKBLUE}{conversation_id}{bcolors.ENDC}")
467-
print(f"The action has been scheduled, use command '{bcolors.OKGREEN}pam action job-info {conversation_id}{bcolors.ENDC}' to get status of the scheduled action")
468+
print(f"The action has been scheduled, use command '{bcolors.OKGREEN}pam action job-info {conversation_id}{gwinfo}{bcolors.ENDC}' to get status of the scheduled action")
468469
return
469470

470471
elif response_type == 'job_info':

0 commit comments

Comments
 (0)