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

Commit

Permalink
#706 Fixing issue when importing a job template with a schedule.
Browse files Browse the repository at this point in the history
  • Loading branch information
john-westcott-iv committed Jul 3, 2019
1 parent fa54024 commit e7a5d27
Showing 1 changed file with 8 additions and 1 deletion.
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

0 comments on commit e7a5d27

Please sign in to comment.