diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-11-11 16:42:42 +0100 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-11-11 16:43:43 +0100 |
commit | 4599d6430b2a20df653c3b0428898951563850f1 (patch) | |
tree | ba28f3b9a767b27761dd0137cc124dbe696f9778 | |
parent | 79fdf65c71e90773fbf52d6832b74cf5a7124755 (diff) | |
download | gitlab-shell-4599d6430b2a20df653c3b0428898951563850f1.tar.gz |
Exit with non-zero status when import-repository fails
-rw-r--r-- | lib/gitlab_projects.rb | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/gitlab_projects.rb b/lib/gitlab_projects.rb index 8bf000d..53fe815 100644 --- a/lib/gitlab_projects.rb +++ b/lib/gitlab_projects.rb @@ -154,19 +154,23 @@ class GitlabProjects Timeout.timeout(timeout) do Process.wait(pid) end + + return false unless $?.exitstatus.zero? rescue Timeout::Error $logger.error "Importing project #{@project_name} from <#{masked_source}> failed due to timeout." Process.kill('KILL', pid) Process.wait FileUtils.rm_rf(full_path) - false - else - self.class.create_hooks(full_path) - # The project was imported successfully. - # Remove the origin URL since it may contain password. - remove_origin_in_repo + return false end + + self.class.create_hooks(full_path) + # The project was imported successfully. + # Remove the origin URL since it may contain password. + remove_origin_in_repo + + true end # Move repository from one directory to another |