Ejemplo n.º 1
0
    def handle(self, *args, **options):
        self.stdout.write('Updating outdated issues')

        try:
            JiraUtil.store_outdated_issues()
        except CommandError:
            self.stdout.write('Error while updating outdated issues')
Ejemplo n.º 2
0
def ci_display_outdated_stories(request):
    issues = JiraUtil.get_outdated_issues()
    browse_url = JIRA_BROWSE_URL
    project_name = PROJECT_NAME.replace('-', '') + '-'
    return render_to_response('ci/outdated_issues.html', RequestContext(request, {'issues': issues,
                                                                                  'browse_url': browse_url,
                                                                                  'project_name': project_name}))
Ejemplo n.º 3
0
def get_story_data_from_JIRA(request):
    data = loads(request.body)
    story_key = data['key'].encode('ascii', 'ignore')

    try:
        story = JiraUtil.get_issues([story_key])[0]
        result = {
            'key': story_key,
            'summary': story.summary,
            'assignee': story.assignee,
            'tester': story.tester,
            'epic': story.epic_name,
            'reporter': story.reporter,
            'sp': story.story_points
        }
        json_response = dumps(result)
        return HttpResponse(json_response, mimetype='application/json')
    except:
        raise Http404(u'Error occurred while communicating with JIRA')
Ejemplo n.º 4
0
def update_sprint_goals():
    page_name = confluence_settings.SvG_page_title
    page = __get_page_from_confluence(page_name)
    soup = BeautifulSoup(page.content)

    keys = []
    for item in soup.findAll("tr")[1:]:
        if item.findAll("td")[-9:][0].find("a"):
            keys.append(item.findAll("td")[-9:][0].find("a").text)

    stories = {}
    for story in JiraUtil.get_issues(keys):
        stories[story.key] = story

    for item in soup.findAll("tr")[1:]:

        if not item.findAll("td")[-9:][0].find("a"):
            continue

        key = item.findAll("td")[-9:][0].find("a").text
        story = stories[key]

        line = item.findAll("td")[-9:]

        if story.status == 'in progress':
            status = BeautifulSoup('<td><span style="color: rgb(255,128,0);"><b>In Progress</b></span></td>')
        elif story.status == 'completed':
            status = BeautifulSoup('<td><span style="color: rgb(0,0,255);">Completed</span></td>')
        elif story.status == 'accepted':
            status = BeautifulSoup('<td><span style="color: rgb(153,204,0);"><b>Accepted</b></span></td>')
        elif story.status == 'unknown status code 10304':
            status = BeautifulSoup('<td><span style="color: rgb(255,0,0);"><b>Undefined</b></span></td>')
        else:
            status = BeautifulSoup('<td>{status}</td>'.format(status=story.status.capitalize()))
        line[-8].replace_with(status)

        if story.desk_check:
            desk_check = BeautifulSoup('<td>Yes</td>')
        else:
            desk_check = BeautifulSoup('<td><span style="color: rgb(162,164,167);">No</span></td>')
        line[-7].replace_with(desk_check)

        reporter = BeautifulSoup('<td>{reporter}</td>'.format(reporter=story.reporter))
        line[-5].replace_with(reporter)

        onshore_ba = BeautifulSoup('<td>{onshore_ba}</td>'.format(onshore_ba=story.onshore_ba))
        line[-4].replace_with(onshore_ba)

        if story.estimation_date:
            estimation_date = BeautifulSoup('<td>{estimation_date}</td>'.format(
                estimation_date=story.estimation_date.strftime('%d-%b-%y')))
            line[-3].replace_with(estimation_date)

        story.desk_check_status = unicode(line[-6].text).replace(u'\xa0', '')
        stories[key] = story

    desk_check_stories = [item for item in stories.values() if item.desk_check]
    ConfluenceDeskCheckUtil.save_table_records_to_database(desk_check_stories)

    update_message = "Page automatically updated by {login} on {datetime}<br\>" \
                     "Columns marked with (*) has been filled automatically and will be overwritten if edited manually.<br\>"\
        .format(login=confluence_settings.login, datetime=strftime("%Y-%m-%d %H:%M:%S %z", gmtime()))

    npage = {}
    npage["content"] = update_message + unicode(soup.find("table"))
    npage["space"] = page["space"]
    npage["title"] = page["title"]
    npage["id"] = SOAPpy.Types.longType(long(page["id"]))
    npage["version"] = SOAPpy.Types.intType(int(page["version"]))
    npage["parentId"] = SOAPpy.Types.longType(long(page["parentId"]))

    LOGGER.info(npage)

    auth = soap.login(confluence_settings.login, confluence_settings.password)
    soap.storePage(auth, npage)