-
Notifications
You must be signed in to change notification settings - Fork 75
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
update connectivity error message #2817
Conversation
🌎 This PR changes translatable messages. 🌏 Please select which scenarios apply. For further explanation, please read our policy on message changes.
|
Jira: This PR is not related to a Jira item. (The PR title does not include a SC-#### reference) GitHub Issues: Launchpad Bugs: No Launchpad bugs are fixed by this PR. (No commits have LP: #### references) Documentation: The changes in this PR do not require documentation changes. 👍 this comment to confirm that this is correct. |
@orndorffgrant @renanrodrigo I am wondering if we should add the HTTP error code if available or if stating the cause is enough for debugging. Let me know what you think |
I think the HTTP code doesn't hurt and could help I'm tempted to suggest we combine |
@orndorffgrant I think that is a good idea, since we only raise |
3cddf26
to
a277214
Compare
We have decided not to add the HTTP response code on the message, since we only raise a |
a277214
to
4096039
Compare
uaclient/exceptions.py
Outdated
UbuntuProError.__init__(self, cause_error=cause_error, url=url) | ||
|
||
# Even though we already set those variable through UbuntuProError | ||
# we need to set them again to avoid mype warnings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# we need to set them again to avoid mype warnings | |
# we need to set them again to avoid mypy warnings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
4096039
to
3bd5310
Compare
uaclient/contract.py
Outdated
except exceptions.ConnectivityError as e: | ||
LOG.exception(e.cause_error) | ||
raise e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a couple places where we catch ConnectivityError, log the message, and then re-raise it. Maybe we should log the error when raising it originally in http/init.py and then remove all the catch-log-reraise blocks - what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense, I will update the PR
3bd5310
to
c41ae38
Compare
@orndorffgrant updated |
c41ae38
to
db0d395
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tiniest of nits so pre-approving, no need for another review from me
features/unattached_status.feature
Outdated
""" | ||
environment_vars: \[\] | ||
errors: | ||
- message: 'Failed to connect to .* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(same comment applies to json version above)
I agree it's easiest to make this a regex but I think we can assert a bit more since we know mostly what the URL will be. I think this should work
- message: 'Failed to connect to .* | |
- message: 'Failed to connect to https://invalidurl.notcanonical.com/v1/resources?architecture=amd64&kernel=(.*)&series=<release>&virt=lxc |
uaclient/actions.py
Outdated
except exceptions.ConnectivityError as e: | ||
raise e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can delete these now since they're empty :D
except exceptions.ConnectivityError as e: | |
raise e |
uaclient/contract.py
Outdated
except exceptions.ConnectivityError as e: | ||
raise e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
except exceptions.ConnectivityError as e: | |
raise e |
uaclient/contract.py
Outdated
except exceptions.ConnectivityError as e: | ||
raise e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
except exceptions.ConnectivityError as e: | |
raise e |
uaclient/contract.py
Outdated
except exceptions.ConnectivityError as e: | ||
raise e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
except exceptions.ConnectivityError as e: | |
raise e |
db0d395
to
5180fca
Compare
@orndorffgrant updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are several CI failures. I think they're mostly unrelated but probably worth checking
features/unattached_status.feature
Outdated
""" | ||
environment_vars: \[\] | ||
errors: | ||
- message: 'Failed to connect to https://invalidurl.notcanonical.com/v1/resources\?architecture=amd64&kernel=(.*)&series=<release>&virt=lxc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I gave a bad suggestion sorry. I think it's good to check at least the domain name, but it turns out we can't rely on the order of the parameters on xenial
- message: 'Failed to connect to https://invalidurl.notcanonical.com/v1/resources\?architecture=amd64&kernel=(.*)&series=<release>&virt=lxc | |
- message: 'Failed to connect to https://invalidurl.notcanonical.com/v1/resources(.*) |
Since ConnectityError is only raised when we detect an UrlError exception, we have decided to merge those exceptios. Additionally, we have also updated the ConnectivityError message to be more explicit on what the actual error is. Fixes: #2647
5180fca
to
919c54b
Compare
@orndorffgrant I have fixed the |
The bionic fix fail will be fixed by #2897 Merging |
Why is this needed?
We want to make connectivity errors clearer and easier to debug for the user. To achieve that, we are now displaying the url that cause the error together with the cause behind the error.
Fixes: #2647
Test Steps
lxc config device add NAME eth0 none
pro fix USN-4539-1
Expect the following message:
Checklist
Does this PR require extra reviews?