Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack trace printout when system is not configured #517

Closed
Kirill888 opened this issue Jul 23, 2018 · 5 comments
Closed

Stack trace printout when system is not configured #517

Kirill888 opened this issue Jul 23, 2018 · 5 comments
Assignees
Labels
easy A good place to start for newcomers to Data Cube usability

Comments

@Kirill888
Copy link
Member

Expected behaviour

Expect to see some helpful message

Actual behaviour

See ValueError stack trace

Traceback (most recent call last):
  File "/usr/local/bin/datacube", line 11, in <module>
    load_entry_point('datacube==1.6rc2+83.gc2d0ac22', 'console_scripts', 'datacube')()
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/datacube/ui/click.py", line 190, in new_func
    parsed_config = config.LocalConfig.find(paths=paths, env=specific_environment)
  File "/usr/local/lib/python3.6/dist-packages/datacube/config.py", line 116, in find
    env=env,
  File "/usr/local/lib/python3.6/dist-packages/datacube/config.py", line 94, in __init__
    raise ValueError('No ODC environment, checked configurations for %s' % fallbacks)
ValueError: No ODC environment, checked configurations for ['default', 'datacube']

Steps to reproduce the behaviour

Run datacube system check in the environment where there is no ~/.datacube.conf and no /etc/datacube.conf and DATACUBE_CONFIG_PATH is not set.

Exception is raised from LocalConfig constructor and is not caught by adapter helper in datacube.ui.click

Similar issues with pass_index decorator, if there are exceptions they should be caught and converted to proper termination via click library "abort with error message mechanisms".

Environment information

This is develop on Ubuntu 18.04, but really anywhere will trigger the same error, and problem applies to older versions probably also.

@alexgleith alexgleith added the easy A good place to start for newcomers to Data Cube label Aug 14, 2019
@jcrattz
Copy link

jcrattz commented Dec 9, 2019

So we'll need to check if the configuration file exists, and if it doesn't, inform the user (also linking to the documentation on the config file?) but is there anything else about this that we should know (common error cases other than the config not existing where expected)?

@omad
Copy link
Member

omad commented Dec 9, 2019

I think the main error is when no configuration file exists. I believe there are already reasonable error messages printed for things like the database not being initialised, or not being able to connect to the database.

The change @Kirill888 mentioned in the Zoom about configuration via environment variables alone will impact this, but, can be dealt with later.

@jcrattz
Copy link

jcrattz commented Dec 10, 2019

So is it OK for me to work on this, or should I work on something else?

@omad
Copy link
Member

omad commented Dec 10, 2019

Go for it!

@Kirill888
Copy link
Member Author

I can add config from ENV in a way that should not interfere with your work @jcrattz, I'll start with just copying functions for parsing that, we can plug it in later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy A good place to start for newcomers to Data Cube usability
Projects
None yet
Development

No branches or pull requests

4 participants