Skip to content

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

@JoelRiglerIG

Description

@JoelRiglerIG

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions