Conversation
9ff6382 to
0d54ac7
Compare
0d54ac7 to
a226367
Compare
olehermanse
left a comment
There was a problem hiding this comment.
It's a bit hard to follow the code without seeing the bigger picture, please add:
--validateoption which validates the config and won't spawn in the future when that is implemented.- Some shell tests which use the
--validateoption 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 |
There was a problem hiding this comment.
count should be moved to group, not be in template
There was a problem hiding this comment.
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: mycfengineGets turned into:
groups:
- myhub:
role: hub
cfengine:
version: 3.27.0Also, 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>
548ea20 to
6c8683d
Compare
| exit 0 | ||
| fi | ||
|
|
||
| echo "Mock Vagrant: Unknown command $@" >&2 |
There was a problem hiding this comment.
| echo "Mock Vagrant: Unknown command $@" >&2 | |
| echo "Mock Vagrant: Unknown command '$*'" >&2 |
| @@ -0,0 +1,30 @@ | |||
| #/usr/bin/env bash | |||
There was a problem hiding this comment.
| #/usr/bin/env bash | |
| #!/usr/bin/env bash |
| key = "@{}".format(bootstrap) | ||
|
|
||
| # TODO: Change how to check this if cloud_state.json changes format | ||
| if key in state and state[key].values()[1]["role"] != "hub": |
There was a problem hiding this comment.
You probably have to convert the 'dict_values' object to a list before you access it with an index
>>> d = {"a": 1, "b": 2}
>>> d.values()[1]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'dict_values' object is not subscriptable
>>> list(d.values())[1]
2| return | ||
|
|
||
| if remote_download and not is_package_url(package): | ||
| raise UserError("Package '{}' is not a valid package URL") |
There was a problem hiding this comment.
There's a format specifier but no arguments
| return self | ||
|
|
||
|
|
||
| def rgetattr(obj, attr, *args): |
|
|
||
| class GroupConfig(Config): | ||
| role: Literal["client", "hub"] | ||
| # "Field" forces pydantic to report errors on the branch defined by the field "provider" |
There was a problem hiding this comment.
| # "Field" forces pydantic to report errors on the branch defined by the field "provider" | |
| # "Field" forces pydantic to report errors on the branch defined by the field "mode" |
|
|
||
|
|
||
| class GCPConfig(Config): | ||
| image: str # There is no list of avalaible GCP platforms to validate against yet |
There was a problem hiding this comment.
| image: str # There is no list of avalaible GCP platforms to validate against yet | |
| image: str # There is no list of available GCP platforms to validate against yet |
|
|
||
| ### Spawn and install cfengine from a config | ||
|
|
||
| **this feature is still in work in progress** |
There was a problem hiding this comment.
| **this feature is still in work in progress** | |
| **this feature is still a work in progress** |
| source: ubuntu | ||
| ``` | ||
|
|
||
| It up will spawn the necessary VMs and install cfengine using cf-remote |
There was a problem hiding this comment.
| It up will spawn the necessary VMs and install cfengine using cf-remote | |
| up will spawn the necessary VMs and install cfengine using cf-remote |
| "aws": { | ||
| "key": "TBD", | ||
| "secret": "TBD", | ||
| "key_pair": "TDB", |
There was a problem hiding this comment.
| "key_pair": "TDB", | |
| "key_pair": "TBD", |
No description provided.