Skip to content

Can't launch hab launcher if the user pref points to an invalid URI #13

@MHendricks

Description

@MHendricks

Summary

If the user pref points to a URI that can't be resolved hab launcher exits before the user can choose a different URI. In this case there is a missing distro.

Expected Behavior

The launcher should still show the interface and allow the user to choose a different URI.

Steps to Reproduce Behavior

  1. Use hab set-uri ... to update the user pref to point to a URI.
  2. Make sure the URI can't be resolved by removing access to a distro .hab.json file.
  3. Run hab gui launcher and the error should be reported. I'm using the MessageBoxInit so a message box is shown, once I hit Ok the application exits.

Alternatively you can choose the bad URI in the launcher gui, it will error out but remember the bad URI when you close it.

Solution

A possible solution is to clear the saved URI in this case, then the user can choose a valid URI.

Environment

hab==0.27.0
hab-gui==0.9.0
Windows 10

Additional Context

Traceback (most recent call last):
  File "C:\Program Files\Python39\lib\site-packages\hab_gui\windows\alias_launch_window.py", line 188, in uri_changed
    self.alias_buttons.refresh()
  File "C:\Program Files\Python39\lib\site-packages\hab_gui\widgets\alias_button_grid.py", line 51, in refresh
    cfg = self.resolver.resolve(self.uri)
  File "C:\Program Files\Python39\lib\site-packages\hab\resolver.py", line 289, in resolve
    return context.reduced(self, uri=uri)
  File "C:\Program Files\Python39\lib\site-packages\hab\parsers\hab_base.py", line 604, in reduced
    return FlatConfig(self, resolver, uri=uri)
  File "C:\Program Files\Python39\lib\site-packages\hab\parsers\flat_config.py", line 27, in __init__
    self._collect_values(self.original_node)
  File "C:\Program Files\Python39\lib\site-packages\hab\parsers\hab_base.py", line 86, in _collect_values
    if getattr(self, attrname) != NotSet:
  File "C:\Program Files\Python39\lib\site-packages\hab\parsers\flat_config.py", line 151, in environment
    for version in self.versions:
  File "C:\Program Files\Python39\lib\site-packages\hab\parsers\flat_config.py", line 210, in versions
    reqs = self.resolver.resolve_requirements(self.distros)
  File "C:\Program Files\Python39\lib\site-packages\hab\resolver.py", line 303, in resolve_requirements
    return solver.resolve()
  File "C:\Program Files\Python39\lib\site-packages\hab\solvers.py", line 190, in resolve
    return self._resolve(self.requirements)
  File "C:\Program Files\Python39\lib\site-packages\hab\solvers.py", line 143, in _resolve
    raise InvalidRequirementError(
hab.errors.InvalidRequirementError: Unable to find a distro for requirement: nuke14.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions