Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!parsed.message && (parsed.reason || parsed.error)) {
parsed.message = (parsed.reason || parsed.error);
}
// fix cloudant issues where they give an erlang stacktrace as js
delete parsed.stack;
callback(errs.merge({
message: 'couch returned ' + rh.statusCode,
scope: 'couch',
statusCode: rh.statusCode,
request: req,
headers: rh,
errid: 'non_200'
}, errs.create(parsed)));
});
}
createVM = function (client, options, vmOptions, callback) {
// check OS type of image to determine if we are creating a linux or windows VM
switch (vmOptions.image.OSImage.OS.toLowerCase()) {
case 'linux':
createLinuxVM(client, options, vmOptions, callback);
break;
case 'windows':
createWindowsVM(client, options, vmOptions, callback);
break;
default:
callback(errs.create({message: 'Unknown Image OS: ' + vmOptions.image.OS}));
break;
}
};
var createVM = function(client, options, vmOptions, callback) {
// check OS type of image to determine if we are creating a linux or windows VM
switch(vmOptions.image.OS.toLowerCase()) {
case 'linux':
createLinuxVM(client, options, vmOptions, callback);
break;
case 'windows':
createWindowsVM(client, options, vmOptions, callback);
break;
default:
callback(errs.create({message: 'Unknown Image OS: ' + vmOptions.image.OS}));
break;
}
};
AzureServer.prototype.createVM = function(callback) {
// check OS type of image to determine if we are creating a linux or windows VM
switch(this.image.OS.toLowerCase()) {
case 'linux':
this.createLinuxVM(callback);
break;
case 'windows':
this.createWindowsVM(callback);
break;
default:
callback(errs.create({message: 'Unknown Image OS: ' + this.image.OS}));
break;
}
};
return function (err, res, body) {
if (err) {
return callback(err);
}
var err2 = self._parseError(res, body);
if (err2) {
self.emit('log::error', 'Error during provider response', err2);
return callback(errs.create(err2));
}
self.emit('log::trace', 'Provider Response', {
href: res.request.uri.href,
method: res.request.method,
headers: res.headers,
statusCode: res.statusCode
});
callback(err, body, res);
};
};
exports.renameServer = function renameServer(server, name, callback) {
return errs.handle(
errs.create({ message: 'Not supported by Azure.' }),
callback
);
};
exports.renameServer = function renameServer(server, name, callback) {
return errs.handle(
errs.create({ message: 'Not supported by Azure.' }),
callback
);
};
['flavor', 'image', 'name'].forEach(function (member) {
if (!options[member]) {
return errs.handle(
errs.create({ message: 'options.' + member + ' is a required argument.' }),
callback
);
}
});
exports.destroyImage = function destroyImage(image, callback) {
return errs.handle(
errs.create({ message: 'Not supported by joyent' }),
callback
);
};
this.Package.get(pkg, function (err, pack) {
if (err) { return callback(err); }
if (!pack) {
return callback(errs.create({
message: `'${pkg}' is not in the registry.`,
status: 404
}));
}
callback(null, pack.distTags);
});
};