RexOps / RexOps/Rex

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

Open
#1,367 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Perl
Stars
737
Forks
214
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the provided Rexfile on Darwin, then read lib/Rex/Hardware/Memory.pm around line 193 and lib/Rex/Hardware/Swap.pm around line 143. Compare the behavior of get cmdb() outside and inside a task. Done means the outside-task call completes without emitting the repeated free: command not found error.

Written by the indexing model from the issue text.

Assessment

Tech stack
perl
Domain
devops, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.