diff options
author | John Kerry <jk185160@ncr.com> | 2016-02-07 08:22:03 -0500 |
---|---|---|
committer | John Kerry <jk185160@ncr.com> | 2016-03-23 21:36:43 -0400 |
commit | 8c8060ed20a6dd0a085a7484ce95a7d4967f407b (patch) | |
tree | 727b120dd330f980354a61f83ea8647333c2d3ec | |
parent | d55259b34cbcc6b9b7697cdb38800aa3aeef6f96 (diff) | |
download | chef-8c8060ed20a6dd0a085a7484ce95a7d4967f407b.tar.gz |
Adding the provider and spec files for sftp
-rw-r--r-- | chef.gemspec | 1 | ||||
-rw-r--r-- | lib/chef/provider/remote_file/sftp.rb | 32 | ||||
-rw-r--r-- | spec/unit/provider/remote_file/sftp_spec.rb | 33 |
3 files changed, 66 insertions, 0 deletions
diff --git a/chef.gemspec b/chef.gemspec index 5b9805827a..8d19051dbd 100644 --- a/chef.gemspec +++ b/chef.gemspec @@ -26,6 +26,7 @@ Gem::Specification.new do |s| s.add_dependency "ffi-yajl", "~> 2.2" s.add_dependency "net-ssh", ">= 2.9", "< 4.0" s.add_dependency "net-ssh-multi", "~> 1.1" + s.add_dependency "net-sftp", "~> 2.1", ">= 2.1.2" s.add_dependency "highline", "~> 1.6", ">= 1.6.9" s.add_dependency "erubis", "~> 2.7" s.add_dependency "diff-lcs", "~> 1.2", ">= 1.2.4" diff --git a/lib/chef/provider/remote_file/sftp.rb b/lib/chef/provider/remote_file/sftp.rb new file mode 100644 index 0000000000..868ccb982c --- /dev/null +++ b/lib/chef/provider/remote_file/sftp.rb @@ -0,0 +1,32 @@ +# +# Author:: Jesse Campbell (<hikeit@gmail.com>) +# Copyright:: Copyright 2013-2016, Jesse Campbell +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require 'uri' +require 'tempfile' +require 'net/sftp' +require 'chef/provider/remote_file' +require 'chef/file_content_management/tempfile' + +class Chef + class Provider + class RemoteFile + class SFTP + end + end + end +end diff --git a/spec/unit/provider/remote_file/sftp_spec.rb b/spec/unit/provider/remote_file/sftp_spec.rb new file mode 100644 index 0000000000..1e42b72af5 --- /dev/null +++ b/spec/unit/provider/remote_file/sftp_spec.rb @@ -0,0 +1,33 @@ +# +# Author:: John Kerry (<john@kerryhouse.net>) +# Copyright:: Copyright 2013-2016, John Kerry +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require "spec_helper" + +describe Chef::Provider::RemoteFile::SFTP do + #built out dependencies + let(:uri) { URI.Parse("sftp://opscode.com/seattle.txt") } + + describe "on initialization" do + + it "throws an argument exception when no path is given" do + uri.path = "" + expect { Chef::Provider::RemoteFile::SFTP.new(uri, new_resource, current_resource) }.to raise_error(ArgumentError) + end + + end +end |