Rex icon indicating copy to clipboard operation
Rex copied to clipboard

Call to "get cmdb" on Darwin outside of a task throws bash error

Open sdondley opened this issue 5 years ago • 0 comments

Describe the bug

Following bash message is shown twice on STDERR:

sh: free: command not found

How to reproduce it

Steps to reproduce the behavior:

  1. Add the following code in the main body of a Rexfile outside of a task:

get cmdb()

Shortest code example that demonstrates the bug:

use Rex -feature => [ qw( 1.4 ) ];
get cmdb();

task test => sub {
};

1;

Expected behavior

No error.

Circumstances

  • Rex version: 11
  • Perl version: 5.24.4
  • OS running rex: Darwin (Catalina, 10.15.5)
  • OS managed by rex: Darwin

Other

The error can be hacked around by change commenting out this line in Rex/Hardware/Memory: https://github.com/RexOps/Rex/blob/master/lib/Rex/Hardware/Memory.pm#L193 and replace with: $free_str = '';

The same hack needs to be done to the line at: https://github.com/RexOps/Rex/blob/master/lib/Rex/Hardware/Swap.pm#L143

Obviously these are not proper fixes and are provided here to help pinpoint the problem.

Finally, the bug does not occur when get cmdb() is called from inside a task.

sdondley avatar Jun 30 '20 13:06 sdondley