looker-open-source / henry

A command line tool for Looker instance cleanup
MIT License
79 stars 27 forks source link

401 response in check_connections for `henry pulse` #8

Closed JarredLHumphrey closed 4 years ago

JarredLHumphrey commented 4 years ago

When trying to run the pulse command: henry pulse --host 'prod_looker' I get the following error/stacktrace:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.8/bin/henry", line 10, in <module>
    sys.exit(main())
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/henry/cli.py", line 306, in main
    result = pulse.run_all()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/henry/commands/pulse.py", line 28, in run_all
    result = self.check_connections()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/henry/commands/pulse.py", line 88, in check_connections
    for c in self.looker.get_connections():
TypeError: 'NoneType' object is not iterable

Here's the output of the logs with any host or client information redacted. Essentially it seems to authenticate just fine, but then gets a 401 response from the connections endpoint. Are there special permissions I need to setup for the API user on the looker instance in order to allow for these features to be used?

2019-11-21 16:31:43.193 [INFO|main] :: Starting henry
2019-11-21 16:31:43.197 [INFO|main] :: Loaded config settings from ~/.henry/settings.json, {'api_conn_timeout': 15, 'config_path': '/Users/jarred.l.humphrey/.henry/config.yml'}
2019-11-21 16:31:43.204 [INFO|main] :: Parsing args, {'command': 'pulse', 'output': None, 'quiet': False, 'plain': None, 'host': 'prod_looker', 'port': 19999, 'client_id': None, 'client_secret': '[FILTERED]', 'alias': None, 'path': ''}
2019-11-21 16:31:43.204 [INFO|auth] :: Authenticating into Looker API
2019-11-21 16:31:43.204 [INFO|auth] :: Checking permissions for /Users/jarred.l.humphrey/.henry/config.yml
2019-11-21 16:31:43.204 [INFO|auth] :: Opening config file from /Users/jarred.l.humphrey/.henry/config.yml
2019-11-21 16:31:43.207 [INFO|auth] :: Fetching auth credentials from file, /Users/jarred.l.humphrey/.henry/config.yml
2019-11-21 16:31:43.207 [INFO|auth] :: auth params={'host': 'REDACTED', 'port': 19999, 'client_id': 'REDACTED', 'client_secret': '[FILTERED]'}
2019-11-21 16:31:43.207 [INFO|lookerapi] :: Authenticating
2019-11-21 16:31:43.207 [INFO|lookerapi] :: Request to REDACTED => POST /api/3.0/login, {'client_id': 'REDACTED', 'client_secret': '[FILTERED]'}
2019-11-21 16:31:43.600 [INFO|lookerapi] :: Request Complete: 200
2019-11-21 16:31:43.601 [INFO|auth] :: Authentication Successful
2019-11-21 16:31:43.601 [INFO|pulse] :: Checking instance pulse
2019-11-21 16:31:43.601 [INFO|pulse] :: Checking Connections
2019-11-21 16:31:43.602 [INFO|lookerapi] :: Request to REDACTED => GET /api/3.0/connections, {}
2019-11-21 16:31:43.642 [WARNING|lookerapi] :: Request Complete: 401
josephaxisa commented 4 years ago

@JarredLHumphrey is the user an admin?

JarredLHumphrey commented 4 years ago

@josephaxisa Yes the user is an admin.

josephaxisa commented 4 years ago

@JarredLHumphrey apologies for the delay. This is happening because the internal db connection was renamed. I have been doing some work on henry and this will no longer be an issue very soon.