ZAPI-612: VMAPI replaces any passed in resolvers with those from the network

Resolution

Fixed: A fix for this issue is checked into the tree and tested.
(Resolution Date: 2015-04-16T06:00:30.000Z)

Fix Versions

2015-04-16 Mars Climate Orbiter (Release Date: 2015-04-16)

Related Issues

Description

In lib/workflows/provision.js there's this code:

    // If internal_metadata.set_resolvers === false, we always want
    // to leave the resolvers as empty
    if (params.internal_metadata !== undefined &&
        typeof (params.internal_metadata) === 'object' &&
        params.internal_metadata.set_resolvers === false) {
        wantResolvers = false;
    }

    // Add resolvers and routes in the order of the networks
    var resolver;
    var resolvers = [];
    var routes = {};
    for (i = 0; i <  params.nics.length; i++) {
        nic = params.nics[i];

        if (nic['resolvers'] !== undefined &&
            Array.isArray(nic['resolvers'])) {
            for (j = 0; j < nic['resolvers'].length; j++) {
                resolver = nic['resolvers'][j];
                if (resolvers.indexOf(resolver) === -1) {
                    resolvers.push(resolver);
                }
            }
        }

        if (nic['routes'] !== undefined &&
            typeof (nic['routes']) === 'object') {
            for (var r in nic['routes']) {
                if (!routes.hasOwnProperty(r)) {
                    routes[r] = nic['routes'][r];
                }
            }
        }
    }

    if (wantResolvers) {
        payload['resolvers'] = resolvers;
    }

and unfortunately this means if you pass 'resolvers' with your payload. wantResolvers defaults to true, so we always replace unless you specifically ask for an empty set.

Comments

Comment by Bot Bot [X]
Created at 2015-04-16T05:24:09.000Z

sdc-vmapi commit f1c2591 (branch master, by Josh Wilsdon)

ZAPI-612 VMAPI replaces any passed in resolvers with those from the network