Skip to content

Commit 0de91ec

Browse files
committed
Merge branch 'morpheus' into 'master'
* morpheus: MB-65344 Don't require password on xdcr-setup with full encryption Change-Id: I2f652fa98978af8e471d66c718be31b6a3d79b4d
2 parents 1348ec1 + 15e4fde commit 0de91ec

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
@@ -5328,9 +5328,9 @@ def _set(self, opts):
53285328
_exit_if_errors([f'--xdcr-cluster-name is required to {cmd} a cluster connection'])
53295329
if opts.hostname is None:
53305330
_exit_if_errors([f'--xdcr-hostname is required to {cmd} a cluster connections'])
5331-
if opts.username is None:
5331+
if opts.username is None and opts.secure_connection != "full":
53325332
_exit_if_errors([f'--xdcr-username is required to {cmd} a cluster connections'])
5333-
if opts.password is None:
5333+
if opts.password is None and opts.secure_connection != "full":
53345334
_exit_if_errors([f'--xdcr-password is required to {cmd} a cluster connections'])
53355335
if (opts.encrypt is not None or opts.encryption_type is not None) and opts.secure_connection is not None:
53365336
_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
@@ -3084,6 +3084,21 @@ def test_edit_xdcr(self):
30843084
expected_params = ['name=name', 'hostname=hostname', 'username=username', 'password=pwd', 'demandEncryption=0']
30853085
self.rest_parameter_match(expected_params)
30863086

3087+
def test_edit_xdcr_cert(self):
3088+
contents = 'this-is-the-cert-and-key-file'
3089+
cert_file = tempfile.NamedTemporaryFile(delete=False)
3090+
cert_file.write(contents.encode('utf-8'))
3091+
cert_file.close()
3092+
3093+
args = ['--xdcr-hostname', 'hostname', '--xdcr-cluster-name', 'name', '--xdcr-secure-connection', 'full',
3094+
'--xdcr-user-certificate', cert_file.name, '--xdcr-user-key', cert_file.name,
3095+
'--xdcr-certificate', cert_file.name]
3096+
self.no_error_run(self.command + ['--edit'] + args, self.server_args)
3097+
self.assertIn('POST:/pools/default/remoteClusters/name', self.server.trace)
3098+
expected_params = ['name=name', 'hostname=hostname', 'demandEncryption=1', 'encryptionType=full',
3099+
f'clientCertificate={contents}', f'clientKey={contents}', f'certificate={contents}']
3100+
self.rest_parameter_match(expected_params)
3101+
30873102
def test_list_xdcr(self):
30883103
self.server_args['remote-clusters'] = [{'name': 'name', 'uuid': '1', 'hostname': 'host', 'username': 'user',
30893104
'uri': 'uri', 'deleted': False}]

0 commit comments

Comments
 (0)