Running with -v (or more) breaks gencode-* scripts #343

Open
opened 2022-08-07 14:27:45 +00:00 by thijso · 1 comment

This line in my gencode-remote script is broken when running cdist with -v (or more):

OUT=$( cdist inventory list $__target_host )

Without -v I get the expected contents of OUT:

hostname tag1,tag2,etc

With (one or more) -v I get:

VERBOSE: cdist: version 6.9.8-4-ge50ea335
hostname tag1,tag2,etc

It's probably not supported to call cdist from within a cdist run, but still, this seems broken behaviour.

As you see, I'm trying to get the tags applied to the target host, so I can do something with it. I may have missed it, but it would be nice if support for tags was improved so I can actually use it in my manifests and types.

For example, a __tags variable that contains the tags for the target host would already solve 99% of the issues I'm trying to work through.

This line in my `gencode-remote` script is broken when running cdist with `-v` (or more): ``` OUT=$( cdist inventory list $__target_host ) ``` Without `-v` I get the expected contents of `OUT`: ``` hostname tag1,tag2,etc ``` With (one or more) `-v` I get: ``` VERBOSE: cdist: version 6.9.8-4-ge50ea335 hostname tag1,tag2,etc ``` It's probably not supported to call `cdist` from within a cdist run, but still, this seems broken behaviour. As you see, I'm trying to get the tags applied to the target host, so I can do something with it. I may have missed it, but it would be nice if support for tags was improved so I can actually use it in my manifests and types. For example, a __tags variable that contains the tags for the target host would already solve 99% of the issues I'm trying to work through.
Owner

Now that's a cool issue. Thanks for finding it, this should be supported even though inventory support is still under beta...

The basic problem is that the verbosity level is inherited to the secondary cdist call, which is correct in the case of cdist type emulator, but wrong in your case.

Proposed fix:

  • renaming / removing the verbosity variable to be explicitly for emulator
  • and/or only checking the log level on env in the emulator (probably less feasible)

Nice catch!

Now that's a cool issue. Thanks for finding it, this *should* be supported even though inventory support is still under beta... The basic problem is that the verbosity level is inherited to the secondary cdist call, which is correct in the case of cdist type emulator, but wrong in your case. Proposed fix: * renaming / removing the verbosity variable to be explicitly for emulator * and/or only checking the log level on env in the emulator (probably less feasible) Nice catch!
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: ungleich-public/cdist#343
No description provided.