diff options
-rw-r--r-- | lib/puppet/application/main.rb | 4 | ||||
-rwxr-xr-x | spec/unit/application/main.rb | 6 |
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/puppet/application/main.rb b/lib/puppet/application/main.rb index faa317623..5eab81ae6 100644 --- a/lib/puppet/application/main.rb +++ b/lib/puppet/application/main.rb @@ -89,7 +89,9 @@ Puppet::Application.new(:main) do end # Collect our facts. - facts = Puppet::Node::Facts.find(Puppet[:certname]) + unless facts = Puppet::Node::Facts.find(Puppet[:certname]) + raise "Could not find facts for %s" % Puppet[:certname] + end # Find our Node unless node = Puppet::Node.find(Puppet[:certname]) diff --git a/spec/unit/application/main.rb b/spec/unit/application/main.rb index a5ebc633a..497ee6b5e 100755 --- a/spec/unit/application/main.rb +++ b/spec/unit/application/main.rb @@ -229,6 +229,12 @@ describe "Puppet" do @main.main end + it "should raise an error if we can't find the node" do + Puppet::Node::Facts.expects(:find).returns(nil) + + lambda { @puppet.main }.should raise_error + end + it "should find the node" do Puppet::Node.expects(:find).returns(@node) |