Skip to content

CFE-4574: Added yaml-promise-type - #166

Merged
larsewi merged 1 commit into
cfengine:masterfrom
SimonThalvorsen:master
Sep 29, 2026
Merged

larsewi merged 1 commit into
cfengine:masterfrom
SimonThalvorsen:master

Conversation

@SimonThalvorsen

Copy link
Copy Markdown
Contributor

Ticket: CFE-4574

@nickanderson nickanderson left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty cool over all.

Nothing worth blocking over but id prefer something other than operation as the attribute name, something not imperative.

Comment thread promise-types/yaml/tests/create.cf Outdated
Comment thread promise-types/yaml/tests/create.cf Outdated
Comment thread promise-types/yaml/tests/create.cf
Comment thread promise-types/yaml/tests/edit.cf
Comment thread promise-types/yaml/tests/errors.cf
Comment thread promise-types/yaml/README.md Outdated
Comment thread promise-types/yaml/README.md Outdated
Comment thread promise-types/yaml/README.md Outdated
Comment thread promise-types/yaml/README.md
Comment thread promise-types/yaml/README.md
Comment on lines +73 to +77
"$(g.file)"
filter => ".server.tls.cert",
operation => "set",
value => "/etc/ssl/app.pem",
classes => outcome("$(pass)");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Nick that operation feels a bit off. Not mainly because it's imperative, but it seems unnecessary to have a separate attribute for it, i.e. we can do:

Suggested change
"$(g.file)"
filter => ".server.tls.cert",
operation => "set",
value => "/etc/ssl/app.pem",
classes => outcome("$(pass)");
"$(g.file)"
target => ".server.tls.cert",
is => "/etc/ssl/app.pem",
classes => outcome("$(pass)");

I think target ... is ... sounds more clear than filter ... operation set value ...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree target ... is ... reads more nicely for the set-operation, but weird for something like .ports[] is "22:22".

Nicks I think reads better, just rename operation to state, then we could do

target => ".server.port",    state => "present", value => "8080";  # key has value
target => ".server.ports[]", state => "present", value => "22:22";  # list contains
target => ".server.debug",   state => "absent";  # key removed

by merging set and present and deciding based on the target containing brackets

@craigcomstock craigcomstock left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is what I came up with so far. Will look more carefully another time soon.

Comment thread promise-types/yaml/README.md Outdated
Comment thread promise-types/yaml/README.md Outdated
Comment thread promise-types/yaml/yaml_lite.py
Comment thread promise-types/yaml/yaml_lite.py Outdated
Comment thread promise-types/yaml/yaml_lite.py Outdated
Comment thread promise-types/yaml/README.md
Comment thread promise-types/yaml/yaml_promise_type.py Outdated
Comment thread promise-types/yaml/yaml_promise_type.py
Comment thread promise-types/yaml/yaml_promise_type.py
Ticket: CFE-4574
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Simon Halvorsen <simon.halvorsen@northern.tech>
@larsewi
larsewi merged commit f743e08 into cfengine:master Sep 29, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants