Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-12-19 20:56:06 +0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-12-21 15:56:04 +0300
commit136be3e4362e5c4900d8eb37f6e5f06b5ee18602 (patch)
tree7c3044f62c3859b203f3ce940a2acd6765dca0c6 /lib
parentc424836a076c06486e1a16760f5cceefb86d18ff (diff)
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
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/import_export/project_tree_restorer.rb2
-rw-r--r--lib/gitlab/import_export/relation_factory.rb7
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/gitlab/import_export/project_tree_restorer.rb b/lib/gitlab/import_export/project_tree_restorer.rb
index c551321c18d..cda6ddf0443 100644
--- a/lib/gitlab/import_export/project_tree_restorer.rb
+++ b/lib/gitlab/import_export/project_tree_restorer.rb
@@ -120,7 +120,7 @@ module Gitlab
members_mapper: members_mapper,
user: @user,
project_id: restored_project.id)
- end
+ end.compact
relation_hash_list.is_a?(Array) ? relation_array : relation_array.first
end
diff --git a/lib/gitlab/import_export/relation_factory.rb b/lib/gitlab/import_export/relation_factory.rb
index 66e54e86ea9..500a1a49a80 100644
--- a/lib/gitlab/import_export/relation_factory.rb
+++ b/lib/gitlab/import_export/relation_factory.rb
@@ -40,6 +40,8 @@ module Gitlab
# the relation_hash, updating references with new object IDs, mapping users using
# the "members_mapper" object, also updating notes if required.
def create
+ return nil if unknown_service?
+
setup_models
generate_imported_object
@@ -215,6 +217,11 @@ module Gitlab
existing_object
end
end
+
+ def unknown_service?
+ @relation_name == :services && parsed_relation_hash['type'] &&
+ !Object.const_defined?(parsed_relation_hash['type'])
+ end
end
end
end