def clone_subtask_to_existing_parent(self, ticket, parent_id, position=None): """Clone single subtask to already existing parent. Args: ticket: Ticket object parent_id: JIRA id of an existing task position: Position of a subtask to be moved to as int, default None """ if ticket.status == 'Deprecated': self.log.info('Skipped {0} as it is in deprecated state.'.format( ticket.ticket_id)) return parent = Ticket(prod=self.prod, project=self.project, ticket_id=parent_id) parent.verify_position(position) self.log.info('Cloning SubTask {0} - {1}'.format( ticket.ticket_id, ticket.summary)) new = Ticket(prod=self.prod, project=self.project, custom_substitutions=self.custom_substitutions) if not self.dry_run: new.clone(ticket, inject=self.inject, custom_substitutions=self.custom_substitutions, parent=parent_id) else: # we need generic ticket_id for dry-run new.ticket_id = 'ID' self._cloned[ticket.ticket_id] = new.ticket_id if not self.dry_run: parent.content = parent._get_content() parent.change_subtask_position(position)