summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Lewis <nick@puppetlabs.com>2011-08-15 15:51:37 -0700
committerJacob Helwig <jacob@puppetlabs.com>2011-08-19 13:52:59 -0700
commit3812fc35eae962938041256f8974bc94f41a3326 (patch)
tree7adade99d80b77817fc3618ea9d37fd6da2465dd
parentb6ca78cc8d28dd51ce64de42d20f6fb49dfe814a (diff)
downloadpuppet-3812fc35eae962938041256f8974bc94f41a3326.tar.gz
puppet-3812fc35eae962938041256f8974bc94f41a3326.tar.xz
puppet-3812fc35eae962938041256f8974bc94f41a3326.zip
(#5495) Remove dead Windows-specific code from posix exec provider
Because this provider only applies when the posix feature is present (and thus not the windows feature), it can never be used on Windows. Thus, the Windows-specific command handling is unnecessary and unused. Also added more specific error messages for the cases where a command doesn't exist, isn't a file, and isn't executable. These only apply when the command path is absolute (otherwise the message is simply command not found). Reviewed-By: Matt Robinson <matt@puppetlabs.com> (cherry picked from commit b28bcb031346cfd2026361ec5ffb420c1dcf60d7) Conflicts: spec/unit/provider/exec/posix_spec.rb
-rwxr-xr-xspec/unit/provider/exec/posix_spec.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/spec/unit/provider/exec/posix_spec.rb b/spec/unit/provider/exec/posix_spec.rb
index 883e3c716..876b9724d 100755
--- a/spec/unit/provider/exec/posix_spec.rb
+++ b/spec/unit/provider/exec/posix_spec.rb
@@ -11,7 +11,7 @@ describe Puppet::Type.type(:exec).provider(:posix) do
command
end
- let(:resource) { Puppet::Type.type(:exec).new(:title => File.expand_path('/foo')) }
+ let(:resource) { Puppet::Type.type(:exec).new(:title => '/foo') }
let(:provider) { described_class.new(resource) }
before :each do
@@ -34,7 +34,7 @@ describe Puppet::Type.type(:exec).provider(:posix) do
it "should pass if command is fully qualifed" do
provider.resource[:path] = ['/bogus/bin']
- provider.validatecmd(File.expand_path("/bin/blah/foo"))
+ provider.validatecmd("/bin/blah/foo")
end
end
@@ -55,7 +55,6 @@ describe Puppet::Type.type(:exec).provider(:posix) do
it "should fail if the command isn't executable" do
FileUtils.touch(command)
- File.stubs(:executable?).with(command).returns(false)
expect { provider.run(command) }.to raise_error(ArgumentError, "'#{command}' is not executable")
end
@@ -81,7 +80,6 @@ describe Puppet::Type.type(:exec).provider(:posix) do
it "should fail if the command is in the path but not executable" do
command = tmpfile('foo')
FileUtils.touch(command)
- FileTest.stubs(:executable?).with(command).returns(false)
resource[:path] = [File.dirname(command)]
filename = File.basename(command)
@@ -104,7 +102,7 @@ describe Puppet::Type.type(:exec).provider(:posix) do
it "should fail if quoted command doesn't exist" do
provider.resource[:path] = ['/bogus/bin']
- command = "#{File.expand_path('/foo')} bar --sillyarg=true --blah"
+ command = "/foo bar --sillyarg=true --blah"
expect { provider.run(%Q["#{command}"]) }.to raise_error(ArgumentError, "Could not find command '#{command}'")
end