Permalink
Browse files

Updated puppetral to return resources it creates

Previously, the create_resource method returned a human readable
string indicating success or failure of the create operation. The
create_resource method now also returns the actual resource that was
created, if any.
  • Loading branch information...
1 parent fd27930 commit 250e61178ac56589e18c7bcc3281f1197a9760c2 @lifton committed Oct 24, 2011
Showing with 12 additions and 4 deletions.
  1. +7 −2 agent/puppetral/agent/puppetral.ddl
  2. +5 −2 agent/puppetral/agent/puppetral.rb
@@ -33,9 +33,14 @@ action "create", :description => "Add a resource to the RAL" do
:optional => true,
:maxlength => 90
- output :output,
+ output :status,
:description => "Message indicating success or failure of the action",
- :display_as => "Result"
+ :display_as => "Status"
+
+ output :resource,
+ :description => "Resource that was created",
+ :display_as => "Resource"
+
end
action "find", :description => "Get the value of a resource" do
@@ -38,11 +38,14 @@ class Puppetral<RPC::Agent
success = true
if report && report.resource_statuses.first.last.failed
- reply[:output] = report.resource_statuses.first.last.events.first.message
+ reply[:status] = report.resource_statuses.first.last.events.first.message
success = false
end
- reply[:output] = "Resource was created" if success
+ if success
+ reply[:status] = "Resource was created"
+ reply[:resource] = result.to_pson_data_hash
+ end
end
# Remove the avoid_conflict property if it clashes in one or more of

0 comments on commit 250e611

Please sign in to comment.