Project

General

Custom queries

Profile

Actions

Bug #38263

closed

Job templates are missing the correct org/loc after import

Added by Adam Lazik about 1 month ago. Updated 20 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Difficulty:
Triaged:
Yes
Found in Releases:

Description

Description of problem:
Locations and Organizations are not assigned correctly when importing a Job Template. Taxonomies of the API request are honored instead of the taxonomies in the template.

How reproducible:
Every time you import an previously exported Job Template.

Steps to Reproduce:
1. Have at least 2 Locations and Organizations in Foreman.
2. Create a Job Template with the name "test" (see example below)
3. Assign both Locations and Organizations to 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 organizations

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 be re-imported 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
-------------------------

Additional comments:
aruzicka:
On stream the behavior 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
Actions #1

Updated by The Foreman Bot about 1 month ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman_remote_execution/pull/956 added
Actions #2

Updated by The Foreman Bot 20 days ago

  • Fixed in Releases foreman_remote_execution-15.0.2 added
Actions #3

Updated by Adam Lazik 20 days ago

  • Status changed from Ready For Testing to Closed
Actions

Also available in: Atom PDF