Skip to content

Commit 42ec31c

Browse files
authored
Merge pull request #3305 from mcarrolle/ssh-transport
allow ssh transport protocol for a git module spec
2 parents 7724526 + 7407b14 commit 42ec31c

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/bolt/module_installer/specs/git_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def initialize(init_hash, config = {})
4545

4646
unless valid_url?(@git)
4747
raise Bolt::ValidationError,
48-
"Invalid URI #{@git}. Valid URIs must begin with 'git@', 'http://', or 'https://'."
48+
"Invalid URI #{@git}. Valid URIs must begin with 'git@', 'http://', 'https://' or 'ssh://'."
4949
end
5050
end
5151

@@ -140,7 +140,7 @@ def sha
140140
return true if url.start_with?('git@')
141141

142142
uri = URI.parse(url)
143-
uri.is_a?(URI::HTTP) && uri.host
143+
(uri.is_a?(URI::HTTP) || uri.scheme == "ssh") && uri.host
144144
rescue URI::InvalidURIError
145145
false
146146
end

spec/unit/module_installer/specs/git_spec_spec.rb

+5
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@
6161
/Option 'resolve'.*must be a Boolean/
6262
)
6363
end
64+
65+
it 'allow ssh URI' do
66+
init_hash['git'] = 'ssh://[email protected]:12345/puppetlabs/puppetlabs-yaml'
67+
expect { spec }.not_to raise_error
68+
end
6469
end
6570

6671
context '#to_hash' do

0 commit comments

Comments
 (0)