Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2223327

Summary: job templates are missing the correct org/loc after import with hammer
Product: Red Hat Satellite Reporter: Stefan Meyer <smeyer>
Component: Remote ExecutionAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED MIGRATED QA Contact: Satellite QE Team <sat-qe-bz-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.13.1CC: aruzicka, jwfrey, ofedoren
Target Milestone: UnspecifiedKeywords: MigratedToJIRA, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-06-06 16:24:41 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Stefan Meyer 2023-07-17 11:38:17 UTC
Description of problem:
- hammer does not assign all Locations and Organisations when importing a Job Template
- It seems hammer only adds the Job Template to the default Org/Loc

Version-Release number of selected component (if applicable):
- Satellite 6.12.z
- Satellite 6.13.z

How reproducible:
- Everytime you import an previously exported Job Template

Steps to Reproduce:
1. Have at least 2 Locations and Organisations in Satellite

2. Create a Job Template with the name "test" (see example below)

3. Assign both Locations and Organisations in the Job Template
   # hammer job-template update --organizations aaxc,redhat --locations lab,muc --name test

4. Check if the Job Template test has both locations and organisations
   # hammer job-template info --name test
   ID:            252
   Name:          test
   Job Category:  Miscellaneous
   Provider:      script
   Type:          job_template
   Description:
   Inputs:
   Locations:
    lab
    muc
   Organizations:
    aaxc
    redhat

5. Export the Job Template
   # hammer job-template export --name test > test.template

6. Remove the Job Template with the name "test"
   # hammer job-template delete --name test

7. Import the previously exported template "test"
   # hammer job-template import --file test.template

8. Get information for Job Template with the name "test"
   # hammer job-template info --name test
   ID:            252
   Name:          test
   Job Category:  Miscellaneous
   Provider:      script
   Type:          job_template
   Description:
   Inputs:
   Locations:
    lab
   Organizations:
    redhat


Actual results:
- The imported Job Template is missing one Org/Loc

Expected results:
- All exported information should re-import correctly

Additional info:

- Example Job Template:
-------------------------
<%#
name: test
snippet: false
model: JobTemplate
job_category: Miscellaneous
provider_type: script
kind: job_template
organizations:
- aaxc
- redhat
locations:
- lab
- muc
%>

echo test
-------------------------

Comment 1 Adam Ruzicka 2023-10-04 11:44:39 UTC
On stream the behaviour is slightly different, it honors org/loc of the request instead of the ones written in the template

# grep -A 2 -e organizations -e locations test.template
organizations:
- Default Organization
- O1
locations:
- Default Location
- L1

# hammer job-template import --file test.template
Job template imported

# hammer job-template info --name test
ID:           239
Name:         test
Job Category: Miscellaneous
Provider:     script
Type:         job_template
Description:

Inputs:

# hammer job-template delete --name test
Job template deleted

# hammer job-template import --file test.template --organization 'O3' --location 'L3'
Job template imported

# hammer job-template info --name test
ID:            240
Name:          test
Job Category:  Miscellaneous
Provider:      script
Type:          job_template
Description:

Inputs:


Locations:
    L3
Organizations:
    O3

Comment 2 Eric Helms 2024-06-06 16:24:41 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "SAT-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.