Browse Source

Fix dashboard certificates skipping pkcs12 bundles

Octavia dashboard was skipping pkcs12 bundles when presenting
certificate options for TERMINATED_TLS listeners.
This patch corrects that so that users can select pkcs12 bundles
for use on their listeners.

Change-Id: I83687ed1476a9e413ca6a8a880dd31783450df67
Story: 2005436
Task: 30476
(cherry picked from commit acbaafbbce7c1f6e0323fd51c1476ab944d308cd)
changes/30/721230/1
Michael Johnson 1 year ago
committed by Tamerlan
parent
commit
74044687e0
2 changed files with 25 additions and 4 deletions
  1. +17
    -0
      octavia_dashboard/static/dashboard/project/lbaasv2/workflow/model.service.js
  2. +8
    -4
      octavia_dashboard/static/dashboard/project/lbaasv2/workflow/model.service.spec.js

+ 17
- 0
octavia_dashboard/static/dashboard/project/lbaasv2/workflow/model.service.js View File

@@ -886,6 +886,7 @@
});
return 'certificate' in container.refs && 'private_key' in container.refs;
});
var certHrefs = [];
var secrets = {};
results[1].data.items.forEach(function addSecret(secret) {
secrets[secret.secret_ref] = secret;
@@ -897,7 +898,23 @@
name: secret.name || secret.secret_ref.split('/').reverse()[0],
expiration: secret.expiration
});
certHrefs.push(secret.secret_ref);
});
// Octavia now supports pkcs12 bundles which are stored as secrets.
// If the secret hasn't already been loaded, add it to the list.
for (var key in secrets) {
if (secrets[key].secret_type !== "opaque") {continue;}
var cert = {
id: key,
name: secrets[key].name || key,
expiration: secrets[key].expiration
};
if (certHrefs.indexOf(key) === -1) {
certificates.push(cert);
certHrefs.push(key);
}
}

push.apply(model.certificates, certificates);
}



+ 8
- 4
octavia_dashboard/static/dashboard/project/lbaasv2/workflow/model.service.spec.js View File

@@ -342,11 +342,15 @@
secret_ref: 'certificate1'
}, {
expiration: '2016-03-28T21:10:45.417835',
secret_ref: 'certificate2'
secret_ref: 'certificate2',
secret_type: 'opaque'
}, {
secret_ref: 'privatekey1'
}, {
secret_ref: 'privatekey2'
}, {
secret_ref: 'pkcs12',
secret_type: 'opaque'
}
];

@@ -514,7 +518,7 @@
expect(model.networks).toEqual(mockNetworks);
expect(model.flavors).toEqual(mockFlavors);
expect(model.members.length).toBe(2);
expect(model.certificates.length).toBe(2);
expect(model.certificates.length).toBe(3);
expect(model.listenerPorts.length).toBe(0);
expect(model.spec).toBeDefined();
expect(model.spec.loadbalancer_id).toBeUndefined();
@@ -552,7 +556,7 @@
expect(model.initialized).toBe(true);
expect(model.subnets.length).toBe(2);
expect(model.members.length).toBe(2);
expect(model.certificates.length).toBe(2);
expect(model.certificates.length).toBe(3);
expect(model.listenerPorts.length).toBe(3);
expect(model.spec).toBeDefined();
expect(model.spec.loadbalancer_id).toBe('1234');
@@ -1232,7 +1236,7 @@
});

it('should initialize certificates', function() {
expect(model.certificates.length).toBe(2);
expect(model.certificates.length).toBe(3);
expect(model.spec.certificates.length).toBe(1);
expect(model.spec.certificates[0].id).toBe('container2');
});


Loading…
Cancel
Save