You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by wo...@apache.org on 2018/11/07 21:23:07 UTC
[couchdb] branch master updated: Copy _security object in couchup;
python3 fix (#1721)
This is an automated email from the ASF dual-hosted git repository.
wohali pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git
The following commit(s) were added to refs/heads/master by this push:
new 33c39a9 Copy _security object in couchup; python3 fix (#1721)
33c39a9 is described below
commit 33c39a9f1d9bfffdefb263953de704e1a5a1b1eb
Author: Joan Touzet <wo...@users.noreply.github.com>
AuthorDate: Wed Nov 7 16:23:01 2018 -0500
Copy _security object in couchup; python3 fix (#1721)
---
rel/overlay/bin/couchup | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/rel/overlay/bin/couchup b/rel/overlay/bin/couchup
index 6532170..75b7d7e 100755
--- a/rel/overlay/bin/couchup
+++ b/rel/overlay/bin/couchup
@@ -172,6 +172,25 @@ def _put_filter(args, db=None):
print(exc.response.text)
exit(1)
+def _do_security(args, db=None):
+ """Copies the _security object from source to target DB."""
+ try:
+ req = requests.get(
+ 'http://127.0.0.1:{}/{}/_security'.format(
+ args['local_port'], db),
+ auth=args['creds'])
+ req.raise_for_status()
+ security_doc = _tojson(req)
+ req = requests.put(
+ 'http://127.0.0.1:{}/{}/_security'.format(
+ args['clustered_port'], db),
+ data=json.dumps(security_doc),
+ auth=args['creds'])
+ req.raise_for_status()
+ except requests.exceptions.HTTPError as exc:
+ print(exc.response.text)
+ exit(1)
+
def _replicate(args):
args = _args(args)
if args['all_dbs']:
@@ -229,6 +248,11 @@ def _replicate(args):
if req.get('no_changes'):
if not args['quiet']:
print("No changes, replication is caught up.")
+
+ if not args['quiet']:
+ print('Copying _security object for ' + db + '...')
+ _do_security(args, db)
+
if not args['quiet']:
print("Replication complete.")
@@ -474,7 +498,11 @@ def main(argv):
parser_delete.set_defaults(func=_delete)
args = parser.parse_args(argv[1:])
- args.func(args)
+ try:
+ args.func(args)
+ except AttributeError:
+ parser.print_help()
+ sys.exit(0)
if __name__ == '__main__':
main(sys.argv)