scripts/autoscale.js
function isMasterExternalValueOk(masterId, instances) {
        const instanceIds = Object.keys(instances);
        let instance;
        let hasExternal;

        for (let i = 0; i < instanceIds.length; i++) {
            instance = instances[instanceIds[i]];
            if (instance.external) {
                hasExternal = true;
                break;
            }
        }

        if (hasExternal) {
            return !!instances[masterId].external;
        }

        return true;
    }
function isMasterExternalValueOk(masterId, instances) {
        const instanceIds = Object.keys(instances);
        let instance;
        let hasExternal;

        for (let i = 0; i < instanceIds.length; i++) {
            instance = instances[instanceIds[i]];
            if (instance.external) {
                hasExternal = true;
                break;
            }
        }

        if (hasExternal) {
            return !!instances[masterId].external;
        }

        return true;
    }
function isMasterExternalValueOk ( masterId , instances ) { const instanceIds = Object . keys ( instances ) ; let instance ; let hasExternal ; for ( let i = 0 ; i < instanceIds . length ; i ++ ) { instance = instances [ instanceIds [ i ] ] ; if ( instance . external ) { hasExternal = true ; break ; } } if ( hasExternal ) { return ! ! instances [ masterId ] . external ; } return true ; }
Checks that if there are external instances, the master is
one of them

@param {String} masterId  - Instance ID of master
@param {Object} instances - Instances map

@returns {Boolean} True if there are no external instances or
if there are external instances and the master is
one of them
Checks that if there are external instances the master is one of them