Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convey a useful message to queue_object_action #13710

Merged
merged 1 commit into from
Jan 31, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions app/controllers/api/subcollections/snapshots.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ def snapshots_create_resource(parent, _type, _id, data)
validation = parent.validate_create_snapshot
raise validation[:message] unless validation[:available]

message = "Creating snapshot #{data["name"]} for #{snapshot_ident(parent)}"
task_id = queue_object_action(
parent,
"summary",
message,
:method_name => "create_snapshot",
:args => [data["name"], data["description"], data.fetch("memory", false)]
)

action_result(true, "Creating snapshot #{data["name"]} for #{snapshot_ident(parent)}", :task_id => task_id)
action_result(true, message, :task_id => task_id)
rescue => e
action_result(false, e.to_s)
end
Expand All @@ -28,8 +29,9 @@ def delete_resource_snapshots(parent, type, id, _data)
raise validation[:message] unless validation[:available]
snapshot = resource_search(id, type, collection_class(type))

task_id = queue_object_action(parent, "summary", :method_name => "remove_snapshot", :args => [id])
action_result(true, "Deleting snapshot #{snapshot.name} for #{snapshot_ident(parent)}", :task_id => task_id)
message = "Deleting snapshot #{snapshot.name} for #{snapshot_ident(parent)}"
task_id = queue_object_action(parent, message, :method_name => "remove_snapshot", :args => [id])
action_result(true, message, :task_id => task_id)
rescue => e
action_result(false, e.to_s)
end
Expand Down