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
diff options
context:
space:
mode:
Diffstat (limited to 'qa/qa/support/ssh.rb')
-rw-r--r--qa/qa/support/ssh.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/qa/qa/support/ssh.rb b/qa/qa/support/ssh.rb
index a5e8e96cb6c..1b53244d1e4 100644
--- a/qa/qa/support/ssh.rb
+++ b/qa/qa/support/ssh.rb
@@ -51,11 +51,21 @@ module QA
private
def uri_port
- uri.port && (uri.port != 80) ? uri.port : nil
+ use_typical_params? ? nil : uri.port
end
def git_user
- QA::Runtime::Env.running_in_ci? || [443, 80].include?(uri.port) ? 'git' : Etc.getlogin
+ QA::Runtime::Env.running_in_ci? || use_typical_params? ? 'git' : Etc.getlogin
+ end
+
+ # Checks if typical parameters should be used. That means the SSH port will not be
+ # needed because it's port 22, and the git user is named 'git'. We assume that
+ # typical parameters should be used if the host URI includes a typical HTTP(S)
+ # port (80 or 443)
+ #
+ # @return [Boolean] whether typical SSH port and git user parameters should be used
+ def use_typical_params?
+ [443, 80].include?(uri.port)
end
end
end