]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: fix trusted_ip_list in iSCSI service form 38440/head
authorKiefer Chang <kiefer.chang@suse.com>
Fri, 4 Dec 2020 02:51:47 +0000 (10:51 +0800)
committerKiefer Chang <kiefer.chang@suse.com>
Fri, 4 Dec 2020 02:51:47 +0000 (10:51 +0800)
The value should be a comma-separated string rather than a list of strings.

Fixes: https://tracker.ceph.com/issues/48454
Signed-off-by: Kiefer Chang <kiefer.chang@suse.com>
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-form/service-form.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-form/service-form.component.ts

index 215868065c739d132c2dd51ab57306d7bca4ac2f..6ed8b414532ab22050f8f93a6a56746732f71672 100644 (file)
@@ -270,7 +270,7 @@ describe('ServiceFormComponent', () => {
 
       it('should submit iscsi with trusted ips', () => {
         formHelper.setValue('ssl', true);
-        formHelper.setValue('trusted_ip_list', '  172.16.0.5,   192.1.1.10  ');
+        formHelper.setValue('trusted_ip_list', ' 172.16.0.5, 192.1.1.10  ');
         component.onSubmit();
         expect(cephServiceService.create).toHaveBeenCalledWith({
           service_type: 'iscsi',
@@ -282,7 +282,7 @@ describe('ServiceFormComponent', () => {
           api_secure: true,
           ssl_cert: '',
           ssl_key: '',
-          trusted_ip_list: ['172.16.0.5', '192.1.1.10']
+          trusted_ip_list: '172.16.0.5, 192.1.1.10'
         });
       });
 
index 9a2b7747b11af9fa38e909e15fccf85c7478a4d0..533f2ae833a7552f8edc5fba65bfdc2a4a7e2da3 100644 (file)
@@ -300,9 +300,7 @@ export class ServiceFormComponent extends CdForm implements OnInit {
         case 'iscsi':
           serviceSpec['pool'] = values['pool'];
           if (_.isString(values['trusted_ip_list']) && !_.isEmpty(values['trusted_ip_list'])) {
-            let parts = _.split(values['trusted_ip_list'], ',');
-            parts = _.map(parts, _.trim);
-            serviceSpec['trusted_ip_list'] = parts;
+            serviceSpec['trusted_ip_list'] = values['trusted_ip_list'].trim();
           }
           if (_.isNumber(values['api_port']) && values['api_port'] > 0) {
             serviceSpec['api_port'] = values['api_port'];