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(local.ini): straggling s/couch_httpd_auth/chttpd_auth/ #3810

Merged
merged 1 commit into from Oct 30, 2021
Merged

Conversation

jaydoane
Copy link
Contributor

Overview

The appropriately named hack_local_ini function in dev/run lives up
to its name by adding a random secret to the end of whichever
section contains the line "; require_valid_user = false\n".

Recent commits updated the setup application from
couch_httpd_auth to chttpd_auth without also changing this line
in local.ini, which had the fun effect of causing setup to fail with
this error:

[error] 2021-10-30T18:50:15.019274Z node1@127.0.0.1 <0.817.0> 85d0421b9c setup sync_admin results [{badrpc,{'EXIT',{function_clause,[{config,set,["chttpd_auth","secret",undefined,true,nil],[{file,"src/config.erl"},{line,189}]},{rpc,'-handle_call_call/6-fun-0-',5,[{file,"rpc.erl"},{line,197}]}]}}},{badrpc,{'EXIT',{function_clause,[{config,set,["chttpd_auth","secret",undefined,true,nil],[{file,"src/config.erl"},{line,189}]},{rpc,'-handle_call_call/6-fun-0-',5,[{file,"rpc.erl"},{line,197}]}]}}}] errors []
[notice] 2021-10-30T18:50:15.019530Z node1@127.0.0.1 <0.817.0> 85d0421b9c 127.0.0.1:15984 127.0.0.1 adm POST /_cluster_setup 500 ok 12

This change "fixes" dev/run by also updating the straggling section
name in local.ini.

Testing recommendations

Running e.g.

dev/run -a adm:pass --no-eval 'dev/remsh'

should result in a formed cluster and a remsh on node1 instead of a crash:

[ * ] Running cluster setup ... failed: b'{"error":"setup_error","reason":"Cluster setup unable to sync admin passwords"}\n'
Traceback (most recent call last):
  File "dev/run", line 857, in <module>
    main()
  File "dev/run", line 91, in main
    startup(ctx)
  File "dev/run", line 519, in startup
    cluster_setup(ctx)
  File "dev/run", line 71, in wrapper
    res = func(*args, **kwargs)
  File "dev/run", line 666, in cluster_setup
    finish_cluster(lead_port, *ctx["admin"])
  File "dev/run", line 752, in finish_cluster
    assert resp.status in (201, 400), resp.read()
AssertionError: b'{"error":"setup_error","reason":"Cluster setup unable to sync admin passwords"}\n'
returned 1

Related Issues or Pull Requests

Checklist

  • Code is written and works correctly
  • Changes are covered by tests
  • Any new configurable parameters are documented in rel/overlay/etc/default.ini
  • A PR for documentation changes has been made in https://github.com/apache/couchdb-documentation

The appropriately named `hack_local_ini` function in dev/run lives up
to its name by adding a random `secret` to the end of whichever
section contains the line `"; require_valid_user = false\n"`.

Recent commits [1] updated the `setup` application from
`couch_httpd_auth` to `chttpd_auth` without also changing this line
in local.ini, which had the fun effect of causing `setup` to fail with
this error:

```
[error] 2021-10-30T18:50:15.019274Z node1@127.0.0.1 <0.817.0> 85d0421b9c setup sync_admin results [{badrpc,{'EXIT',{function_clause,[{config,set,["chttpd_auth","secret",undefined,true,nil],[{file,"src/config.erl"},{line,189}]},{rpc,'-handle_call_call/6-fun-0-',5,[{file,"rpc.erl"},{line,197}]}]}}},{badrpc,{'EXIT',{function_clause,[{config,set,["chttpd_auth","secret",undefined,true,nil],[{file,"src/config.erl"},{line,189}]},{rpc,'-handle_call_call/6-fun-0-',5,[{file,"rpc.erl"},{line,197}]}]}}}] errors []
[notice] 2021-10-30T18:50:15.019530Z node1@127.0.0.1 <0.817.0> 85d0421b9c 127.0.0.1:15984 127.0.0.1 adm POST /_cluster_setup 500 ok 12
```

This change "fixes" dev/run by also updating the straggling section
name in local.ini.

[1] #3808
@jaydoane jaydoane merged commit 5a7f1d4 into 3.x Oct 30, 2021
@jaydoane jaydoane deleted the fix-dev-run branch October 30, 2021 20:08
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

Successfully merging this pull request may close these issues.

None yet

2 participants