manifest fails if singleton type is first in multiline require #34

Closed
opened 2021-11-20 11:25:00 +00:00 by ungleich-gitea · 11 comments
$ cat singleton-in-require-bug
#!/bin/sh -e

__file /tmp/foo

__cdistmarker

require='__cdistmarker
__file/tmp/foo' __file /tmp/bar

$ cdist config -i singleton-in-require-bug localhost
INFO: [257946]: localhost: Starting configuration run
ERROR: [257946]: localhost: /bin/sh -e singleton-in-require-bug: ['/bin/sh', '-e', 'singleton-in-require-bug']

Error processing initial manifest
=================================
path: singleton-in-require-bug

init:stderr
-----------
ERROR: localhost: __file/tmp/bar requires object __cdistmarker
__file/tmp/foo, but type __cdistmarker
__file does not exist. Defined at singleton-in-require-bug
ERROR: cdist: Invalid type '__cdistmarker
__file' at '/tmp/tmpl5vne8v7/421aa90e079fa326b6494f812ad13e79/data/conf/type/__cdistmarker
__file' defined at '/tmp/tmpl5vne8v7/421aa90e079fa326b6494f812ad13e79/data/conf/type/__cdistmarker
__file'

Works if require is oneliner (require='__cdistmarker __file/tmp/foo' __file /tmp/bar) or move singleton type to second in multiline require.

``` $ cat singleton-in-require-bug #!/bin/sh -e __file /tmp/foo __cdistmarker require='__cdistmarker __file/tmp/foo' __file /tmp/bar $ cdist config -i singleton-in-require-bug localhost INFO: [257946]: localhost: Starting configuration run ERROR: [257946]: localhost: /bin/sh -e singleton-in-require-bug: ['/bin/sh', '-e', 'singleton-in-require-bug'] Error processing initial manifest ================================= path: singleton-in-require-bug init:stderr ----------- ERROR: localhost: __file/tmp/bar requires object __cdistmarker __file/tmp/foo, but type __cdistmarker __file does not exist. Defined at singleton-in-require-bug ERROR: cdist: Invalid type '__cdistmarker __file' at '/tmp/tmpl5vne8v7/421aa90e079fa326b6494f812ad13e79/data/conf/type/__cdistmarker __file' defined at '/tmp/tmpl5vne8v7/421aa90e079fa326b6494f812ad13e79/data/conf/type/__cdistmarker __file' ``` Works if require is oneliner (`require='__cdistmarker __file/tmp/foo' __file /tmp/bar`) or move singleton type to second in multiline require.
Author
Owner

mentioned in commit a4a3b98568

mentioned in commit a4a3b9856864202733965f3eef59efb2170835d3
Author
Owner

closed via merge request !930

closed via merge request !930
Author
Owner

mentioned in commit c17541f24c

mentioned in commit c17541f24cf118b0989a5899cab3a439ed534a46
Author
Owner

mentioned in merge request !930

mentioned in merge request !930
Author
Owner

mentioned in commit db7c56552a2cce8af010b17d2e9f8def2fc27d94

mentioned in commit db7c56552a2cce8af010b17d2e9f8def2fc27d94
Author
Owner

mentioned in commit 8d3c18cd48145bf22361f5dfaa1ca006ce841517

mentioned in commit 8d3c18cd48145bf22361f5dfaa1ca006ce841517
Author
Owner

We should support whatever sh supports - and as it looks like not only spaces do the job, so we should mimic that.

We should support whatever `sh` supports - and as it looks like not only spaces do the job, so we should mimic that.
Author
Owner

@ander This is a question for @nico && @steven.

@ander This is a question for @nico && @steven.
Author
Owner

yes, works as oneliner.

can we officially support splitting on (\s|\n)? 🙏

yes, works as oneliner. can we officially support splitting on `(\s|\n)`? :pray:
Author
Owner

@ander Yes, require splits on spaces, not newline. Does it work with spaces?

@ander Yes, `require` splits on spaces, not newline. Does it work with spaces?
Author
Owner

I don't think multiline requires are supported.
The emulator only splits requirements by " ": https://code.ungleich.ch/ungleich-public/cdist/-/blob/fe193eca/cdist/emulator.py#L392

I don't think multiline requires are supported. The emulator only splits requirements by `" "`: https://code.ungleich.ch/ungleich-public/cdist/-/blob/fe193eca/cdist/emulator.py#L392
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#34
No description provided.