diff options
| author | Luke Kanies <luke@madstop.com> | 2009-05-09 13:40:59 -0700 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2009-05-27 10:57:45 -0500 |
| commit | e0c19f99f44d94715984d5533daed25e35ac6f3b (patch) | |
| tree | fd454912283626c4bcb6cd4e05a02d2116d8b96c | |
| parent | ab34cf610ee529fcbbf777aae7b382090af1a8b2 (diff) | |
| download | puppet-e0c19f99f44d94715984d5533daed25e35ac6f3b.tar.gz puppet-e0c19f99f44d94715984d5533daed25e35ac6f3b.tar.xz puppet-e0c19f99f44d94715984d5533daed25e35ac6f3b.zip | |
Fixing #2228 - --logdest works again in puppetd and puppetmasterd
Signed-off-by: Luke Kanies <luke@madstop.com>
| -rw-r--r-- | lib/puppet/application/puppetd.rb | 2 | ||||
| -rw-r--r-- | lib/puppet/application/puppetmasterd.rb | 2 | ||||
| -rwxr-xr-x | spec/unit/application/puppetd.rb | 17 | ||||
| -rw-r--r-- | spec/unit/application/puppetmasterd.rb | 18 |
4 files changed, 37 insertions, 2 deletions
diff --git a/lib/puppet/application/puppetd.rb b/lib/puppet/application/puppetd.rb index 1f97043fa..83bb65691 100644 --- a/lib/puppet/application/puppetd.rb +++ b/lib/puppet/application/puppetd.rb @@ -65,7 +65,7 @@ Puppet::Application.new(:puppetd) do options[:waitforcert] = 0 unless @explicit_waitforcert end - option("--logdest", "-l") do |arg| + option("--logdest DEST", "-l DEST") do |arg| begin Puppet::Util::Log.newdestination(arg) options[:setdest] = true diff --git a/lib/puppet/application/puppetmasterd.rb b/lib/puppet/application/puppetmasterd.rb index 52f33cba9..e5051293f 100644 --- a/lib/puppet/application/puppetmasterd.rb +++ b/lib/puppet/application/puppetmasterd.rb @@ -14,7 +14,7 @@ Puppet::Application.new(:puppetmasterd) do # internal option, only to be used by ext/rack/config.ru option("--rack") - option("--logdest", "-l") do |arg| + option("--logdest DEST", "-l DEST") do |arg| begin Puppet::Util::Log.newdestination(arg) options[:setdest] = true diff --git a/spec/unit/application/puppetd.rb b/spec/unit/application/puppetd.rb index 08f2a070a..18caa9e86 100755 --- a/spec/unit/application/puppetd.rb +++ b/spec/unit/application/puppetd.rb @@ -76,6 +76,15 @@ describe "puppetd" do end describe "when handling options" do + before do + @old_argv = ARGV.dup + ARGV.clear + end + + after do + ARGV.clear + @old_argv.each { |a| ARGV << a } + end [:centrallogging, :disable, :enable, :debug, :fqdn, :test, :verbose].each do |option| it "should declare handle_#{option} method" do @@ -130,6 +139,14 @@ describe "puppetd" do @puppetd.handle_logdest("console") end + it "should parse the log destination from ARGV" do + ARGV << "--logdest" << "/my/file" + + Puppet::Util::Log.expects(:newdestination).with("/my/file") + + @puppetd.parse_options + end + it "should store the waitforcert options with --waitforcert" do @puppetd.options.expects(:[]=).with(:waitforcert,42) diff --git a/spec/unit/application/puppetmasterd.rb b/spec/unit/application/puppetmasterd.rb index 59377abb0..000b2d602 100644 --- a/spec/unit/application/puppetmasterd.rb +++ b/spec/unit/application/puppetmasterd.rb @@ -75,6 +75,16 @@ describe "PuppetMaster" do end describe "when applying options" do + before do + @old_argv = ARGV.dup + ARGV.clear + end + + after do + ARGV.clear + @old_argv.each { |a| ARGV << a } + end + it "should set the log destination with --logdest" do Puppet::Log.expects(:newdestination).with("console") @@ -86,6 +96,14 @@ describe "PuppetMaster" do @puppetmasterd.handle_logdest("console") end + + it "should parse the log destination from ARGV" do + ARGV << "--logdest" << "/my/file" + + Puppet::Util::Log.expects(:newdestination).with("/my/file") + + @puppetmasterd.parse_options + end end describe "during setup" do |
