Skip to content

Commit 82f338b

Browse files
committed
MB-65344 Merge branch 'neo' into 'trinity'
* neo: MB-65344 Don't require password on xdcr-setup with full encryption Change-Id: I610703534f6d292bc9ef3ff99b27f506462b84f4
2 parents 19958e3 + 5770b17 commit 82f338b

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

cbmgr.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4312,9 +4312,9 @@ def _set(self, opts):
43124312
_exit_if_errors([f'--xdcr-cluster-name is required to {cmd} a cluster connection'])
43134313
if opts.hostname is None:
43144314
_exit_if_errors([f'--xdcr-hostname is required to {cmd} a cluster connections'])
4315-
if opts.username is None:
4315+
if opts.username is None and opts.secure_connection != "full":
43164316
_exit_if_errors([f'--xdcr-username is required to {cmd} a cluster connections'])
4317-
if opts.password is None:
4317+
if opts.password is None and opts.secure_connection != "full":
43184318
_exit_if_errors([f'--xdcr-password is required to {cmd} a cluster connections'])
43194319
if (opts.encrypt is not None or opts.encryption_type is not None) and opts.secure_connection is not None:
43204320
_exit_if_errors(["Cannot use deprecated flags --xdcr-demand-encryption or --xdcr-encryption-type with"

test/test_cli.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2307,6 +2307,21 @@ def test_edit_xdcr(self):
23072307
expected_params = ['name=name', 'hostname=hostname', 'username=username', 'password=pwd', 'demandEncryption=0']
23082308
self.rest_parameter_match(expected_params)
23092309

2310+
def test_edit_xdcr_cert(self):
2311+
contents = 'this-is-the-cert-and-key-file'
2312+
cert_file = tempfile.NamedTemporaryFile(delete=False)
2313+
cert_file.write(contents.encode('utf-8'))
2314+
cert_file.close()
2315+
2316+
args = ['--xdcr-hostname', 'hostname', '--xdcr-cluster-name', 'name', '--xdcr-secure-connection', 'full',
2317+
'--xdcr-user-certificate', cert_file.name, '--xdcr-user-key', cert_file.name,
2318+
'--xdcr-certificate', cert_file.name]
2319+
self.no_error_run(self.command + ['--edit'] + args, self.server_args)
2320+
self.assertIn('POST:/pools/default/remoteClusters/name', self.server.trace)
2321+
expected_params = ['name=name', 'hostname=hostname', 'demandEncryption=1', 'encryptionType=full',
2322+
f'clientCertificate={contents}', f'clientKey={contents}', f'certificate={contents}']
2323+
self.rest_parameter_match(expected_params)
2324+
23102325
def test_list_xdcr(self):
23112326
self.server_args['remote-clusters'] = [{'name': 'name', 'uuid': '1', 'hostname': 'host', 'username': 'user',
23122327
'uri': 'uri', 'deleted': False}]

0 commit comments

Comments
 (0)