Skip to content
This repository has been archived by the owner on Sep 16, 2020. It is now read-only.

#706 Fixing issue when importing a job template with a schedule. #718

Merged
merged 1 commit into from
Jul 3, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion tower_cli/cli/transfer/send.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,9 @@ def send(self, source, prevent, exclude, secret_management):

# If there are relations, import them
if relations is not None:
# Schedules have to be imported after the survey because adding extra data to a schedule
# will cause the API to check the job template for input options.
schedules_to_import = []
for a_relation in relations:
if a_relation == 'survey_spec':
survey = tower_cli.get_resource(asset_type).survey(existing_object['id'])
Expand Down Expand Up @@ -287,14 +290,18 @@ def send(self, source, prevent, exclude, secret_management):
elif a_relation == 'extra_credentials':
self.import_extra_credentials(existing_object, relations[a_relation])
elif a_relation == 'schedules':
self.import_schedules(existing_object, relations[a_relation], asset_type)
schedules_to_import.append(relations[a_relation])
elif a_relation == 'roles':
self.import_roles(existing_object, relations[a_relation], asset_type)
elif a_relation == 'labels':
self.import_labels(existing_object, relations[a_relation], asset_type)
else:
self.log_error("Relation {} is not supported".format(a_relation))

# Now that everything else was imported, we can import the schedule if there is one
for schedule in schedules_to_import:
self.import_schedules(existing_object, schedule, asset_type)

# Checking for post update actions on the different objects
if asset_changed:
if asset_type == 'project':
Expand Down