Skip to content

Implemented spawn config validation#40

Open
victormlg wants to merge 1 commit intocfengine:mainfrom
victormlg:spawn-validation
Open

Implemented spawn config validation#40
victormlg wants to merge 1 commit intocfengine:mainfrom
victormlg:spawn-validation

Conversation

@victormlg
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Member

@olehermanse olehermanse left a comment

Choose a reason for hiding this comment

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

It's a bit hard to follow the code without seeing the bigger picture, please add:

  • --validate option which validates the config and won't spawn in the future when that is implemented.
  • Some shell tests which use the --validate option and prove that it's passing and failing in the right situations.
  • Some explanation and examples for the feature in the README. Clearly mark it as work in progress.

```yaml
templates:
ubuntu:
count: 1
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.

count should be moved to group, not be in template

Copy link
Copy Markdown
Contributor Author

@victormlg victormlg Apr 6, 2026

Choose a reason for hiding this comment

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

Templates is not a real key in the final config, all the names defined in templates get expanded before analyzing the config. Ex:

templates:
  mycfengine: 
    version: 3.27.0

groups:
  - myhub:
      role: hub
      cfengine: mycfengine

Gets turned into:

groups:
  - myhub:
      role: hub
      cfengine: 
        version: 3.27.0

Also, I believe it makes sense to have "count" inside "spawn", Ex:

groups:
 - client1:
      role: client
      source:
        count: 4
        mode: spawn
        spawn:
          provider: vagrant
          vagrant:
            box: ubuntu/focal64
 
  - client2:
      role: client
      source:
        # count: 4. Here count doesn't make sense, because we have saved hosts
        mode: save
        hosts: [ 8.8.8.8 ]

Signed-off-by: Victor Moene <victor.moene@northern.tech>
@victormlg victormlg requested a review from olehermanse April 6, 2026 10:36
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.

2 participants