TRITON-24 node-triton ListNetworkIPs has unordered results
Reviewed by: Trent Mick <trentm@gmail.com> Approved by: Trent Mick <trentm@gmail.com>
This commit is contained in:
parent
ab564177b5
commit
225410b4fc
@ -12,6 +12,8 @@ Known issues:
|
|||||||
|
|
||||||
- [TRITON-30] Add UpdateNetworkIP to node-triton, e.g.
|
- [TRITON-30] Add UpdateNetworkIP to node-triton, e.g.
|
||||||
`triton network ip update`
|
`triton network ip update`
|
||||||
|
- [TRITON-24] node-triton ListNetworkIPs has unordered results, e.g.
|
||||||
|
`triton network ip list NETWORK`
|
||||||
|
|
||||||
## 5.5.0
|
## 5.5.0
|
||||||
|
|
||||||
|
@ -1387,6 +1387,31 @@ function validateObject(input, valid, opts) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Convert an IPv4 address (as a string) to a number
|
||||||
|
*/
|
||||||
|
function ipv4ToLong(ip) {
|
||||||
|
var l = 0;
|
||||||
|
var spl;
|
||||||
|
|
||||||
|
assert.string(ip, 'ip');
|
||||||
|
spl = ip.split('.');
|
||||||
|
assert.equal(spl.length, 4, 'ip octet length');
|
||||||
|
|
||||||
|
spl.forEach(function processIpOctet(octet) {
|
||||||
|
octet = parseInt(octet, 10);
|
||||||
|
|
||||||
|
assert.number(octet, 'octet');
|
||||||
|
assert(octet >= 0, 'octet >= 0');
|
||||||
|
assert(octet < 256, 'octet < 256');
|
||||||
|
|
||||||
|
l <<= 8;
|
||||||
|
l += octet;
|
||||||
|
});
|
||||||
|
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
|
||||||
//---- exports
|
//---- exports
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@ -1425,6 +1450,7 @@ module.exports = {
|
|||||||
jsonPredFromKv: jsonPredFromKv,
|
jsonPredFromKv: jsonPredFromKv,
|
||||||
monotonicTimeDiffMs: monotonicTimeDiffMs,
|
monotonicTimeDiffMs: monotonicTimeDiffMs,
|
||||||
readStdin: readStdin,
|
readStdin: readStdin,
|
||||||
validateObject: validateObject
|
validateObject: validateObject,
|
||||||
|
ipv4ToLong: ipv4ToLong
|
||||||
};
|
};
|
||||||
// vim: set softtabstop=4 shiftwidth=4:
|
// vim: set softtabstop=4 shiftwidth=4:
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
var format = require('util').format;
|
var format = require('util').format;
|
||||||
|
|
||||||
|
var assert = require('assert-plus');
|
||||||
var tabula = require('tabula');
|
var tabula = require('tabula');
|
||||||
var vasync = require('vasync');
|
var vasync = require('vasync');
|
||||||
|
|
||||||
@ -41,7 +42,29 @@ function do_list(subcmd, opts, args, callback) {
|
|||||||
}
|
}
|
||||||
columns = columns.split(',');
|
columns = columns.split(',');
|
||||||
|
|
||||||
var sort = opts.s.split(',');
|
var sort = opts.s.split(',').map(function mapSort(field) {
|
||||||
|
var so = {};
|
||||||
|
|
||||||
|
field = field.trim();
|
||||||
|
assert.ok(field, 'non-empty field');
|
||||||
|
|
||||||
|
if (field[0] === '-') {
|
||||||
|
so.field = field.slice(1);
|
||||||
|
so.reverse = true;
|
||||||
|
} else {
|
||||||
|
so.field = field;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (so.field) {
|
||||||
|
case 'ip':
|
||||||
|
so.keyFunc = common.ipv4ToLong;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return so;
|
||||||
|
});
|
||||||
|
|
||||||
vasync.pipeline({arg: {cli: this.top}, funcs: [
|
vasync.pipeline({arg: {cli: this.top}, funcs: [
|
||||||
common.cliSetupTritonApi,
|
common.cliSetupTritonApi,
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
"sshpk": "1.10.2",
|
"sshpk": "1.10.2",
|
||||||
"sshpk-agent": "1.4.2",
|
"sshpk-agent": "1.4.2",
|
||||||
"strsplit": "1.0.0",
|
"strsplit": "1.0.0",
|
||||||
"tabula": "1.9.0",
|
"tabula": "1.10.0",
|
||||||
"vasync": "1.6.3",
|
"vasync": "1.6.3",
|
||||||
"verror": "1.10.0",
|
"verror": "1.10.0",
|
||||||
"which": "1.2.4",
|
"which": "1.2.4",
|
||||||
|
Reference in New Issue
Block a user