improve on a DEPTH_ZERO_SELF_SIGNED_CERT error
from: triton account: error: DEPTH_ZERO_SELF_SIGNED_CERT to this: triton account: error (SelfSignedCert): could not access CloudAPI https://10.88.88.3 because it uses a self-signed TLS certificate and your current profile is not configured for insecure access: DEPTH_ZERO_SELF_SIGNED_CERT
This commit is contained in:
parent
ee07395eae
commit
b238fcf52f
@ -309,7 +309,7 @@ function main(argv) {
|
|||||||
var showErr = (cli.showErr !== undefined ? cli.showErr : true);
|
var showErr = (cli.showErr !== undefined ? cli.showErr : true);
|
||||||
|
|
||||||
if (err && showErr) {
|
if (err && showErr) {
|
||||||
var code = (err.body ? err.body.code : err.code);
|
var code = (err.body ? err.body.code : err.code) || err.restCode;
|
||||||
if (code === 'NoCommand') {
|
if (code === 'NoCommand') {
|
||||||
/* jsl:pass */
|
/* jsl:pass */
|
||||||
} else if (err.message !== undefined) {
|
} else if (err.message !== undefined) {
|
||||||
|
@ -247,6 +247,7 @@ CloudApi.prototype._request = function _request(options, callback) {
|
|||||||
*/
|
*/
|
||||||
CloudApi.prototype._passThrough =
|
CloudApi.prototype._passThrough =
|
||||||
function _passThrough(endpoint, opts, cb) {
|
function _passThrough(endpoint, opts, cb) {
|
||||||
|
var self = this;
|
||||||
if (typeof (opts) === 'function') {
|
if (typeof (opts) === 'function') {
|
||||||
cb = opts;
|
cb = opts;
|
||||||
opts = null;
|
opts = null;
|
||||||
@ -259,6 +260,21 @@ function _passThrough(endpoint, opts, cb) {
|
|||||||
|
|
||||||
var p = this._path(endpoint, opts);
|
var p = this._path(endpoint, opts);
|
||||||
this._request(p, function (err, req, res, body) {
|
this._request(p, function (err, req, res, body) {
|
||||||
|
/*
|
||||||
|
* Improve this kind of error message:
|
||||||
|
*
|
||||||
|
* Error: DEPTH_ZERO_SELF_SIGNED_CERT
|
||||||
|
* at SecurePair.<anonymous> (tls.js:1381:32)
|
||||||
|
* at SecurePair.emit (events.js:92:17)
|
||||||
|
*
|
||||||
|
* TODO: could generalize this into a wrapErr method.
|
||||||
|
*/
|
||||||
|
if (err && err.message === 'DEPTH_ZERO_SELF_SIGNED_CERT' &&
|
||||||
|
self.client.rejectUnauthorized)
|
||||||
|
{
|
||||||
|
err = new errors.SelfSignedCertError(err, self.url);
|
||||||
|
}
|
||||||
|
|
||||||
cb(err, body, res);
|
cb(err, body, res);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -113,6 +113,23 @@ function SigningError(cause) {
|
|||||||
util.inherits(SigningError, TritonError);
|
util.inherits(SigningError, TritonError);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A 'DEPTH_ZERO_SELF_SIGNED_CERT' An error signing a request.
|
||||||
|
*/
|
||||||
|
function SelfSignedCertError(cause, url) {
|
||||||
|
var msg = format('could not access CloudAPI %s because it uses a ' +
|
||||||
|
'self-signed TLS certificate and your current profile is not ' +
|
||||||
|
'configured for insecure access', url);
|
||||||
|
TritonError.call(this, {
|
||||||
|
cause: cause,
|
||||||
|
message: msg,
|
||||||
|
code: 'SelfSignedCert',
|
||||||
|
exitStatus: 1
|
||||||
|
});
|
||||||
|
}
|
||||||
|
util.inherits(SelfSignedCertError, TritonError);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Multiple errors in a group.
|
* Multiple errors in a group.
|
||||||
*/
|
*/
|
||||||
@ -143,6 +160,7 @@ module.exports = {
|
|||||||
ConfigError: ConfigError,
|
ConfigError: ConfigError,
|
||||||
UsageError: UsageError,
|
UsageError: UsageError,
|
||||||
SigningError: SigningError,
|
SigningError: SigningError,
|
||||||
|
SelfSignedCertError: SelfSignedCertError,
|
||||||
MultiError: MultiError
|
MultiError: MultiError
|
||||||
};
|
};
|
||||||
// vim: set softtabstop=4 shiftwidth=4:
|
// vim: set softtabstop=4 shiftwidth=4:
|
||||||
|
Reference in New Issue
Block a user