yo8192/octo2influx

Issue with octo2influx.py

jonny190 opened this issue · 4 comments

Any ideas on this?

octoimport-octo2influx-1 | Traceback (most recent call last):
octoimport-octo2influx-1 | File "/usr/src/app/./octo2influx.py", line 398, in
octoimport-octo2influx-1 | logging.root.setLevel(cfg['loglevel'])
octoimport-octo2influx-1 | File "/usr/src/app/./octo2influx.py", line 130, in getitem
octoimport-octo2influx-1 | return self.get_validated(key)
octoimport-octo2influx-1 | File "/usr/src/app/./octo2influx.py", line 119, in get_validated
octoimport-octo2influx-1 | value = super().getitem(key).get(self.params[key].cfg_type)
octoimport-octo2influx-1 | File "/usr/local/lib/python3.10/site-packages/confuse/core.py", line 293, in get
octoimport-octo2influx-1 | return templates.as_template(template).value(self, template)
octoimport-octo2influx-1 | File "/usr/local/lib/python3.10/site-packages/confuse/templates.py", line 48, in value
octoimport-octo2influx-1 | return self.convert(value, view)
octoimport-octo2influx-1 | File "/usr/local/lib/python3.10/site-packages/confuse/templates.py", line 277, in convert
octoimport-octo2influx-1 | self.fail(
octoimport-octo2influx-1 | File "/usr/local/lib/python3.10/site-packages/confuse/templates.py", line 87, in fail
octoimport-octo2influx-1 | raise exc_class(u'{0}: {1}'.format(view.name, message))
octoimport-octo2influx-1 | confuse.exceptions.ConfigValueError: loglevel: must be one of ['INFO', 'DEBUG', 'WARNING', 'ERROR'], not 'info'
octoimport-octo2influx-1 | 2024-03-26 17:41:19 Sleeping 1h...

Can you check the value of loglevel in your config is in upper case (as in the example config)?

Also if you use the command line parameter --loglevel or the env var octo2influx_loglevel, did you give the value in upper case too? (i.e. INFO, not info)

It does fail with lower case info:

$ python3 ./octo2influx.py --loglevel info
[...]
confuse.exceptions.ConfigValueError: loglevel: must be one of ['INFO', 'DEBUG', 'WARNING', 'ERROR'], not 'info'

but works with the upper case INFO:

$  python3 ./octo2influx.py --loglevel INFO

(arguably octo2influx could always convert the value uppercase so it's less error-prone)

Actually I've just realized that the default value of loglevel if the invalid lowercase info if you don't specify anything and you don't have a config file. That's wrong and I'll fix it. However that also suggests you haven't created a config file (e.g. by renaming the example and editing it): you'll need to do that for octo2influx to work.

I've just merged #2 to fix that default loglevel value.

Looks good to me :)