Skip to content

Commit c2a0051

Browse files
authored
Merge pull request #8 from flopezag/develop
Update Agile calendar configuration files
2 parents 50ffaa3 + 4ad4a94 commit c2a0051

3 files changed

Lines changed: 89 additions & 35 deletions

File tree

kernel/Jira.py

Lines changed: 45 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1-
__author__ = 'Manuel Escriche'
2-
31
import base64, certifi, requests
42
from kconfig import settings
53

4+
__author__ = 'Manuel Escriche'
5+
6+
67
class ConnectionToJIRA(Exception):
78
pass
89

10+
911
class JIRA:
1012
_fields = '*navigable'
13+
1114
fields = 'summary,status,project,components,priority,issuetype,description,reporter,' \
1215
'resolution,assignee,created,updated,duedate,resolutiondate,fixVersions,releaseDate,issuelinks,' \
1316
'customfield_11103,customfield_11104,customfield_11105'
17+
1418
verify = False
1519

1620
url_api = {
@@ -24,16 +28,16 @@ def __init__(self):
2428
username = settings.server['JIRA'].username
2529
password = settings.server['JIRA'].password
2630
auth = '{}:{}'.format(username, password)
27-
keyword = base64.b64encode(bytes(auth,'utf-8'))
31+
keyword = base64.b64encode(bytes(auth, 'utf-8'))
2832
access_key = str(keyword)[2:-1]
2933
headers = {'Content-Type': 'application/json', "Authorization": "Basic {}".format(access_key)}
3034
self.root_url = 'https://{}'.format(settings.server['JIRA'].domain)
31-
#print(self.root_url)
35+
# print(self.root_url)
3236
self.session = requests.session()
3337

34-
#url = '{}{}'.format(self.root_url, JIRA.url_api['session'])
38+
# url = '{}{}'.format(self.root_url, JIRA.url_api['session'])
3539
try:
36-
answer = self.session.get(self.root_url, headers = headers, verify=JIRA.verify)
40+
answer = self.session.get(self.root_url, headers=headers, verify=JIRA.verify)
3741
except ConnectionError:
3842
raise Exception
3943
if answer.status_code != requests.codes.ok:
@@ -47,65 +51,75 @@ def search(self, params):
4751
answer = self.session.get(url, params=params, verify=JIRA.verify)
4852
except Exception:
4953
raise ConnectionToJIRA
50-
#print(answer.url)
54+
# print(answer.url)
5155
data = answer.json()
5256
return data
5357

5458
def getComponentData(self, comp_id):
55-
startAt = 0
56-
payload = {'fields':JIRA.fields,
57-
'maxResults':1000, 'startAt':startAt,
58-
'jql':'component={}'.format(comp_id) }
59+
start_at = 0
60+
payload = {'fields': JIRA.fields,
61+
'maxResults': 1000, 'startAt': start_at,
62+
'jql': 'component={}'.format(comp_id)}
63+
5964
try:
6065
data = self.search(payload)
6166
except Exception:
6267
raise Exception
63-
totalIssues, receivedIssues = data['total'], len(data['issues'])
64-
while totalIssues > receivedIssues:
65-
payload['startAt'] = receivedIssues
68+
69+
total_issues, received_issues = data['total'], len(data['issues'])
70+
71+
while total_issues > received_issues:
72+
payload['startAt'] = received_issues
6673
try:
6774
data['issues'].extend(self.search(payload)['issues'])
6875
except Exception:
6976
raise Exception
70-
receivedIssues = len(data['issues'])
77+
received_issues = len(data['issues'])
78+
7179
return data['issues']
7280

7381
def getTrackerData(self, tracker_id):
74-
startAt = 0
75-
payload = {'fields':JIRA.fields,
76-
'maxResults':1000, 'startAt':startAt,
77-
'jql':'project={}'.format(tracker_id) }
82+
start_at = 0
83+
payload = {'fields': JIRA.fields,
84+
'maxResults': 1000, 'startAt': start_at,
85+
'jql': 'project={}'.format(tracker_id)}
7886
try:
7987
data = self.search(payload)
8088
except Exception:
8189
raise Exception
82-
totalIssues, receivedIssues = data['total'], len(data['issues'])
83-
while totalIssues > receivedIssues:
84-
payload['startAt'] = receivedIssues
90+
91+
total_issues, received_issues = data['total'], len(data['issues'])
92+
93+
while total_issues > received_issues:
94+
payload['startAt'] = received_issues
8595
try:
8696
data['issues'].extend(self.search(payload)['issues'])
8797
except Exception:
8898
raise Exception
89-
receivedIssues = len(data['issues'])
99+
received_issues = len(data['issues'])
100+
90101
return data['issues']
91102

92103
def getQuery(self, jql):
93-
startAt = 0
104+
start_at = 0
94105
payload = {'fields': JIRA.fields,
95-
'maxResults':1000, 'startAt':startAt,
96-
'jql': jql }
106+
'maxResults': 1000, 'startAt': start_at,
107+
'jql': jql}
97108
try:
98109
data = self.search(payload)
99110
except Exception:
100111
raise Exception
101-
totalIssues, receivedIssues = data['total'], len(data['issues'])
102-
while totalIssues > receivedIssues:
103-
payload['startAt'] = receivedIssues
112+
113+
total_issues, received_issues = data['total'], len(data['issues'])
114+
115+
while total_issues > received_issues:
116+
payload['startAt'] = received_issues
104117
try:
105118
data['issues'].extend(self.search(payload)['issues'])
106119
except Exception:
107120
raise Exception
108-
receivedIssues = len(data['issues'])
121+
received_issues = len(data['issues'])
122+
109123
return data['issues']
110124

111125
def getIssue(self, id):
@@ -114,6 +128,6 @@ def getIssue(self, id):
114128
answer = self.session.get(url, verify=JIRA.verify)
115129
except Exception:
116130
raise ConnectionToJIRA
117-
#print(answer.url)
131+
# print(answer.url)
118132
data = answer.json()
119133
return data

site_config/AgileCalendar.xml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0"?>
2-
<!-- List of sprints by Id and Month
3-
see http://forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/Releases_and_Sprints_numbering,_with_mapping_to_calendar_dates
4-
for more details. -->
2+
<!-- List of sprints by Id and Month -->
3+
<!-- see http://forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/Releases_and_Sprints_numbering,_with_mapping_to_calendar_dates -->
4+
<!-- for more details. -->
55
<data>
66
<sprint id="4.1.1" month="M02"/>
77
<sprint id="4.1.2" month="M03"/>
@@ -33,4 +33,24 @@
3333
<sprint id="6.2.1" month="M29"/>
3434
<sprint id="6.2.2" month="M30"/>
3535
<sprint id="6.2.3" month="M31"/>
36+
<sprint id="6.3.1" month="M32"/>
37+
<sprint id="6.3.2" month="M33"/>
38+
<sprint id="6.3.3" month="M34"/>
39+
<sprint id="6.4.1" month="M35"/>
40+
<sprint id="6.4.2" month="M36"/>
41+
<sprint id="6.4.3" month="M37"/>
42+
<sprint id="7.1.1" month="M38"/>
43+
<sprint id="7.1.2" month="M39"/>
44+
<sprint id="7.1.3" month="M40"/>
45+
<sprint id="7.2.1" month="M41"/>
46+
<sprint id="7.2.2" month="M42"/>
47+
<sprint id="7.2.3" month="M43"/>
48+
<sprint id="7.3.1" month="M44"/>
49+
<sprint id="7.3.2" month="M45"/>
50+
<sprint id="7.3.3" month="M46"/>
51+
<sprint id="7.4.1" month="M47"/>
52+
<sprint id="7.4.2" month="M48"/>
53+
<sprint id="7.4.3" month="M49"/>
54+
<sprint id="7.5.1" month="M50"/>
55+
<sprint id="7.5.2" month="M51"/>
3656
</data>

site_config/Calendar.xml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0"?>
2-
<!-- Calendar day for each Month -->
2+
<!-- Calendar day for each Month -->
33
<data>
44
<entry id="M01" month="09" year="2014"/>
55
<entry id="M02" month="10" year="2014"/>
@@ -32,4 +32,24 @@
3232
<entry id="M29" month="01" year="2017"/>
3333
<entry id="M30" month="02" year="2017"/>
3434
<entry id="M31" month="03" year="2017"/>
35+
<entry id="M32" month="04" year="2017"/>
36+
<entry id="M33" month="05" year="2017"/>
37+
<entry id="M34" month="06" year="2017"/>
38+
<entry id="M35" month="07" year="2017"/>
39+
<entry id="M36" month="08" year="2017"/>
40+
<entry id="M37" month="09" year="2017"/>
41+
<entry id="M38" month="10" year="2017"/>
42+
<entry id="M39" month="11" year="2017"/>
43+
<entry id="M40" month="12" year="2017"/>
44+
<entry id="M41" month="01" year="2018"/>
45+
<entry id="M42" month="02" year="2018"/>
46+
<entry id="M43" month="03" year="2018"/>
47+
<entry id="M44" month="04" year="2018"/>
48+
<entry id="M45" month="05" year="2018"/>
49+
<entry id="M46" month="06" year="2018"/>
50+
<entry id="M47" month="07" year="2018"/>
51+
<entry id="M48" month="08" year="2018"/>
52+
<entry id="M49" month="09" year="2018"/>
53+
<entry id="M50" month="10" year="2018"/>
54+
<entry id="M51" month="11" year="2018"/>
3555
</data>

0 commit comments

Comments
 (0)