__line crashes in dry-run mode when file does not exist yet #114

Closed
opened 2021-11-20 13:24:08 +00:00 by ungleich-gitea · 0 comments

Created by: thriqon

Suppose the following snippet in a manifest:

__file /tmp/test --state exists
require="__file/tmp/test" __line blah --file /tmp/test --line "blah is there"

and /tmp/test does not exist on the target host.

This works fine when invoking cdist config normally, but crashes in the explorer phase when running it with --dry-run.


This is because the explorer invokes awk directly without testing file presence first and handling that gracefully. __line still crashes (probably) if the file does not exist when running normally, but that is a different topic (and a design decision).

*Created by: thriqon* Suppose the following snippet in a manifest: ``` __file /tmp/test --state exists require="__file/tmp/test" __line blah --file /tmp/test --line "blah is there" ``` and `/tmp/test` does not exist on the target host. This works fine when invoking `cdist config` normally, but crashes in the explorer phase when running it with `--dry-run`. ---- This is because the [explorer](https://github.com/ungleich/cdist/blob/master/cdist/conf/type/__line/explorer/state) invokes `awk` directly without testing file presence first and handling that gracefully. `__line` still crashes (probably) if the file does not exist when running normally, but that is a different topic (and a design decision).
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 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#114
No description provided.