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

Fix nasty 500 error on POST to /_config #1717

Merged
merged 1 commit into from Nov 15, 2018

Conversation

@wenli200133
Copy link
Contributor

@wenli200133 wenli200133 commented Nov 7, 2018

Overview

When the ini config file is read only, ini file shouldn't be updated when the endpoint of _node/_local/_config/ is invoked.

For example:

curl -X PUT localhost:15984/_node/_local/_config/admins/joan -d '"500"'

when you check the local.ini file, you shouldn't find out the joan key and hash value of 500

and it also should not return this error like below:

{"error":"badmatch","reason":"{badrpc,{'EXIT',{{{badmatch,{error,eacces}},\n  

expected returned error should like this:

{"error":"bad_request","reason":"eacces"}

Testing recommendations

wenwl@wenwl_mbp:~/cloudant/couchdb$ chmod a-w ./dev/lib/node1/etc/local.ini
wenwl@wenwl_mbp:~/cloudant/couchdb$ curl -X PUT localhost:15984/_node/_local/_config/admins/joan1 -d '"500"' -u adm:pass
{"error":"bad_request","reason":"eacces"}
wenwl@wenwl_mbp:~/cloudant/couchdb$ curl -X DELETE localhost:15984/_node/_local/_config/admins/joan1 -u adm:pass
{"error":"bad_request","reason":"eacces"}

Related Issues or Pull Requests

#1380
apache/couchdb-config#21

Checklist

  • Code is written and works correctly;
  • Changes are covered by tests;
  • Documentation reflects the changes;
@wenli200133 wenli200133 changed the title Fix nasty 500 error on POST to /_config [WIP] Fix nasty 500 error on POST to /_config Nov 7, 2018
@wohali
Copy link
Member

@wohali wohali commented Nov 7, 2018

Your tests are failing.

Does this impact what happens if I do something like:

curl -X PUT localhost:15984/_node/_local/_config/admins/joan -d '500'

i.e., an invalid body?

@wenli200133
Copy link
Contributor Author

@wenli200133 wenli200133 commented Nov 8, 2018

Hi @wohali , now checks have passed.
I think '500' is invalid body, "500" is valid body.
I have another PR for fixing this issue, #1717 and apache/couchdb-config#21, #1717 is dependent on apache/couchdb-config#21.

@wenli200133
Copy link
Contributor Author

@wenli200133 wenli200133 commented Nov 8, 2018

PR apache/couchdb-config#21 need first enter into the master, then #1717 can pick the updated config codes up.

@wenli200133 wenli200133 changed the title [WIP] Fix nasty 500 error on POST to /_config Fix nasty 500 error on POST to /_config Nov 8, 2018
@wenli200133
Copy link
Contributor Author

@wenli200133 wenli200133 commented Nov 14, 2018

Hi @wohali can you help review this PR again if you have free time? @jiangphcn can you also help with it?
Thanks.

@wohali
Copy link
Member

@wohali wohali commented Nov 14, 2018

@wenli200133 sorry, I'm busy with release activities and this sort of technical review isn't what I normally engage in - please work with @jiangphcn @eiri or other Erlang developers on CouchDB. 👍

@wenli200133 wenli200133 force-pushed the cloudant:COUCHDB-1380-fix-nasty-error branch 2 times, most recently from b2b392b to 69552dc Nov 15, 2018
@wenli200133 wenli200133 force-pushed the cloudant:COUCHDB-1380-fix-nasty-error branch from 69552dc to 22e8fc1 Nov 15, 2018
@jiangphcn
Copy link
Contributor

@jiangphcn jiangphcn commented Nov 15, 2018

+1

@jiangphcn jiangphcn merged commit 269224b into apache:master Nov 15, 2018
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants