Skip to content

Commit

Permalink
When loading role from disk, log helpful error if not found
Browse files Browse the repository at this point in the history
  • Loading branch information
timcharper committed Mar 29, 2010
1 parent 156f667 commit 48af8ce
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion chef/lib/chef/run_list.rb
Expand Up @@ -133,7 +133,7 @@ def expand(from='server', couchdb=nil, rest=nil)
@seen_roles << name
if from == 'disk' || Chef::Config[:solo]
# Load the role from disk
Chef::Role.from_disk("#{name}") || Chef::Exceptions::RoleNotFound
Chef::Role.from_disk("#{name}") || raise(Chef::Exceptions::RoleNotFound)
elsif from == 'server'
# Load the role from the server
begin
Expand Down
6 changes: 6 additions & 0 deletions chef/spec/unit/run_list_spec.rb
Expand Up @@ -159,6 +159,12 @@
Chef::Role.should_receive(:from_disk).with("stubby")
@run_list.expand("disk")
end

it "should log a helpful error if the role is not available" do
Chef::Role.stub!(:from_disk).and_return(nil)
Chef::Log.should_receive(:error).with("Role stubby is in the runlist but does not exist. Skipping expand.")
@run_list.expand("disk")
end
end

describe "from the chef server" do
Expand Down

0 comments on commit 48af8ce

Please sign in to comment.