summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2005-08-29 22:31:22 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2005-08-29 22:31:22 +0000
commit062906591bc21d761ed00d33f9fa95c425b16ccd (patch)
tree78b572ef620644f0a07dddb4404bcdad678c06a2
parent82ac86e1996e156eb98bb0b06a8926ec61c8fdcc (diff)
downloadpuppet-062906591bc21d761ed00d33f9fa95c425b16ccd.tar.gz
puppet-062906591bc21d761ed00d33f9fa95c425b16ccd.tar.xz
puppet-062906591bc21d761ed00d33f9fa95c425b16ccd.zip
fixing puppet to use correct method and adding a real test case for it
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@605 980ebf18-57e1-0310-9a29-db15c13687c0
-rwxr-xr-xbin/puppet9
-rwxr-xr-xtest/executables/tc_puppetbin.rb27
2 files changed, 32 insertions, 4 deletions
diff --git a/bin/puppet b/bin/puppet
index b86d578aa..d4ad1af8f 100755
--- a/bin/puppet
+++ b/bin/puppet
@@ -25,7 +25,8 @@
# Print this help message
#
# logfile::
-# Where to send messages. Defaults to sending messages to the console.
+# Where to send messages. Choose between syslog, the console, and a log file.
+# Defaults to sending messages to the console.
#
# = Example
#
@@ -56,7 +57,7 @@ end
result = GetoptLong.new(
[ "--debug", "-d", GetoptLong::NO_ARGUMENT ],
[ "--help", "-h", GetoptLong::NO_ARGUMENT ],
- [ "--logfile", "-l", GetoptLong::REQUIRED_ARGUMENT ],
+ [ "--logdest", "-l", GetoptLong::REQUIRED_ARGUMENT ],
[ "--verbose", "-v", GetoptLong::NO_ARGUMENT ],
[ "--version", "-V", GetoptLong::NO_ARGUMENT ]
)
@@ -82,7 +83,7 @@ begin
verbose = true
when "--debug"
debug = true
- when "--logfile"
+ when "--logdest"
# FIXME we should be able to have log.rb check the validity of the dst
case arg
when "syslog", "console", /^\//:
@@ -127,7 +128,7 @@ end
begin
client.getconfig
- client.config
+ client.apply
rescue => detail
Puppet.err detail
exit(1)
diff --git a/test/executables/tc_puppetbin.rb b/test/executables/tc_puppetbin.rb
index d1261dad7..decb46e9b 100755
--- a/test/executables/tc_puppetbin.rb
+++ b/test/executables/tc_puppetbin.rb
@@ -23,9 +23,15 @@ ENV["RUBYLIB"] = libdirs.join(":")
class TestPuppetBin < Test::Unit::TestCase
def setup
+ @@tmpfiles = []
end
def teardown
+ @@tmpfiles.each { |f|
+ if FileTest.exists?(f)
+ system("rm -rf %s" % f)
+ end
+ }
end
def test_version
@@ -35,4 +41,25 @@ class TestPuppetBin < Test::Unit::TestCase
}
assert(output == Puppet.version)
end
+
+ def test_execution
+ file = "/tmp/puppetbintestingmanifest.pp"
+ File.open(file, "w") { |f|
+ f.puts '
+file { "/tmp/puppetbintesting": create => true, mode => 755 }
+'
+ }
+
+ @@tmpfiles << file
+ @@tmpfiles << "/tmp/puppetbintesting"
+
+ output = nil
+ assert_nothing_raised {
+ system("puppet --logdest /dev/null %s" % file)
+ }
+ assert($? == 0, "Puppet exited with code %s" % $?.to_i)
+
+ assert(FileTest.exists?("/tmp/puppetbintesting"),
+ "Failed to create config'ed file")
+ end
end