Skip to content

Commit

Permalink
Allow ssh transport protocol for a git module spec
Browse files Browse the repository at this point in the history
!bug

* **Allow ssh transport protocol** ([#3237](#3237))

  Fix regression introduced by commit [0a09069](0a09069).
  Allow install module from git private repository with SSH transport URI (e.g ssh://git@mygitlabserver:12345/namespace/myprivatemod.git)
  • Loading branch information
mcarrolle committed May 9, 2024
1 parent 84520a0 commit 7407b14
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/bolt/module_installer/specs/git_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def initialize(init_hash, config = {})

unless valid_url?(@git)
raise Bolt::ValidationError,
"Invalid URI #{@git}. Valid URIs must begin with 'git@', 'http://', or 'https://'."
"Invalid URI #{@git}. Valid URIs must begin with 'git@', 'http://', 'https://' or 'ssh://'."
end
end

Expand Down Expand Up @@ -140,7 +140,7 @@ def sha
return true if url.start_with?('git@')

uri = URI.parse(url)
uri.is_a?(URI::HTTP) && uri.host
(uri.is_a?(URI::HTTP) || uri.scheme == "ssh") && uri.host
rescue URI::InvalidURIError
false
end
Expand Down
5 changes: 5 additions & 0 deletions spec/unit/module_installer/specs/git_spec_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@
/Option 'resolve'.*must be a Boolean/
)
end

it 'allow ssh URI' do
init_hash['git'] = 'ssh://myuser@github.com:12345/puppetlabs/puppetlabs-yaml'
expect { spec }.not_to raise_error
end
end

context '#to_hash' do
Expand Down

0 comments on commit 7407b14

Please sign in to comment.