summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2005-08-29 22:53:17 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2005-08-29 22:53:17 +0000
commitf65563d3d6eddeeac5f1b14e7b2635776be802a7 (patch)
treed893aa719fa360d10871bd40fab35540f1234f50
parent062906591bc21d761ed00d33f9fa95c425b16ccd (diff)
changing default hostname to "puppet", and adding --parseonly option along with a test case for it
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@606 980ebf18-57e1-0310-9a29-db15c13687c0
-rwxr-xr-xbin/puppetmasterd15
-rwxr-xr-xtest/executables/tc_puppetmasterd.rb22
2 files changed, 34 insertions, 3 deletions
diff --git a/bin/puppetmasterd b/bin/puppetmasterd
index 1e9735ff5..c36a62566 100755
--- a/bin/puppetmasterd
+++ b/bin/puppetmasterd
@@ -10,7 +10,7 @@
# puppetmasterd [-h|--help] [-d|--debug] [-v|--verbose] [-V|--version]
# [-l|--logdest <syslog|console|<file>>] [--httplog <file>]
# [-m|--manifest <site manifest>] [--noca] [-p|--port <port>]
-# [-s|--ssldir <cert directory>]
+# [--parseonly] [-s|--ssldir <cert directory>]
#
# = Description
#
@@ -47,6 +47,9 @@
# noca::
# Do not function as a certificate authority.
#
+# parseonly::
+# Just parse the central manifest to verify it is syntactically correct.
+#
# port::
# The port on which to listen. Defaults to 8139.
#
@@ -85,6 +88,7 @@ result = GetoptLong.new(
[ "--logdest", "-l", GetoptLong::REQUIRED_ARGUMENT ],
[ "--manifest", "-m", GetoptLong::REQUIRED_ARGUMENT ],
[ "--noca", GetoptLong::NO_ARGUMENT ],
+ [ "--parseonly", GetoptLong::NO_ARGUMENT ],
[ "--port", "-p", GetoptLong::REQUIRED_ARGUMENT ],
[ "--ssldir", "-s", GetoptLong::REQUIRED_ARGUMENT ],
[ "--verbose", "-v", GetoptLong::NO_ARGUMENT ],
@@ -105,6 +109,8 @@ ca = {}
fs = {}
args = {}
+parseonly = false
+
begin
result.each { |opt,arg|
case opt
@@ -132,6 +138,8 @@ begin
master[:File] = arg
when "--noca"
haveca = false
+ when "--parseonly"
+ parseonly = true
when "--port"
args[:Port] = arg
when "--ssldir"
@@ -207,6 +215,11 @@ rescue => detail
exit(1)
end
+if parseonly
+ # we would have already exited if the file weren't syntactically correct
+ exit(0)
+end
+
if bg
server.daemonize
end
diff --git a/test/executables/tc_puppetmasterd.rb b/test/executables/tc_puppetmasterd.rb
index ef89aa044..7f79f3ee5 100755
--- a/test/executables/tc_puppetmasterd.rb
+++ b/test/executables/tc_puppetmasterd.rb
@@ -60,7 +60,7 @@ class TestPuppetMasterD < Test::Unit::TestCase
pid = nil
%x{#{ps}}.chomp.split(/\n/).each { |line|
- if line =~ /puppetmasterd --manifest/
+ if line =~ /ruby.+puppetmasterd/
ary = line.split(" ")
pid = ary[1].to_i
end
@@ -122,7 +122,25 @@ class TestPuppetMasterD < Test::Unit::TestCase
assert_nothing_raised {
Marshal::load(CGI.unescape(retval))
}
- #stopmasterd
+ stopmasterd
+ end
+
+ def test_parseonly
+ file = File.join($puppetbase, "examples", "code", "head")
+ startmasterd("--parseonly --manifest #{file}")
+
+ pid = nil
+ ps = Facter["ps"].value || "ps -ef"
+ %x{#{ps}}.chomp.split(/\n/).each { |line|
+ if line =~ /puppetmasterd --manifest/
+ ary = line.split(" ")
+ pid = ary[1].to_i
+ end
+ }
+
+ assert($? == 0, "Puppetmasterd ended with non-zero exit status")
+
+ assert_nil(pid, "Puppetmasterd is still running after parseonly")
end
def disabled_test_sslconnection