Skip to content
This repository has been archived by the owner on Jun 18, 2021. It is now read-only.

Commit

Permalink
Add hostname to Machine line on AIX (#141)
Browse files Browse the repository at this point in the history
On AIX the `nodename` returned by `uname` is not always consistent
with the hostname returned by `gethostname()`. Explicitly add the
hostname to the `Machine:` line in the report on AIX as we already
do for z/OS.

PR-URL: #141
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
  • Loading branch information
richardlau authored Jan 13, 2020
1 parent 86c64a5 commit 5ff3778
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 7 additions & 0 deletions src/node_report.cc
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,14 @@ static void PrintVersionInformation(std::ostream& out) {
if (libc_version != NULL) {
out << "(glibc: " << (*libc_version)() << ")" << std::endl;
}
#if defined(_AIX)
char hn[256];
memset(hn,0,sizeof(hn));
gethostname(hn,sizeof(hn));
out << "\nMachine: " << hn << " " << os_info.nodename << " " << os_info.machine << "\n";
#else
out << "\nMachine: " << os_info.nodename << " " << os_info.machine << "\n";
#endif
#endif
}
#endif
Expand Down
4 changes: 0 additions & 4 deletions test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,6 @@ exports.validateContent = function validateContent(data, t, options) {
t.match(nodeReportSection,
new RegExp('Machine: ' + os.hostname(), 'i'), // ignore case on Windows
'Checking machine name in report header section contains os.hostname()');
} else if (this.isAIX()) {
t.match(nodeReportSection,
new RegExp('Machine: ' + os.hostname().split('.')[0]), // truncate on AIX
'Checking machine name in report header section contains os.hostname()');
} else {
t.match(nodeReportSection,
new RegExp('Machine: ' + os.hostname()),
Expand Down

0 comments on commit 5ff3778

Please sign in to comment.