Conversation
There was a problem hiding this comment.
As we chatted, I don't think that installing the provider is the right thing to do here, instead look at the lr CLI and see if you can render the missing resources from the import that the os provider has at https://github.com/mondoohq/cnquery/blob/main/providers/os/resources/os.lr#L5 - If you look at the os.lr.manifest.yaml those resources are missing.
9574572 to
cd44fcd
Compare
@afiune - @vjeffrey and I discussed this morning and decided for now just to go with a simple dependencies array approach. We can revisit this approach if dependencies become a normal thing. |
| Short: "an Ansible playbook", | ||
| }, | ||
| }, | ||
| Dependencies: []string(nil), |
There was a problem hiding this comment.
do we need all of these initializations? by default, dependencies should be empty. 🤔 what am I missing?
There was a problem hiding this comment.
That entire file is auto generated, so it appears to just default to []string(nil) when it doesn't have any dependencies slice in the config for that provider. Having this still allows us to range over this without explicit nil checks. We can try to force it to remove this but it seems to be the default behavior when this file is being generated.
We could add a check to only include it in the generated defaults.go if it actually has data but we would then also have to add a nil check before we attempt to loop through it.
There was a problem hiding this comment.
All of that said, I don't really have a preference one way or another.
| if upstreamDep != nil { | ||
| depProvider, err := Install(upstreamDep.Name, "") | ||
| if err != nil { | ||
| log.Warn().Err(err). |
There was a problem hiding this comment.
Why installing a dependency doesn't return an error? 🤔
There was a problem hiding this comment.
Just a miss on my part, added.
f841abe to
14ca7cc
Compare

The
osprovider has some dependency on thenetworkprovider. This PR adds a dependencies array to providers that be be updated in the providers configuration. It will search through these dependencies and install any that are missing.This is to fix: https://github.com/mondoohq/server/issues/10794