-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'which' probes output should be hidden in Rex::Interface::Exec::Base::can_run etc... #1521
Comments
Old which version prints 'no cmd in ...' message to stderr, so proposed fix is:
|
linked with PR #1497, same problem |
also |
Thanks for your report, @uralm1! 👍 I agree that it's most possibly related to a specific build or version of the I couldn't reproduce it so far, though. Could you share the exact version of the
Thanks for the code suggestion, we might end up with this approach once I can reproduce the problem (and ideally also write tests for it).
They do seem to be the same type of problem. Not sure if exactly the same, though, but it's good to have them cross-linked for future reference.
Yeah, I've read some of the original discussions at the time about deprecating it in Debian. I'm not sure if replacing |
I found this spam output issue takes place only when CMDB is used. Moreover, Rexfile should use modules=packages. I created bash script that build docker image and demonstrates this issue: Spam output from PR #1497 (from dmidecode) can be reproduced on any modern linux and it also takes place when CMDB activates hardware inventory. |
About |
Thanks! 👍 It seems like these kind of instructions were missing in the original report, so I've wasted time trying to guess the details unsuccessfully :( If you can compile a more minimal version (like a Dockerfile, or just the Rexfile), please keep up posted! Now I see the "Describe the bug" info ended up under "How to reproduce it", and the reproduction steps themselves are posted now. I've converted the issue templates into forms, so these kind of crucial information is harder to be mixed up or left out in the future.
Please note that managing Slackware is not supported currently. There were two PR attempts to add support: #1387 and #1485, but they did not make their way into extension modules yet by their authors (none of them seemed complete though, and were sadly abandoned). Also, Slackware 13.37 went end of life on 2018-07-05. I don't think it's worth putting a lot of effort into trying to support an OS version that is unsupported even by their own upstream. In fact, we actively try to avoid it. I believe it's much more responsible to encourage migrating to a supported OS version. Now that we invested a few hours in it, I'll try to take one more look later at the reproduction through the docker example to learn more. Let's see if this issue here is something we can solve independently of Slackware support or not, and if we are facing a more wide-spread general issue or not.
Oh, that sounds like crucial new information. Querying the CMDB triggers detailed discovery of the remote environment (which is when All my local attempts to reproduce the bug were also using CMDB, though, so it should be somehow specific to the environment you described, not to CMDB directly.
I don't understand that part. Could you elaborate more, please?
As I commented there, I can't reproduce that behavior on Gentoo by always using the latest dmidecode. Let's not mix issues just yet, though. If we prove they are duplicates, we will close one of them later. That PR was also coming out of the blue without describing all the circumstances. If you know more about how to reproduce that too, please consider opening a full bug report. I would love to learn more about these corner cases in order to find an optimal implementation to solve the root cause itself.
There might be additional info in there, though. I might ask for a debug output if I still can't reproduce it based on your examples later.
Yes, that would work on managed endpoints with bash, but Rex should support many other shells too (ash, csh, ksh, sh, tcsh, zsh). Rex also uses
That's certainly an option, though I'd avoid it if possible. It either needs a Perl-core-only one-liner approach to be runnable via Therefore I generally would prefer to rely on platform-specific direct solutions whenever possible. Let's focus on tracking down the root cause of this issue before deciding on how to solve it :) |
Hmm, as noted on the gist, that container image segfaults for me both with podman and docker, so I can't use that example. I'm trying to download a Slackware 13.37 VM image or ISO, and check with that. |
Soo, in a fresh Slackware 13.37 install, I can reproduce it while using the following use Rex -feature => ["1.4"];
use Rex::CMDB;
set cmdb => { type => "YAML", path => ["cmdb/config.yml"] };
user get cmdb("user");
task tt => sub { say "tt" };
package Mod2;
use Rex -feature => ["1.4"];
task tt2 => sub { say "tt2" }; Then
Having Now that I understand the issue better, I can also reproduce it locally. It seems Adding edit: we could also consider setting |
All are tested with
But this prints:
This prints too (+Mod2.pm in external package file):
Don't understand why yet. |
Hmm, yes, with probably broken stderr reader we can face with different variants of this bug... |
I tried to track it down to differences in perl versions and/or perl build with threads, etc., but it seems the behavior depends on where
I'm not sure how much sense it makes to call CMDB from outside a task (since the CMDB is intended to hold data for the managed machine, and anything outside a task is not in management context). But it would still be nice track down this weird behavior, I feel like the stderr should be properly drained outside tasks too. |
I believe the problem with |
So, behind the scenes Rex::CLI does a few hoops to load the Rexfile properly, do some sanity check, and make the Rexfile available in the same way as if it was a module. Part of that is to temporarily hijack STDERR into an in-memory file in order to hide any error output coming from perl itself (which was considered ugly by various folks over time, and it's friendlier to report any such output in a more controlled manner). If we comment the lines of the hijacking out, the stderr output from the early I'm not yet sure yet how it would be best to fix:
|
That's it!
Not a good solution. Let's keep this issue open for now. |
Yeah, I guess "banning" was a too strong word here. I still don't think this fits the intended usage of the CMDB, though. The CMDB is intended to hold data about the configuration that has to be enforced on the managed targets (=Configuration Management DataBase), but not intended to configure Rex itself. The CMDB contains auto-discovered bits (amount of RAM, networking data, etc.), so it normally can only be considered complete after a connection is already made to the managed target (usually from a task, and I'd say definitely not during initialization). It's good news that it might be close to work during init, and it may even be considered working "good enough" for somc use cases outside tasks (like in your case getting the user). I wouldn't consider it completely functional for its intended purpose, though. Therefore we should either make it fully support these use cases as well, or at least put up warnings to at least raise awareness and prevent other lengthy debugging next time. Something along the lines of "hey, using CMDB outside tasks is unsupported, so all bets are off, but I think I can keep running". To configure Rex, or more precisely, authentication info (like passwords, keys, usernames), there are multiple possibilities (in order of my preference):
Oh, definitely! We need to address what we uncovered one way or another, I'm just not sure what exactly to change yet :) |
My current idea is to use My first local evaluation indicate it would work as expected (let's both
These can probably powered by Capture::Tiny or Test::Output. |
Yes I'm going to create some prototypes, but not so fast... offtopic: I used Capture::Tiny in the past tried to create web interface to run Rex tasks. Ended installing Rundeck, created a rex plugin for Rundeck and share rex tasks via rundeck. |
@ferki look at compile2.pl ! Can we use compile1.pl is a prototype of the original method. |
Describe the bug
How to reproduce it
On pretty old slackware 13.37 system (without dmidecode for example):
#rex -T
which: no dmidecode in (/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/pkg/bin:/usr/pkg/sbin)
Tasks
testrun Test run
or (without lsb_release)
#rex -T
which: no lsb_release in (/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/pkg/bin:/usr/pkg/sbin)
which: no dmidecode in (/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/pkg/bin:/usr/pkg/sbin)
which: no lsb_release in (/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/pkg/bin:/usr/pkg/sbin)
which: no lsb_release in (/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/pkg/bin:/usr/pkg/sbin)
which: no lsb_release in (/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/pkg/bin:/usr/pkg/sbin)
Tasks
testrun Test run
Expected behavior
which
file probes should hide its output.Where: Rex::Interface::Exec::Base::can_run, and (probably) in Rex::Interface::Exec::Local or in i_run() etc...
Circumstances
Debug log
not needed
The text was updated successfully, but these errors were encountered: