summaryrefslogtreecommitdiff
path: root/lib/gitlab/import_export
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2016-12-16 16:13:46 +0100
committerRémy Coutable <remy@rymai.me>2016-12-19 16:32:26 +0100
commit786457ca3e77e6af02ecabcfd6d5eae6a31837c1 (patch)
tree46ee8e37701a2eb16f643908b82adbac1ac4385c /lib/gitlab/import_export
parentffcd20cec8b848e24b54fc37658d9841d34f5c35 (diff)
downloadgitlab-ce-786457ca3e77e6af02ecabcfd6d5eae6a31837c1.tar.gz
Fix for missing service when importing from EE to CEfix/import-export-ee-services
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'lib/gitlab/import_export')
-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 9b590bcee8d..b4f0f761add 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
@@ -217,6 +219,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