onelogin-aws-cli icon indicating copy to clipboard operation
onelogin-aws-cli copied to clipboard

0.1.10&0.1.11: onelogin-aws-login fails with an unintuitive error message when `-C` is not provided

Open mumoshu opened this issue 7 years ago • 2 comments

Starting v0.1.10, running onelogin-aws-login with the legacy config(not [defaults] but [default] section exists) just fails like this:

$ onelogin-aws-login
Traceback (most recent call last):
  File "/Users/kuoka-yusuke/.pyenv/versions/3.6.5/bin/onelogin-aws-login", line 11, in <module>
    load_entry_point('onelogin-aws-cli==0.1.10', 'console_scripts', 'onelogin-aws-login')()
  File "/Users/kuoka-yusuke/.pyenv/versions/3.6.5/lib/python3.6/site-packages/onelogin_aws_cli/cli.py", line 43, in login
    config_section, args = _load_config(parser, cfg, args)
  File "/Users/kuoka-yusuke/.pyenv/versions/3.6.5/lib/python3.6/site-packages/onelogin_aws_cli/cli.py", line 22, in _load_config
    config_section = config_file.section(cli_args.config_name)
  File "/Users/kuoka-yusuke/.pyenv/versions/3.6.5/lib/python3.6/site-packages/onelogin_aws_cli/configuration.py", line 72, in section
    self.add_section(section_name)
  File "/Users/kuoka-yusuke/.pyenv/versions/3.6.5/lib/python3.6/configparser.py", line 1199, in add_section
    self._validate_value_types(section=section)
  File "/Users/kuoka-yusuke/.pyenv/versions/3.6.5/lib/python3.6/configparser.py", line 1172, in _validate_value_types
    raise TypeError("section names must be strings")
TypeError: section names must be strings

A work-around is to specify -C default so that the full command looks like:

onelogin-aws-login -C default

Is this an expected behavior? Would you mind if I brought back the default config name selection of default?

BTW, if you haven't specified -d $duration_seconds, you encounter #83. But that's another story.

mumoshu avatar Apr 18 '18 07:04 mumoshu

Just took a test drive of 0.1.11 with the fix #87:

$ pip3 install --upgrade onelogin-aws-cli

$ onelogin-aws-login -v
onelogin-aws-login 0.1.11

I wonder if this is still not what you expect 🤔as vanilla onelogin-aws-login without -C default still fails almost silently like:

$ onelogin-aws-login
'base_uri'
$ echo $?
1

Note that my workaround of explicitly providing the default configuration still works:

$ onelogin-aws-login -C default
Google Authenticator Token:

Btw, thank you so much for your efforts on maintaining this! I appreciate it very much.

mumoshu avatar May 02 '18 09:05 mumoshu

Ok, at the very least we should have a better error message when base_uri is not specified.

However, the config does use defaults now instead of default so you'll have to do the renaming manually.

slycoder avatar May 02 '18 15:05 slycoder