netfoundry / python-netfoundry

PyPi module "netfoundry"

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

To inform user about the cause of error while loading credential json file

rahulcsaple opened this issue · comments

When wrong path for credential.json file was supplied

(.py39) rahulcs@DESKTOP-FFFN7ID:~/.netfoundry$ nfctl --verbose -C /mnt/c/Users/rahul/Desktop/credentials.json -P cldeng
☐ spinner disabled because DEBUG is enabled
☐ got spinner as function param
☐ token cache dir exists with mode drwx------
☐ cache file path is computed '/home/rahulcs/.cache/netfoundry/cldeng.json'
☐ ignoring exception while checking for token cache, caught cache file '/home/rahulcs/.cache/netfoundry/cldeng.json' not found, caught [Errno 2] No such file or directory: '/home/rahulcs/.cache/netfoundry/cldeng.json'
☐ no bearer token found
☐ got Organization(credentials=/mnt/c/Users/rahul/Desktop/credentials.json)
☐ no credentials file /mnt/c/Users/rahul/Desktop/credentials.json in project-default directory
☐ no credentials file /mnt/c/Users/rahul/Desktop/credentials.json in user-default directory
☐ no credentials file /mnt/c/Users/rahul/Desktop/credentials.json in device-default directory
☐ no credentials file /mnt/c/Users/rahul/Desktop/credentials.json in site-default directory
☐ credentials file '/mnt/c/Users/rahul/Desktop/credentials.json' does not exist
☐ token renewal impossible because API account credentials are not configured
☐ cached token file '/home/rahulcs/.cache/netfoundry/cldeng.json' does not exist
☐ caught no credentials exception from organization, prompting for token
Enter Bearer Token:

image

When correct path for credential.json file was supplied - SUCCESSFUL

(.py39) rahulcs@DESKTOP-FFFN7ID:~/.netfoundry$ nfctl --verbose -C /mnt/c/Users/rahul/Downloads/New_API/credentials.json -P cldeng
☐ spinner disabled because DEBUG is enabled
☐ got spinner as function param
☐ token cache dir exists with mode drwx------
☐ cache file path is computed '/home/rahulcs/.cache/netfoundry/cldeng.json'
☐ ignoring exception while checking for token cache, caught cache file '/home/rahulcs/.cache/netfoundry/cldeng.json' not found, caught [Errno 2] No such file or directory: '/home/rahulcs/.cache/netfoundry/cldeng.json'
☐ no bearer token found
☐ got Organization(credentials=/mnt/c/Users/rahul/Downloads/New_API/credentials.json)
☐ found credentials file '/mnt/c/Users/rahul/Downloads/New_API/credentials.json'
☐ configured credentials from file '/mnt/c/Users/rahul/Downloads/New_API/credentials.json'
☐ cached token file '/home/rahulcs/.cache/netfoundry/cldeng.json' does not exist
☐ renewing token with credentials
☐ using environment parsed from token_endpoint URL production
☐ using audience parsed from token_endpoint URL https://gateway.production.netfoundry.io/
☐ Starting new HTTPS connection (1): netfoundry-production-xfjiye.auth.us-east-1.amazoncognito.com:443
https://netfoundry-production-xfjiye.auth.us-east-1.amazoncognito.com:443 "POST /oauth2/token HTTP/1.1" 200 None
☐ computed expiry epoch 1652197778 from 'expires_in=3600'
☐ bearer token expiry in 3600s
☐ cached token in '/home/rahulcs/.cache/netfoundry/cldeng.json'
☐ detected resource type identities
☐ no handlers specified for url 'https://gateway.production.netfoundry.io/identity/v1/identities/self'
☐ Starting new HTTPS connection (1): gateway.production.netfoundry.io:443
https://gateway.production.netfoundry.io:443 "GET /identity/v1/identities/self HTTP/1.1" 200 None
https://gateway.production.netfoundry.io:443 "GET /rest/v1/network-groups?sort=name%2Casc&size=1000&page=1 HTTP/1.1" 200 None
☐ detected resource type organizations
☐ no handlers specified for url 'https://gateway.production.netfoundry.io/identity/v1/organizations/95068bb0-864b-4930-b06e-9acf4957c826'
https://gateway.production.netfoundry.io:443 "GET /identity/v1/organizations/95068bb0-864b-4930-b06e-9acf4957c826 HTTP/1.1" 200 None
https://gateway.production.netfoundry.io:443 "GET /rest/v1/network-groups?sort=name%2Casc&size=1000&page=1 HTTP/1.1" 200 None
☐ logged-in organization label is cldeng.
☐ not configuring network or network group
Domain | Summary
-----------+----------------------------------------------------------
Caller ID | rahul api (rahul.saple@netfoundry.io) in cldeng (cldeng)

ℹ try running 'nfctl list networks'

It would be helpful for the user if exact reason of failure is indicated as a message.

Ref: https://mattermost.tools.netfoundry.io/netfoundry/pl/ic8jt5yrfbb9xr3gqarpcztqgo