示例#1
0
class RemoteCopyToCRD(object):  # pylint: disable=R0903
    """Create remote copy in Project CRD of given ticket for
       update marketplace.
    """
    def __init__(self):
        self.crd_ticket = None
        self.crd_user = '******'
        self.crd_pjt_key = 'CRD'

    def do_remote_copy(self, master_ticket):
        """Perform the remote copy"""
        (filepath, filename) = get_doc_attachment(master_ticket)
        reporter = master_ticket.get_reporter()
        crd_tkt = master_ticket.create_issue({
            'project': {
                'key': self.crd_pjt_key
            },
            'summary':
            'CLONE Of %s' % master_ticket.get_summary(),
            'issuetype': {
                'name': 'Task'
            },
            'description':
            'Please add' + ' the device to marketplace',
        })
        self.crd_ticket = Task(JIRA, crd_tkt.key)
        self.crd_ticket.create_issue_link(master_ticket.key)
        self.crd_ticket.change_reporter(reporter)

        add_hcl_link_comment(master_ticket, self.crd_ticket)

        if filepath:
            self.crd_ticket.add_attachment(filepath, filename)
        for att in master_ticket.issue.fields.attachment:
            self.crd_ticket.add_attachment(att.id, att.filename)

        self.crd_ticket.add_comment(
            "Hi Gaurav,\nCould you please update this to market " +
            "place and attach the link.\nThanks,\nSagnik")
        self.crd_ticket.assign_issue(self.crd_user)
        print "%s Created" % self.crd_ticket.key
        print self.crd_ticket.get_summary()
        return self.crd_ticket
class RemoteCopyToCRD(object):  # pylint: disable=R0903
    """Create remote copy in Project CRD of given ticket for
       update marketplace.
    """
    #  TODO
    crd_user = '******'
    crd_pjt_key = 'HCL'

    def __init__(self):
        self.crd_ticket = None

    def run(self, master_ticket):
        """Perform the remote copy"""
        (filepath, filename) = get_doc_attachment(master_ticket)

        ticket = master_ticket.create_issue({
            'project': {
                'key': self.crd_pjt_key
            },
            'summary':
            'CLONE Of %s' % master_ticket.get_summary(),
            'issuetype': {
                'name': 'Task'
            },
            'description':
            'Please add' + ' the device to marketplace'
        })

        self.crd_ticket = Task(JIRA, ticket.key)
        self.crd_ticket.create_issue_link(master_ticket.key)

        add_hcl_link_comment(master_ticket, self.crd_ticket)

        if filepath:
            self.crd_ticket.add_attachment(filepath, filename)

        self.crd_ticket.add_comment(
            "Hi Gaurav,\nCould you please update this to market " +
            "place and attach the link.\nThanks,\nSagnik")
        self.crd_ticket.assign_issue(self.crd_user)
        return self.crd_ticket
class RemoteCopyToCRD(object):  # pylint: disable=R0903
    """Create remote copy in Project CRD of given ticket for
       update marketplace.
    """
    def __init__(self):
        self.crd_ticket = None
        self.crd_user = '******'
        self.crd_pjt_key = 'CRD'

    def do_remote_copy(self, master_ticket):
        """Perform the remote copy"""
        (filepath, filename) = get_doc_attachment(master_ticket)
        reporter = master_ticket.get_reporter()
        crd_tkt = master_ticket.create_issue({'project': {'key':
                                              self.crd_pjt_key},
                                              'summary': 'CLONE Of %s' %
                                              master_ticket.get_summary(),
                                              'issuetype': {'name': 'Task'},
                                              'description': 'Please add' +
                                              ' the device to marketplace', })
        self.crd_ticket = Task(JIRA, crd_tkt.key)
        self.crd_ticket.create_issue_link(master_ticket.key)
        self.crd_ticket.change_reporter(reporter)

        add_hcl_link_comment(master_ticket, self.crd_ticket)

        if filepath:
            self.crd_ticket.add_attachment(filepath, filename)
        for att in master_ticket.issue.fields.attachment:
            self.crd_ticket.add_attachment(att.id, att.filename)

        self.crd_ticket.add_comment(
            "Hi Gaurav,\nCould you please update this to market " +
            "place and attach the link.\nThanks,\nSagnik"
            )
        self.crd_ticket.assign_issue(self.crd_user)
        print "%s Created" % self.crd_ticket.key
        print self.crd_ticket.get_summary()
        return self.crd_ticket
class RemoteCopyToCRD(object):  # pylint: disable=R0903
    """Create remote copy in Project CRD of given ticket for
       update marketplace.
    """
    #  TODO
    crd_user = '******'
    crd_pjt_key = 'HCL'

    def __init__(self):
        self.crd_ticket = None

    def run(self, master_ticket):
        """Perform the remote copy"""
        (filepath, filename) = get_doc_attachment(master_ticket)

        ticket = master_ticket.create_issue({'project': {'key':
                                                         self.crd_pjt_key},
                                             'summary': 'CLONE Of %s' %
                                             master_ticket.get_summary(),
                                             'issuetype': {'name': 'Task'},
                                             'description': 'Please add' +
                                             ' the device to marketplace'})

        self.crd_ticket = Task(JIRA, ticket.key)
        self.crd_ticket.create_issue_link(master_ticket.key)

        add_hcl_link_comment(master_ticket, self.crd_ticket)

        if filepath:
            self.crd_ticket.add_attachment(filepath, filename)

        self.crd_ticket.add_comment(
            "Hi Gaurav,\nCould you please update this to market " +
            "place and attach the link.\nThanks,\nSagnik"
            )
        self.crd_ticket.assign_issue(self.crd_user)
        return self.crd_ticket