示例#1
0
        def wrapped(*args, **kwargs):
            try:
                return fn(*args, **kwargs)
            except Exception as e:
                if message is None:
                    io.error(str(e))
                else:
                    io.error(message)

                exit()
示例#2
0
    def migrate(self, sk_key):
        """
        Migrates issue from SK to PUB.
        """
        try:
            sk_issue = self._sk_jira.issue(sk_key)
        except Exception:
            io.error('Can\'t find the issue by key: %s' % sk_key)

            return

        pub_issues = self._pub_jira.search_issues(
            "'External issue ID' ~ '%s'" % sk_issue.permalink())

        if pub_issues:
            click.echo('\nThis task has been already migrated to PUB: ')

            for issue in pub_issues:
                click.echo(
                    io.highlight_key(issue=issue) + '\t' +
                    io.truncate_summary(issue.fields.summary))

            if not click.confirm('\nContinue?', default=False):
                return

        click.echo('Beginning of migration %s' %
                   io.highlight_key(issue=sk_issue))

        pub_issue = self.create_pub_issue(sk_issue)
        if pub_issue is None:
            click.echo('Error has occurred')
            return

        click.echo('Issue was migrated: %s' %
                   io.highlight_key(issue=pub_issue))

        self.migrate_attachments(sk_issue, pub_issue)

        return pub_issue