Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tool crushes if the vm name is wrong #22

Closed
ebenezergraham opened this issue Sep 6, 2023 · 1 comment
Closed

Tool crushes if the vm name is wrong #22

ebenezergraham opened this issue Sep 6, 2023 · 1 comment
Assignees

Comments

@ebenezergraham
Copy link

ebenezergraham commented Sep 6, 2023

Gracefully handle erronous VMs and allow the user correct the name or even better suggest the correct name

gce-rescue --zone europe-central2-a --name test
Traceback (most recent call last):
  File "/home/username/.local/bin/gce-rescue", line 8, in <module>
    sys.exit(main())
  File "/home/username/.local/lib/python3.9/site-packages/gce_rescue/bin/rescue.py", line 44, in main
    vm = Instance(test_mode=False, **parse_kwargs)
  File "<string>", line 12, in __init__
  File "/home/username/.local/lib/python3.9/site-packages/gce_rescue/gce.py", line 116, in __post_init__
    self.compute = check.compute
  File "/home/username/.local/lib/python3.9/site-packages/gce_rescue/tasks/pre_validations.py", line 52, in compute
    return self._authentication()
  File "/home/username/.local/lib/python3.9/site-packages/gce_rescue/tasks/pre_validations.py", line 39, in _authentication
    return authenticate_check(
  File "/home/username/.local/lib/python3.9/site-packages/gce_rescue/tasks/validations/authentication.py", line 66, in authenticate_check
    request.execute()
  File "/usr/local/lib/python3.9/dist-packages/googleapiclient/_helpers.py", line 130, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/googleapiclient/http.py", line 938, in execute
    raise HttpError(resp, content, uri=self.uri)
@halleysouza
Copy link
Collaborator

Thanks @ebenezergraham

For now I think we can better handle this exception here:

return compute.instances().get(

I like the idea of suggestions, but I believe the suggestion should be only when user parse the wrong zone.

Perhaps name-matching the VM name can be too risk, inducing the users to make mistakes, as some company's VM nomenclature can cause the names to be very similar (ie: p = production, d = dev, etc)

Let me know what you think

@halleysouza halleysouza self-assigned this Sep 7, 2023
This was referenced Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants