Skip to content

Commit

Permalink
fix for show process not working
Browse files Browse the repository at this point in the history
  • Loading branch information
Arunsundar Kannan committed Sep 11, 2019
1 parent 17688c3 commit c0b4b26
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
12 changes: 8 additions & 4 deletions src/CLI/actioner/sonic-cli-pfm.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,18 @@ def run(func, args):

else :
api_response = getattr(aa,func.__name__)(*keypath)

if api_response is None:
print ("Success")
else:
response = api_response.to_dict()
value = response['openconfig_platformcomponents']['component'][0]['state']
if value is None:
api_response = aa.api_client.sanitize_for_serialization(api_response)
value = api_response['openconfig-platform:components']['component'][0]['state']
if value is None:
return
if 'oper-status' in value:
temp = value['oper-status'].split(':')
if temp[1] is not None:
value['oper-status'] = temp[1]
show_cli_output(sys.argv[2],filter_json_value(value))

except ApiException as e:
Expand Down
6 changes: 2 additions & 4 deletions src/CLI/actioner/sonic-cli-sys.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,9 @@ def run(func, args):
try:
if body is not None:
api_response = getattr(aa,func.__name__)(*keypath, body=body)

else :
api_response = getattr(aa,func.__name__)(*keypath)
#print(api_response)
if api_response is None:
print ("Success")
else:
Expand All @@ -105,7 +104,7 @@ def run(func, args):
show_cli_output(sys.argv[2], value['cpu'])
elif 'openconfig_systemprocesses' in response.keys():
value = response['openconfig_systemprocesses']
if len(sys.argv) < 4:
if 'pid' not in sys.argv:
if value is None:
return
show_cli_output(sys.argv[2],value['process'])
Expand All @@ -114,7 +113,6 @@ def run(func, args):
if proc['pid'] == int(sys.argv[3]):
show_cli_output(sys.argv[2],util_capitalize(proc['state']))
return
print("command works")
else:
print("Failed")
except ApiException as e:
Expand Down

0 comments on commit c0b4b26

Please sign in to comment.