duckietown / duckietown-shell

Other
3 stars 6 forks source link

`dts update` crashes if a version of the commands has been removed #65

Open liampaull opened 4 years ago

liampaull commented 4 years ago

If a version is removed (in this case daffy-new-init) and you run dts update you get this error and it fails:

dts :  Traceback (most recent call last):
    :    File "/home/liam/.local/lib/python3.6/site-packages/dt_shell/main.py", line 38, in cli_main
    :      cli_main_()
    :    File "/home/liam/.local/lib/python3.6/site-packages/dt_shell/main.py", line 175, in cli_main_
    :      shell.onecmd(cmdline)
    :    File "/usr/lib/python3.6/cmd.py", line 217, in onecmd
    :      return func(arg)
    :    File "/home/liam/.local/lib/python3.6/site-packages/dt_shell/cli.py", line 287, in <lambda>
    :      do_command_lam = lambda s, w: do_command(klass, s, w)
    :    File "/home/liam/.local/lib/python3.6/site-packages/dt_shell/dt_command_abs.py", line 59, in do_command
    :      cls.command(shell, args)
    :    File "/home/liam/.dt-shell/commands-multi/daffy-new-init/update/command.py", line 19, in command
    :      if shell.update_commands():
    :    File "/home/liam/.local/lib/python3.6/site-packages/dt_shell/cli.py", line 328, in update_commands
    :      return update_commands(self.commands_path, self.repo_info)
    :    File "/home/liam/.local/lib/python3.6/site-packages/dt_shell/commands_.py", line 133, in update_commands
    :      repo_info.branch
    :    File "/home/liam/.local/lib/python3.6/site-packages/dt_shell/utils.py", line 121, in run_cmd
    :      raise RuntimeError(msg)
    :  RuntimeError: The command ['git', '-C', '/home/liam/.dt-shell/commands-multi/daffy-new-init', 'pull', '--recurse-submodules', 'origin', 'daffy-new-init'] failed with exit code 1.
    :  Error:
    :  None
liampaull commented 4 years ago

note that this only happens if you are still in the version that you are trying to update. So an easy fix is to switch to a valid version and update. So it just could be a little more graceful.