From 342c621fa170d3f53965e74f85e3079c57e97e8e Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Tue, 6 Nov 2018 20:21:57 +0100 Subject: [PATCH] versions() added docker, postfix --- CHANGELOG.md | 1 + README.md | 4 ++-- lib/osinfo.js | 21 +++++++++++++++++++-- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 064c9fe..b12e654 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -100,6 +100,7 @@ Other changes | Version | Date | Comment | | -------------- | -------------- | -------- | +| 3.47.0 | 2018-11-06 | `versions()` added docker, postfix | | 3.46.0 | 2018-11-05 | fixed issue `versions()`, added system openssl version | | 3.45.10 | 2018-11-03 | fixed issue `battery()`, modified `package.json` - files | | 3.45.9 | 2018-10-22 | fixed node 4 incompatibility | diff --git a/README.md b/README.md index 8024dd2..ebdb7d6 100644 --- a/README.md +++ b/README.md @@ -59,13 +59,13 @@ async function cpu() { (last 7 major and minor version releases) -- Version 3.46.0: `version()` added system openssl version (besides the one insode node.js) +- Version 3.47.0: `version()` added docker, postfix) +- Version 3.46.0: `version()` added system openssl version (besides the one inside node.js) - Version 3.45.0: `diskLayout()` added S.M.A.R.T. status - Version 3.44.0: `battery()` added type, model, manufacturer, serial, timeremaining - Version 3.43.0: added speed per CPU core `cpuCurrentspeed()` - Version 3.42.0: added parent process PID `processes()` - Version 3.41.0: first partial `SunOS` support -- Version 3.40.0: extended `versions()` (php, redis, mongodb) - ... You can find all changes here: [detailed changelog][changelog-url] diff --git a/lib/osinfo.js b/lib/osinfo.js index 5675d1c..9e60954 100644 --- a/lib/osinfo.js +++ b/lib/osinfo.js @@ -291,11 +291,13 @@ function versions(callback) { redis: '', mongodb: '', nginx: '', - php: '' + php: '', + docker: '', + postfix: '' }; let functionProcessed = (function () { - let totalFunctions = 14; + let totalFunctions = 16; return function () { if (--totalFunctions === 0) { if (callback) { @@ -425,6 +427,21 @@ function versions(callback) { } functionProcessed(); }); + exec('docker --version', function (error, stdout) { + if (!error) { + const docker = stdout.toString().split('\n')[0] || ''; + const parts = docker.split(' '); + result.docker = parts.length > 2 && parts[2].endsWith(',') ? parts[2].slice(0, -1) : ''; + } + functionProcessed(); + }); + exec('postconf -d | grep mail_version', function (error, stdout) { + if (!error) { + const postfix = stdout.toString().split('\n') || []; + result.postfix = util.getValue(postfix, 'mail_version', '=', true); + } + functionProcessed(); + }); exec('mongod --version', function (error, stdout) { if (!error) { result.mongodb = stdout.toString().split('\n')[0] || '';