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

consul lock leading slash error message could be more helpful #1136

Closed
porterjamesj opened this issue Jul 27, 2015 · 3 comments
Closed

consul lock leading slash error message could be more helpful #1136

porterjamesj opened this issue Jul 27, 2015 · 3 comments
Labels
type/bug Feature does not function as expected

Comments

@porterjamesj
Copy link

Hi all!

I'm starting to try out consul lock, which is a great feature. I've eventually figured out how to use it but have a bit of confusion at first. My initial attempt looked something like

consul lock -verbose /foo/bar 'sleep 100'

which produces:

Setting up lock at path: /foo/bar/.lock
Attempting lock acquisition
Lock acquisition failed: failed to acquire lock: Unexpected response code: 301 ()

The solution is to remove the leading /, so consul lock -verbose foo/bar 'sleep 100'. This is totally reasonable, but it would be good to have a more helpful error message. I was on a wild goose chase for a while thinking I had my web ui setup misconfigured somehow (since the 301 is a redirect to /ui/) before eventually figuring it out.

@armon armon added the type/bug Feature does not function as expected label Jul 27, 2015
@armon
Copy link
Member

armon commented Jul 27, 2015

Thanks, tagged as bug, we can strip the leading forward slash

@jrgarcia
Copy link

@porterjamesj @armon This does give a proper error in master now. Feel free to reject this if the proper error is good enough (see b5f6451). I couldn't find a way to test this given the tests you have for the lock command, because they use touch and it will work properly with a leading slash. I'm open to suggestions of how to test given the testing facilities that are already in place.

@porterjamesj
Copy link
Author

yeah b5f6451 is more less exactly what I would have wanted it to do, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Feature does not function as expected
Projects
None yet
Development

No branches or pull requests

3 participants