Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

intro-dnac/cmd-run/show_command.py fails to execute with traceback in observer ('devnetuser') role. #71

Open
JoelRiglerIG opened this issue Dec 13, 2019 · 1 comment

Comments

@JoelRiglerIG
Copy link
Contributor

JoelRiglerIG commented Dec 13, 2019

Traceback:

(venv) JRIGLER-M-G5SZ:intro-dnac jrigler$ ./cmd-run/show_command.py Traceback (most recent call last): File "./cmd-run/show_command.py", line 112, in <module> results_fileId = execute_commands(token, deviceIdList, commandList) File "./cmd-run/show_command.py", line 47, in execute_commands task_result = post_and_wait(token,url, payload) File "./cmd-run/show_command.py", line 25, in post_and_wait taskid = response.json()['response']['taskId'] KeyError: 'response'

Associated code line (line 25):

taskid = response.json()['response']['taskId']

when parsing response from '/v1/network-device-poller/cli/read-request'.

Running as 'devnetuser' against Always On SandBox (1.2.6)
(
* URL: https://sandboxdnac.cisco.com/
* Username: devnetuser
* Password: Cisco123!
)

Executing with same credentials in POSTMAN returns results:
HTTP Status: 403 Forbidden
and
{
"message": "Role does not have valid permissions to access the API"
}

This sample code is used in Learning Lab "Execute Commands Across the Network with Cisco DNA Center Platform and Command Runner", so should not fail - with traceback but should handle invalid role.

@JoelRiglerIG JoelRiglerIG changed the title infro-dnac/cmd-run/show_command.py fails to execute with traceback. Failure to obtain 'taskId' infro-dnac/cmd-run/show_command.py fails to execute with traceback in observer ('devnetuser') role. Dec 14, 2019
@JoelRiglerIG JoelRiglerIG changed the title infro-dnac/cmd-run/show_command.py fails to execute with traceback in observer ('devnetuser') role. info-dnac/cmd-run/show_command.py fails to execute with traceback in observer ('devnetuser') role. Dec 18, 2019
@JoelRiglerIG JoelRiglerIG changed the title info-dnac/cmd-run/show_command.py fails to execute with traceback in observer ('devnetuser') role. intro-dnac/cmd-run/show_command.py fails to execute with traceback in observer ('devnetuser') role. Dec 18, 2019
@robertcsapo
Copy link

@JoelRiglerIG seems like this was fixed in commit 276c8a7

/dne-dna-code/intro-dnac/04_Cmd_Runner# python cmd_runner.py 
hostname                 id                       
3504_WLC                 72dc1f0a-e4da-4ec3-a055-822416894dd5
AAA                      3dd27ed6-44f9-486d-abaf-a779781431a0
leaf2.abc.inc            5bc5b967-3f83-4195-891c-788f3e9048f3
spine1.abc.inc           2f0b7d3b-c9e1-491e-a584-f272b5403719

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants