Commit 136be3e4 authored by Rémy Coutable's avatar Rémy Coutable Committed by Douglas Barbosa Alexandre

Merge branch 'fix/import-export-ee-services' into 'master'

Fix missing service error importing from EE to CE

Ignores services that are missing in the new instance (EE or even a customised instance), to avoid breaking the import.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/23782

See merge request !8144
parent c424836a
---
title: Fix missing service error importing from EE to CE
merge_request: 8144
author:
...@@ -120,7 +120,7 @@ module Gitlab ...@@ -120,7 +120,7 @@ module Gitlab
members_mapper: members_mapper, members_mapper: members_mapper,
user: @user, user: @user,
project_id: restored_project.id) project_id: restored_project.id)
end end.compact
relation_hash_list.is_a?(Array) ? relation_array : relation_array.first relation_hash_list.is_a?(Array) ? relation_array : relation_array.first
end end
......
...@@ -40,6 +40,8 @@ module Gitlab ...@@ -40,6 +40,8 @@ module Gitlab
# the relation_hash, updating references with new object IDs, mapping users using # the relation_hash, updating references with new object IDs, mapping users using
# the "members_mapper" object, also updating notes if required. # the "members_mapper" object, also updating notes if required.
def create def create
return nil if unknown_service?
setup_models setup_models
generate_imported_object generate_imported_object
...@@ -215,6 +217,11 @@ module Gitlab ...@@ -215,6 +217,11 @@ module Gitlab
existing_object existing_object
end end
end end
def unknown_service?
@relation_name == :services && parsed_relation_hash['type'] &&
!Object.const_defined?(parsed_relation_hash['type'])
end
end end
end end
end end
...@@ -7409,6 +7409,28 @@ ...@@ -7409,6 +7409,28 @@
"category": "common", "category": "common",
"default": false, "default": false,
"wiki_page_events": true "wiki_page_events": true
},
{
"id": 101,
"title": "JenkinsDeprecated",
"project_id": 5,
"created_at": "2016-06-14T15:01:51.031Z",
"updated_at": "2016-06-14T15:01:51.031Z",
"active": false,
"properties": {
},
"template": false,
"push_events": true,
"issues_events": true,
"merge_requests_events": true,
"tag_push_events": true,
"note_events": true,
"build_events": true,
"category": "common",
"default": false,
"wiki_page_events": true,
"type": "JenkinsDeprecatedService"
} }
], ],
"hooks": [ "hooks": [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment