summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Niedzielski <adamsunday@gmail.com>2016-11-24 17:24:17 +0100
committerAdam Niedzielski <adamsunday@gmail.com>2016-11-24 17:24:17 +0100
commit7ddb7115ec2ae75395dbf6d336dcfe5da0d29a51 (patch)
tree9766632eba80a0ff08b935a77bc43ee488e1f411
parent858602ea153056f6cbfeeb4114ea6e29aba03a7a (diff)
downloadgitlab-ce-24777-fix-type-error-in-jira-integration.tar.gz
Do not call JIRA API if project_key is not set24777-fix-type-error-in-jira-integration
Calling JIRA API with blank project_key causes "TypeError: no implicit conversion of Array into Hash" in jira-ruby gem. We have old records in the database that do not have project_key set and we have to handle them.
-rw-r--r--app/models/project_services/jira_service.rb3
-rw-r--r--changelogs/unreleased/24777-fix-type-error-in-jira-integration.yml4
2 files changed, 7 insertions, 0 deletions
diff --git a/app/models/project_services/jira_service.rb b/app/models/project_services/jira_service.rb
index 70bbbbcda85..af9418d8119 100644
--- a/app/models/project_services/jira_service.rb
+++ b/app/models/project_services/jira_service.rb
@@ -53,6 +53,9 @@ class JiraService < IssueTrackerService
end
def jira_project
+ # we validate presence of project_key now but old records may not
+ # have this value
+ return nil if project_key.blank?
@jira_project ||= jira_request { client.Project.find(project_key) }
end
diff --git a/changelogs/unreleased/24777-fix-type-error-in-jira-integration.yml b/changelogs/unreleased/24777-fix-type-error-in-jira-integration.yml
new file mode 100644
index 00000000000..81676764437
--- /dev/null
+++ b/changelogs/unreleased/24777-fix-type-error-in-jira-integration.yml
@@ -0,0 +1,4 @@
+---
+title: Do not call JIRA API if project_key is not set
+merge_request: 7745
+author: