alces-software / adminware

A sandbox CLI for running commands remotely across nodes
1 stars 0 forks source link

Fresh Install Unhelpful Errors #165

Closed ColonelPanicks closed 5 years ago

ColonelPanicks commented 5 years ago

If there are no tools in /var/lib/adminware/tools with a config.yaml file then the CLI bombs out entirely

[root@controller adminware]# bin/run-cli
Traceback (most recent call last):
  File "src/adminware", line 3, in <module>
    from adminware import adminware
  File "/opt/adminware/src/adminware.py", line 19, in <module>
    module.add_commands(adminware)
  File "/opt/adminware/src/commands/run.py", line 48, in add_commands
    @cli_utils.with__node__group
  File "/opt/adminware/src/models/config.py", line 38, in __commands
    config_hash = Config.hashify_all(subcommand_key = 'commands', **kwargs)
  File "/opt/adminware/src/models/config.py", line 80, in hashify_all
    return combined_hash[subcommand_key]
KeyError: 'commands'

This is also the case if no genders file exists

[root@controller adminware]# bin/run-cli
Traceback (most recent call last):
  File "/opt/adminware/src/groups.py", line 60, in __nodeattr
    return local['nodeattr']['-f', file_path](arguments).split(split_char)
  File "/opt/adminware/venv/lib/python3.5/site-packages/plumbum/commands/base.py", line 103, in __call__
    return self.run(args, **kwargs)[1]
  File "/opt/adminware/venv/lib/python3.5/site-packages/plumbum/commands/base.py", line 240, in run
    return p.run()
  File "/opt/adminware/venv/lib/python3.5/site-packages/plumbum/commands/base.py", line 201, in runner
    return run_proc(p, retcode, timeout)
  File "/opt/adminware/venv/lib/python3.5/site-packages/plumbum/commands/processes.py", line 232, in run_proc
    return _check_process(proc, retcode, timeout, stdout, stderr)
  File "/opt/adminware/venv/lib/python3.5/site-packages/plumbum/commands/processes.py", line 23, in _check_process
    proc.verify(retcode, timeout, stdout, stderr)
  File "/opt/adminware/venv/lib/python3.5/site-packages/plumbum/machines/base.py", line 26, in verify
    stderr)
plumbum.commands.processes.ProcessExecutionError: Command line: ['/opt/underware/opt/genders/bin/nodeattr', '-f', '/var/lib/adminware/genders', '-l']
Exit code: 1
Stderr:  | nodeattr: /var/lib/adminware/genders: error opening genders file

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "src/adminware", line 3, in <module>
    from adminware import adminware
  File "/opt/adminware/src/adminware.py", line 19, in <module>
    module.add_commands(adminware)
  File "/opt/adminware/src/commands/view.py", line 27, in add_commands
    @groups_util.group_commands(group, command = group_command)
  File "/opt/adminware/src/groups.py", line 14, in __group_commands
    groups_hash = __hashify_all_groups(**kwargs)
  File "/opt/adminware/src/groups.py", line 25, in __hashify_all_groups
    for group in list():
  File "/opt/adminware/src/groups.py", line 31, in list
    groups = __nodeattr(arguments=['-l'])
  File "/opt/adminware/src/groups.py", line 62, in __nodeattr
    raise ClickException(e.stderr.rstrip())
click.exceptions.ClickException: nodeattr: /var/lib/adminware/genders: error opening genders file

Really neither of these should be program errors but errors with content so a short, user-friendly message would help a lot more.

DavidMarchant commented 5 years ago

Ah right, we'll get on that.

The latter problem, the genders, was (evidently unsuccessfully) attempted to be sorted in https://github.com/alces-software/adminware/pull/83 which was to close https://github.com/alces-software/adminware/issues/71. The second exception that occurs in handling the genders file is from that attempt.

DavidMarchant commented 5 years ago

Hey @ColonelPanicks - in an ideal world would the program still launch with no tools/genders file or is a short, informative error message & boot failure good enough?

DavidMarchant commented 5 years ago

From IRL: It would be better to launch the tool, even with the associated limited functionality, if either the tools or genders are missing