looker-open-source / henry

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

Do we use a .ini or a .yml for credentials? #47

Closed taylor67 closed 1 year ago

taylor67 commented 3 years ago

Hello, I'm confused because the docs here (https://github.com/looker-open-source/henry#usage) say to create an .ini file, but the docs here (https://github.com/looker-open-source/henry/wiki/Getting-Started#credentials) say to create a config.yml file. Which is right? Will either work?

I set up both. When I try to run something without specifying the path, I get "Missing required configuration values like base_url and api_version".

When I try to specify $ henry analyze models --path /home/tomeara/Looker.ini (or same thing but with config location) I get "henry: error: unrecognized arguments: --path /home/tomeara/Looker.ini"

My Looker.ini file looks like this:

[Looker]
# Base URL for API. Do not include /api/* in the url
base_url=https://looker.xxx.com:19999
# API 3 client id
client_id=xxx
# API 3 client secret
client_secret=xxx
# Set to false if testing locally against self-signed certs. Otherwise leave True
verify_ssl=True

My config.yml file looks like this:

hosts:
        looker:
                host: looker.xxx.com
                id: xxx
                secret: xxx
makhai88 commented 3 years ago

henry analyze models --path=/home/tomeara/Looker.ini

I also have issues with setting uo looker.ini file i get a parser error try above, it might work

josephaxisa commented 3 years ago

Hi @taylor67 , thanks for raising this. You should be using a .ini file, not a YAML file. This package used to rely on yaml before it relied on the Looker API SDK. Please refer to this for how to get started.

Please ensure you are on version 0.2.3 using pip install -U henry. Note that this requires Python <3.8.

The command should be: henry analyze models --config-path /path/to/looker.ini

makhai88 commented 3 years ago

@josephaxisa henry analyze models --config-path /path/to/looker.ini

that command gave me this error,

usage: henry command subcommand [subcommand options] [global options]
henry: error: unrecognized arguments: --config-path /home/user/looker.ini

but

henry analyze models --path /home/user/looker.ini

gives a parser error

Traceback (most recent call last):
  File "/home/user/.local/bin/henry", line 8, in <module>
    sys.exit(main())
  File "/home/user/.local/lib/python3.8/site-packages/henry/cli.py", line 281, in main
    looker = authenticate(timeout, session_info, config_path, **auth_args)
  File "/home/user/.local/lib/python3.8/site-packages/henry/modules/auth.py", line 35, in authenticate
    params = yaml.safe_load(f)
  File "/usr/lib/python3/dist-packages/yaml/__init__.py", line 162, in safe_load
    return load(stream, SafeLoader)
  File "/usr/lib/python3/dist-packages/yaml/__init__.py", line 114, in load
    return loader.get_single_data()
  File "/usr/lib/python3/dist-packages/yaml/constructor.py", line 49, in get_single_data
    node = self.get_single_node()
  File "/usr/lib/python3/dist-packages/yaml/composer.py", line 39, in get_single_node
    if not self.check_event(StreamEndEvent):
  File "/usr/lib/python3/dist-packages/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
  File "/usr/lib/python3/dist-packages/yaml/parser.py", line 171, in parse_document_start
    raise ParserError(None, None,
yaml.parser.ParserError: expected '<document start>', but found '<scalar>'
  in "/home/user/looker.ini", line 2, column 1
mmarketfinishline commented 2 years ago

Hi @taylor67 , thanks for raising this. You should be using a .ini file, not a YAML file. This package used to rely on yaml before it relied on the Looker API SDK. Please refer to this for how to get started.

Please ensure you are on version 0.2.3 using pip install -U henry. Note that this requires Python <3.8.

The command should be: henry analyze models --config-path /path/to/looker.ini

do you mean henry 0.1.3?

josephaxisa commented 2 years ago

I mean 0.2.3. If you are getting 0.1.3 it probably means that you are using python >3.8

mmarketfinishline commented 2 years ago

got it

thank you, Joseph!

henrymei commented 2 years ago

Looks like the python version strictly needs to be 3.7.*

dpizzitola-bytecode commented 2 years ago

@henrymei - I'm using python 3.7.11 in a conda virtual env. I installed henry using the command @josephaxisa specified above. However, I'm running into the same problem @makhai88 noted above with the unrecognized arguments if trying --config-path, and, otherwise, getting the parse error. Any suggestions?

josephaxisa commented 2 years ago

@dpizzitola-bytecode can you confirm you are using v0.2.3?

dpizzitola-bytecode commented 2 years ago

@josephaxisa - Yes, ran pip freeze and confirmed henry 0.2.3

josephaxisa commented 2 years ago

does henry -h show --config-path as an option?

dpizzitola-bytecode commented 2 years ago

@josephaxisa here's what I get: image

josephaxisa commented 1 year ago

this should no longer be an issue, see #53