Import problems from JIRA On Demand

  • 9
  • 43

We have a number of projects currently hosted on JIRA on demand (v6.0 from what it says). We've downloaded the Python client tools to import the projects. We've done a test run on one of them, but the script seems to fail. I suspect it's because the JIRA APIs have changed in some way. Stack trace as below:

Are there any modifications we can make to the script ourselves or is a more extensive reworking required ?

Thanks!
8<
source_url : https://XXXXXX.atlassian.net/
source_login : XXXXXX
target_url : http://XXX.XXX.XXX.XXX/
target_login : XXXXXX
project_id : FRIENDS
('issues_count : ', 99999)
('skip_count : ', 0)
<?xml version="1.0" ?><importReport><item id="test.user" imported="false"><error fieldName="login" value="test.user">Value is not unique</error></item></importReport>
Traceback (most recent call last):
File "jira2youtrack.py", line 297, in <module>
main()
File "jira2youtrack.py", line 28, in main
issues_count, skip_count)
File "jira2youtrack.py", line 266, in jira2youtrack
jira_issues])
File "jira2youtrack.py", line 70, in create_yt_issue_from_jira_issue
yt_issue[field_name] = get_value_presentation(field_type, value)
File "jira2youtrack.py", line 203, in get_value_presentation
return to_unix_date(value)
File "jira2youtrack.py", line 193, in to_unix_date
tz_diff *= (int(time_zone[1:3]) * 60 + int(time_zone[3:5]))
ValueError: invalid literal for int() with base 10: ''
Hi Com Com,

What Python version do you use?

Thank you.
Regards,

Andrey Tigay
YouTrack engineer

Thanks for getting back so quickly :)

Details as follows:

Python 2.7.3 (default, Sep 26 2012, 21:51:14)
[GCC 4.7.2] on linux2

Thank you for details.

As far as I can see, this is not the last version of import script. Try to download the last one.

If it doesn't help,please, provide us with the whole import logs. You can attach them here or send them to youtrack-feedback@jetbrains.com.
Regards,

Andrey Tigay
YouTrack engineer

I grabbed the latest one from the git repository. Is there a version you'd recommend instead ?

Hi Com Com,
I've fixed this issue. Please, download the latest library version and try again.

Thanks, that's really speedy and attentive of you! I know we made the right decision to buy this :)

However, the problem seems to persist, albeit in a different form. Here's the output:

<?xml version="1.0" ?><importReport><item id="xxx" imported="false"><error fieldName="login" value="xxx">Value is not unique</error></item></importReport>
2010-06-08 11:49:08
2010-06-08 11:49:08
labels
watches
540
Traceback (most recent call last):
File "jira2youtrack.py", line 295, in <module>
main()
File "jira2youtrack.py", line 29, in main
issues_count, skip_count)
File "jira2youtrack.py", line 264, in jira2youtrack
jira_issues])
File "jira2youtrack.py", line 71, in create_yt_issue_from_jira_issue
yt_issue[field_name] = get_value_presentation(field_type, value)
File "jira2youtrack.py", line 201, in get_value_presentation
return to_unix_date(value)
File "jira2youtrack.py", line 193, in to_unix_date
dt = datetime.datetime.strptime(time_string, '%Y-%m-%d %H:%M:%S')
File "/usr/lib/python2.7/_strptime.py", line 325, in _strptime
(data_string, format))
ValueError: time data '540' does not match format '%Y-%m-%d %H:%M:%S'

Hi Com Com,
As I can see from log there is attempt to convert value '540' to datetime.
So, it's just a configuration problem. Did you change any default settings?

Not as far as I know, but I wouldn't be surprised if someone else has! I have obtained the JSON output from the offending request which causes the script to fail. It looks like it is failing on "customfield_10050" which I would have thought the script would ignore. Looking at the ticket itself, I can't see where this "540" value comes from.

{

"expand": "renderedFields,names,schema,transitions,operations,editmeta,changelog",
"id": "10313",
"self": "https://xxxx.atlassian.net/rest/api/latest/issue/10313",
"key": "xxx-59",
"fields": {
"summary": "Error when submit details for prize",
"progress": {
"progress": 0,
"total": 0
},
"timetracking": { },
"issuetype": {
"self": "https://xxxx.atlassian.net/rest/api/2/issuetype/1",
"id": "1",
"description": "A problem which impairs or prevents the functions of the product.",
"iconUrl": "https://xxxx.atlassian.net/images/icons/issuetypes/bug.png",
"name": "Bug",
"subtask": false
},
"timespent": null,
"reporter": null,
"customfield_10042": null,
"customfield_10041": null,
"created": "2010-05-10T10:13:00.000+0100",
"updated": "2010-06-08T11:49:08.463+0100",
"priority": {
"self": "https://xxxx.atlassian.net/rest/api/2/priority/1",
"iconUrl": "https://xxxx.atlassian.net/images/icons/priorities/blocker.png",
"name": "Blocker",
"id": "1"
},
"description": "Error when submit details for prize - Fixed I think",
"customfield_10040": null,
"issuelinks": [ ],
"customfield_10555": null,
"subtasks": [ ],
"status": {
"self": "https://xxxx.atlassian.net/rest/api/2/status/6",
"description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.",
"iconUrl": "https://xxxx.atlassian.net/images/icons/statuses/closed.png",
"name": "Closed",
"id": "6"
},
"labels": [ ],
"workratio": -1,
"project": {
"self": "https://xxxx.atlassian.net/rest/api/2/project/xxx",
"id": "10030",
"key": "xxx",
"name": "3M - xxx",
"avatarUrls": {
"128x128": "https://xxxx.atlassian.net/secure/projectavatar?size=xxxlarge&pid=10030&avatarId=10011",
"16x16": "https://xxxx.atlassian.net/secure/projectavatar?size=xsmall&pid=10030&avatarId=10011",
"24x24": "https://xxxx.atlassian.net/secure/projectavatar?size=small&pid=10030&avatarId=10011",
"64x64": "https://xxxx.atlassian.net/secure/projectavatar?size=xlarge&pid=10030&avatarId=10011",
"256x256": "https://xxxx.atlassian.net/secure/projectavatar?size=xxxlarge%402x&pid=10030&avatarId=10011",
"32x32": "https://xxxx.atlassian.net/secure/projectavatar?size=medium&pid=10030&avatarId=10011",
"48x48": "https://xxxx.atlassian.net/secure/projectavatar?pid=10030&avatarId=10011",
"96x96": "https://xxxx.atlassian.net/secure/projectavatar?size=xxlarge&pid=10030&avatarId=10011",
"192x192": "https://xxxx.atlassian.net/secure/projectavatar?size=xxlarge%402x&pid=10030&avatarId=10011"
}
},
"customfield_10151": "6_*:*_2_*:*_2511154483_*|*_4_*:*_1_*:*_213981",
"environment": null,
"customfield_10152": null,
"customfield_10155": null,
"customfield_10050": "540",
"lastViewed": null,
"aggregateprogress": {
"progress": 0,
"total": 0
},
"components": [
{
"self": "https://xxxx.atlassian.net/rest/api/2/component/10015",
"id": "10015",
"name": "Misc"
}
],
"comment": { … },
"timeoriginalestimate": null,
"customfield_10150": "540",
"votes": {
"self": "https://xxxx.atlassian.net/rest/api/2/issue/xxx-59/votes",
"votes": 0,
"hasVoted": false
},
"resolution": {
"self": "https://xxxx.atlassian.net/rest/api/2/resolution/1",
"id": "1",
"description": "Bug has been fixed, task has been done, feature has been implemented",
"name": "Completed"
},
"fixVersions": [ ],
"resolutiondate": "2010-06-08T11:49:08.454+0100",
"aggregatetimeoriginalestimate": null,
"customfield_10350": null,
"customfield_10351": null,
"duedate": null,
"customfield_10020": null,
"customfield_10450": null,
"watches": {
"self": "https://xxxx.atlassian.net/rest/api/2/issue/xxx-59/watchers",
"watchCount": 0,
"isWatching": false
},
"worklog": {
"startAt": 0,
"maxResults": 0,
"total": 0,
"worklogs": [ ]
},
"customfield_10751": "Not Started",
"customfield_10750": null,
"customfield_10552": null,
"customfield_10551": null,
"assignee": {
"self": "https://xxxx.atlassian.net/rest/api/2/user?username=xxx.xxx",
"name": "xxx.xxx",
"emailAddress": "xxx.xxx@xxxx.com",
"avatarUrls": {
"128x128": "https://xxxx.atlassian.net/secure/useravatar?size=xxxlarge&avatarId=10072",
"16x16": "https://xxxx.atlassian.net/secure/useravatar?size=xsmall&avatarId=10072",
"24x24": "https://xxxx.atlassian.net/secure/useravatar?size=small&avatarId=10072",
"64x64": "https://xxxx.atlassian.net/secure/useravatar?size=xlarge&avatarId=10072",
"256x256": "https://xxxx.atlassian.net/secure/useravatar?size=xxxlarge%402x&avatarId=10072",
"32x32": "https://xxxx.atlassian.net/secure/useravatar?size=medium&avatarId=10072",
"48x48": "https://xxxx.atlassian.net/secure/useravatar?avatarId=10072",
"96x96": "https://xxxx.atlassian.net/secure/useravatar?size=xxlarge&avatarId=10072",
"192x192": "https://xxxx.atlassian.net/secure/useravatar?size=xxlarge%402x&avatarId=10072"
},
"displayName": "XXXX XXXX",
"active": true
},
"customfield_10554": null,
"attachment": [ ],
"customfield_10553": null,
"customfield_10850": null,
"customfield_10550": null,
"aggregatetimeestimate": null,
"versions": [ ],
"timeestimate": null,
"aggregatetimespent": null
}

}

Hi Com Com,
First of all, I'm sorry for the so long delay with answer, we had big May holidays in Russia.
Custom fields like with names like 'customfield_10553' are added by some Jira plugins.
That is why you don't see this fields in Jira interface.
To solve this issue you should edit file %rest_python_lib_path%/jira/__init__.py. Change type for fields customfield_* to string and then run import. When import is done you can see at it's values and then rerun import with adjusted field types.