Handle missing key-manager service in workflow

This updates the LBaaS v2 workflow so that it does not trip over
itself if the key-manager service is not available. It will also
ignore servers (available members) that are in a state where they
do not have any IP addresses.

Partially-Implements: blueprint horizon-lbaas-v2-ui
Change-Id: Ia3373653f651e273d021ffedf9c2909810e9ecb9
This commit is contained in:
Justin Pomeroy 2016-03-04 18:15:22 -06:00 committed by Doug Fish
parent af63722e3a
commit f44671ca0e
2 changed files with 15 additions and 9 deletions

View File

@ -190,7 +190,9 @@
neutronAPI.getSubnets().then(onGetSubnets),
neutronAPI.getPorts().then(onGetPorts),
novaAPI.getServers().then(onGetServers),
keymanagerPromise.then(prepareCertificates)
// The noop errback prevents this from tripping up $q.all since this is a case
// where we don't care if it fails, i.e. key-manager service doesn't exist.
keymanagerPromise.then(prepareCertificates, angular.noop)
]).then(initMemberAddresses);
model.context.submit = createLoadBalancer;
break;
@ -200,7 +202,7 @@
neutronAPI.getSubnets().then(onGetSubnets),
neutronAPI.getPorts().then(onGetPorts),
novaAPI.getServers().then(onGetServers),
keymanagerPromise.then(prepareCertificates)
keymanagerPromise.then(prepareCertificates, angular.noop)
]).then(initMemberAddresses);
model.context.submit = createListener;
break;
@ -419,11 +421,14 @@
model.members.length = 0;
var members = [];
angular.forEach(response.data.items, function addMember(server) {
// If the server is in a state where it does not have an IP address then we can't use it
if (server.addresses && !angular.equals({}, server.addresses)) {
members.push({
id: server.id,
name: server.name,
weight: 1
});
}
});
push.apply(model.members, members);
}

View File

@ -258,8 +258,9 @@
$provide.value('horizon.app.core.openstack-service-api.nova', {
getServers: function() {
var servers = [ { id: '1', name: 'server-1' },
{ id: '2', name: 'server-2' } ];
var servers = [ { id: '1', name: 'server-1', addresses: { foo: 'bar' } },
{ id: '2', name: 'server-2', addresses: { foo: 'bar' } },
{ id: '3', name: 'server-3' }];
var deferred = $q.defer();
deferred.resolve({ data: { items: servers } });