redhat-cop / redhat-cop/infra.controller_configuration

Enhancement: Ensure filetree_create disambiguates duplicate resources when creating Job Templates

Open
#58 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement new
Dominant language
YAML
Stars
8
Forks
21
Avg merge
2d 18h
Merged PRs (30d)
15

Description

Is your feature request related to a problem? Please describe.
When using the infra.controller_configuration.filetree_create plugin to create Job Templates, the playbook fails if resources such as Inventories or Credentials exist with the same name across different Organizations.

For example, if two inventories named testdelete exist in different Organizations, the resulting Job Template creation fails with:

"msg": "Request to /api/controller/v2/inventories/?name=testdelete returned 2 items, expected 1"

This behavior is blocking customers during migration scenarios (e.g., from AAP 2.4 to 2.5) because could have duplicate resource names across Orgs, or the very same resource name for credentials of two different credential types.

Describe the solution you'd like
Update filetree_create to generate Job Templates in a way that disambiguates duplicate resources by scoping lookups using both name and organization (e.g., organization__name), or by supporting ID-based references.

using the ansible.controller.controller_api lookup to disambiguate resources

This should apply not only to Inventories, but also to Credentials, Projects, and any other resources a Job Template may reference.

Please align the solution so that it aligns with the solution in JIRA https://issues.redhat.com/browse/AAP-51311

Describe alternatives you've considered
N/A

Additional context
Related Bug: AAP-51311
The Certified Collection module (ansible.controller.job_template) has been updated to allow disambiguation via lookup.
The same enhancement is needed in the Validated Collection (infra.controller_configuration.filetree_create) so that customers using this path are not blocked.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the infra.controller_configuration.filetree_create plugin and compare its resource lookups with the ansible.controller.job_template module and ansible.controller.controller_api lookup. Trace how Inventories, Credentials, Projects, and other Job Template references are resolved. Done means duplicate names across Organizations or credential types no longer make Job Template creation fail.

Written by the indexing model from the issue text.

Assessment

Tech stack
ansible
Domain
devops
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.