-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default source_project to organization for inventory source #10573
Conversation
Build failed.
|
this can be achieved more generally using our lookup plugin (albeit more verbose)
|
d042d1e
to
59fd007
Compare
Build succeeded.
|
I agree you can, but I think its much nicer to have it as part of the module as its something that fundamentally breaks at the moment if there are multiple projects under the same name without having to do the second call as you describe (This is also something you have to know to do and isn't necessarily intuitive to work out). In much the same way as there is an |
59fd007
to
638f6aa
Compare
Have updated and removed the extra option and made it so we just default the project lookup to the |
Hi @Tompage1994 , would you mind adding a task or two to the integration test playbook for the Inventory Source module? The test playbook can be found here: https://github.com/ansible/awx/blob/devel/awx_collection/tests/integration/targets/inventory_source/tasks/main.yml |
When initially designed the collection was assuming that things would be defined together and that the returned id from one object could be used in the second object. For example:
In practice, there are times where things are not all defined at the same time or in the same playbook. So we added the ability to resolve by name but that introduced issues with non-unique instance of an objects. This is why we built the lookup plugin, so that you can resolve an objects name to its ID if the name is non-unique. The problem with adding a new filed like this is that any object that has a dependency on another object could also require similar fields. For example take job_template, if we added fields like this we would need the following fields: If I recall correctly there are one or two objects in Tower where a name and an org may not provide a unique ID as they can be a child of another non-unique object. So while it may be trivial in some modules, adding fields to identify uniqueness of Tower objects can be a very large task. Also, as an FYI, it can be combined into a single step rather than two:
|
Build failed.
|
638f6aa
to
6687d56
Compare
Build failed.
|
Signed-off-by: tpage <tpage@redhat.com>
6687d56
to
62fc62a
Compare
Build succeeded.
|
@john-westcott-iv I completely take on board what you say here and I do agree entirely. I've now changed this PR to address the fact that the module does fail if there are two projects of the same name. Now the project org will default to I've also added something to the integration tests.. |
SUMMARY
related #10571
Adds the defaulting of the source_project (when given) to be looked up under the
organization
selected in the same way the inventory is looked up.ISSUE TYPE
COMPONENT NAME
AWX VERSION
awx_collection v19.2.2