Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (selectProperties.length > 0) {
query.$select = selectProperties.join(',');
}
const encodedQuery = querystring.stringify(query);
const options = {};
let path = `${configItem.path}?${encodedQuery}`;
// do any replacements
path = path.replace(hostNameRegex, tokenMap.hostName);
path = path.replace(deviceNameRegex, tokenMap.deviceName);
if (configItem.silent) {
options.silent = configItem.silent;
}
return this.bigIp.list(path, null, cloudUtil.SHORT_RETRY, options);
}));
})
function waitForDeviceGroup(deviceGroupName) {
function checkDeviceGroup() {
return new Promise((resolve, reject) => {
this.bigIp.cluster.hasDeviceGroup(deviceGroupName)
.then((hasDeviceGroup) => {
if (hasDeviceGroup) {
resolve();
} else {
reject(new Error(`Device group ${deviceGroupName} does not exist on this device.`));
}
});
});
}
return cloudUtil.tryUntil(this, cloudUtil.SHORT_RETRY, checkDeviceGroup);
}
executeBashCommandRemote(bigIp, command) {
const commandBody = {
command: 'run',
utilCmdArgs: `-c "${command}"`
};
return bigIp.create(
'/tm/util/bash',
commandBody,
null,
cloudUtil.SHORT_RETRY
)
.then(result => result.commandResult);
},
function findMatchingRoutes(selfIpsToDelete) {
const matchingRoutes = [];
if (selfIpsToDelete.length === 0) {
return Promise.resolve(matchingRoutes);
}
return this.bigIp.list(PATHS.Route, null, cloudUtil.SHORT_RETRY)
.then((routes) => {
const existingRoutes = routes && Array.isArray(routes) ? routes.slice() : [];
existingRoutes.forEach((route) => {
selfIpsToDelete.forEach((selfIp) => {
if (isInSubnet(route.gw, selfIp.address)) {
if (matchingRoutes.findIndex(elementMatches, route) === -1) {
matchingRoutes.push(route);
}
}
});
});
return Promise.resolve(matchingRoutes);
})
.catch((err) => {