diff --git a/lib/bolt/module_installer/specs/git_spec.rb b/lib/bolt/module_installer/specs/git_spec.rb index 72c395d132..e4543f3bf2 100644 --- a/lib/bolt/module_installer/specs/git_spec.rb +++ b/lib/bolt/module_installer/specs/git_spec.rb @@ -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 @@ -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 diff --git a/spec/unit/module_installer/specs/git_spec_spec.rb b/spec/unit/module_installer/specs/git_spec_spec.rb index 41674aca09..23f8d2cae3 100644 --- a/spec/unit/module_installer/specs/git_spec_spec.rb +++ b/spec/unit/module_installer/specs/git_spec_spec.rb @@ -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