You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2020/01/05 12:03:32 UTC

[couchdb] branch feat/1752/setup-uuid-and-auth-secret created (now a62c153)

This is an automated email from the ASF dual-hosted git repository.

jan pushed a change to branch feat/1752/setup-uuid-and-auth-secret
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


      at a62c153  feat: sync cluster UUID and http auth secret on setup

This branch includes the following new commits:

     new 0313cf8  reafactor: generalise sync_admin to sync_config
     new a62c153  feat: sync cluster UUID and http auth secret on setup

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[couchdb] 01/02: reafactor: generalise sync_admin to sync_config

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jan pushed a commit to branch feat/1752/setup-uuid-and-auth-secret
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 0313cf8de1abf18ca88873b3860689e3279ea330
Author: Jan Lehnardt <ja...@apache.org>
AuthorDate: Sun Jan 5 12:46:15 2020 +0100

    reafactor: generalise sync_admin to sync_config
---
 src/setup/src/setup.erl | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/setup/src/setup.erl b/src/setup/src/setup.erl
index 9437fbc..e1d66d7 100644
--- a/src/setup/src/setup.erl
+++ b/src/setup/src/setup.erl
@@ -241,8 +241,11 @@ sync_admins() ->
 
 
 sync_admin(User, Pass) ->
+    sync_config("admins", User, Pass).
+
+sync_config(Section, Key, Value) ->
     {Results, Errors} = rpc:multicall(other_nodes(), config, set,
-        ["admins", User, Pass]),
+        [Section, Key, Value]),
     case validate_multicall(Results, Errors) of
         ok ->
             ok;


[couchdb] 02/02: feat: sync cluster UUID and http auth secret on setup

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jan pushed a commit to branch feat/1752/setup-uuid-and-auth-secret
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit a62c153aa439827e12a76a8045325a41636cbb3a
Author: Jan Lehnardt <ja...@apache.org>
AuthorDate: Sun Jan 5 13:02:36 2020 +0100

    feat: sync cluster UUID and http auth secret on setup
    
    Closes #1752
---
 src/setup/src/setup.erl            | 12 ++++++++++++
 src/setup/test/t-frontend-setup.sh | 12 ++++++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/src/setup/src/setup.erl b/src/setup/src/setup.erl
index e1d66d7..12a3f43 100644
--- a/src/setup/src/setup.erl
+++ b/src/setup/src/setup.erl
@@ -200,6 +200,8 @@ setup_node(NewCredentials, NewBindAddress, NodeCount, Port) ->
 finish_cluster(Options) ->
     ok = wait_connected(),
     ok = sync_admins(),
+    ok = sync_uuid(),
+    ok = sync_auth_secret(),
     Dbs = proplists:get_value(ensure_dbs_exist, Options, cluster_system_dbs()),
     finish_cluster_int(Dbs, has_cluster_system_dbs(Dbs)).
 
@@ -243,6 +245,16 @@ sync_admins() ->
 sync_admin(User, Pass) ->
     sync_config("admins", User, Pass).
 
+
+sync_uuid() ->
+    Uuid = config:get("couchdb", "uuid"),
+    sync_config("couchdb", "uuid", Uuid).
+
+sync_auth_secret() ->
+    Secret = config:get("couch_httpd_auth", "secret"),
+    sync_config("couch_httpd_auth", "secret", Secret).
+
+
 sync_config(Section, Key, Value) ->
     {Results, Errors} = rpc:multicall(other_nodes(), config, set,
         [Section, Key, Value]),
diff --git a/src/setup/test/t-frontend-setup.sh b/src/setup/test/t-frontend-setup.sh
index 52056a3..e025cfb 100755
--- a/src/setup/test/t-frontend-setup.sh
+++ b/src/setup/test/t-frontend-setup.sh
@@ -11,6 +11,8 @@
 # License for the specific language governing permissions and limitations under
 # the License.
 
+echo "To test, comment out the fake_uuid line in dev/run"
+
 HEADERS="-HContent-Type:application/json"
 # show cluster state:
 curl a:b@127.0.0.1:15986/_nodes/_all_docs
@@ -48,16 +50,22 @@ curl a:b@127.0.0.1:15984/_cluster_setup -d '{"action":"finish_cluster"}' $HEADER
 # Show system dbs exist on node A
 curl a:b@127.0.0.1:15984/_users
 curl a:b@127.0.0.1:15984/_replicator
-curl a:b@127.0.0.1:15984/_metadata
 curl a:b@127.0.0.1:15984/_global_changes
 
 # Show system dbs exist on node B
 curl a:b@127.0.0.1:25984/_users
 curl a:b@127.0.0.1:25984/_replicator
-curl a:b@127.0.0.1:25984/_metadata
 curl a:b@127.0.0.1:25984/_global_changes
 
 # Number of nodes is set to 2
 curl a:b@127.0.0.1:25984/_node/node2@127.0.0.1/_config/cluster/n
 
+# uuid and auth secret are the same
+curl a:b@127.0.0.1:15984/_node/node1@127.0.0.1/_config/couchdb/uuid
+curl a:b@127.0.0.1:15984/_node/node2@127.0.0.1/_config/couchdb/uuid
+
+curl a:b@127.0.0.1:15984/_node/node1@127.0.0.1/_config/couch_httpd_auth/secret
+curl a:b@127.0.0.1:15984/_node/node2@127.0.0.1/_config/couch_httpd_auth/secret
+
+
 echo "YAY ALL GOOD"