You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to test for the existence of a file in an allocation directory.
I call:
nomadClient.AllocFS().Stat(alloc, filename)
If the file doesn't exist, this returns an error "Unexpected response code: 500".
Internal server error 500 isn't really an expected response to this, a 404 would be more expected.
Note that in general I seem to have to match the text of the error to detect the 404 case elsewhere, rather than there being a specific error type I can test for for example. Matching on the string of the error text feels fragile, but at least matching for a specific string containing 404 would be preferable to a more generic 500.
Reproduction steps
Expected Result
An error I can use to easily detect "not found"
Actual Result
An ambiguous error that could mean many things
The text was updated successfully, but these errors were encountered:
What we should be doing is capturing the error from the allocdir package at client/fs_endpoint.go#L148-L151 and converting that to a 404 if it's a "path not found" error. There'll also be an interaction with the sandbox check we need to think about.
I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Nomad version
v1.1.4
Operating system and Environment details
Windows 10
Issue
I'm trying to test for the existence of a file in an allocation directory.
I call:
If the file doesn't exist, this returns an error "Unexpected response code: 500".
Internal server error 500 isn't really an expected response to this, a 404 would be more expected.
Note that in general I seem to have to match the text of the error to detect the 404 case elsewhere, rather than there being a specific error type I can test for for example. Matching on the string of the error text feels fragile, but at least matching for a specific string containing 404 would be preferable to a more generic 500.
Reproduction steps
Expected Result
An error I can use to easily detect "not found"
Actual Result
An ambiguous error that could mean many things
The text was updated successfully, but these errors were encountered: