CloudGenix / cloudgenix_config

Configuration exporting and Continuous Integration (CI) capable configuration importing for the CloudGenix Cloud Controller.
MIT License
12 stars 22 forks source link

Can't pull sites with tenant read-only token #104

Open pwalker99 opened 8 months ago

pwalker99 commented 8 months ago

Hi, I have a script which uses the CloudGenix SDK to pull down configuration, which we store as a backup. I have a problem where I cannot pull the config with the view only auth token. This means I have to give the script more privileged access than required, in the form of an auth token with read/write permissions.

ERROR: Device ID Config SNMP Discovery Start Nodes Fetch Failed: 
REQUEST: GET /v2.0/api/tenants/1512759107/sites/1702306018779018138/deviceidconfigs/1702306018901019338/snmpdiscoverystartnodes
REQUEST HEADERS:
    User-Agent: python-requests/2.31.0 (CGX SDK v6.3.2b1)
    Accept-Encoding: gzip, deflate
    Accept: application/json
    Connection: keep-alive
    X-Auth-Token: <SENSITIVE - NOT SHOWN BY DEFAULT>
    Cookie: AUTH_TOKEN="<SENSITIVE - NOT SHOWN BY DEFAULT>"
REQUEST BODY:
{}

RESPONSE: 403 Forbidden
RESPONSE HEADERS:
    Date: Tue, 12 Mar 2024 12:21:02 GMT
    Content-Length: 0
    Connection: keep-alive
    Server: nginx
RESPONSE DATA:
{}
Traceback (most recent call last):
  File "/home/runner/work/PrismaSD-WAN/PrismaSD-WAN/cloudgenix/pull_site.py", line 5, in <module>
    go()
  File "/home/runner/work/PrismaSD-WAN/PrismaSD-WAN/cloudgenix/cloudgenix_config/pull.py", line 2277, in go
    pull_config_sites(args['sites'], filename, output_multi=multi_output, normalize=normalize,
  File "/home/runner/work/PrismaSD-WAN/PrismaSD-WAN/cloudgenix/cloudgenix_config/pull.py", line 2061, in pull_config_sites
    _pull_config_for_single_site(val['id'])
  File "/home/runner/work/PrismaSD-WAN/PrismaSD-WAN/cloudgenix/cloudgenix_config/pull.py", line 1043, in _pull_config_for_single_site
    throw_error("Device ID Config SNMP Discovery Start Nodes Fetch Failed: ", response)
  File "/home/runner/work/PrismaSD-WAN/PrismaSD-WAN/cloudgenix/cloudgenix_config/__init__.py", line 138, in throw_error
    raise CloudGenixConfigError(message)
cloudgenix_config.CloudGenixConfigError: Device ID Config SNMP Discovery Start Nodes Fetch Failed: 

key issues