ACK
----- Original Message -----
From: jprovazn(a)redhat.com
To: deltacloud-devel(a)lists.fedorahosted.org
Sent: Wednesday, August 4, 2010 4:08:18 PM GMT +01:00 Amsterdam / Berlin / Bern / Rome /
Stockholm / Vienna
Subject: [deltacloud-devel] [PATCH aggregator] Fixed fetching of instance state
From: Jan Provaznik <jprovazn(a)redhat.com>
When a provider is down and instance state is fetched (for example
on instances index page), then there is a nil object and exception
is thrown.
---
src/app/models/instance_task.rb | 27 +++++++++++++--------------
1 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/src/app/models/instance_task.rb b/src/app/models/instance_task.rb
index 9da110b..6c78c0f 100644
--- a/src/app/models/instance_task.rb
+++ b/src/app/models/instance_task.rb
@@ -46,22 +46,21 @@ class InstanceTask < Task
actions = []
# FIXME: cloud_account won't always be set here, but we're requiring
# front end realm for now.
- cloud_account = instance.cloud_account
- c_state = cloud_account.connect.instance_state(state) unless cloud_account.nil?
- if !cloud_account.nil? and c_state
- transitions = c_state.transitions
- transitions.each do |transition|
- # FIXME if we allow actions based on the expected state after
- # automatic transitions, we need to call this method again with
- # the state from transition.to passed in.
- unless transition.action.nil?
- add_action = true
- if (instance and user)
- # FIXME: check permissions here if we filter actions by permission
+ if cloud_account = instance.cloud_account and
+ conn = cloud_account.connect and c_state = conn.instance_state(state)
+ transitions = c_state.transitions
+ transitions.each do |transition|
+ # FIXME if we allow actions based on the expected state after
+ # automatic transitions, we need to call this method again with
+ # the state from transition.to passed in.
+ unless transition.action.nil?
+ add_action = true
+ if (instance and user)
+ # FIXME: check permissions here if we filter actions by permission
+ end
+ actions << transition.action if add_action
end
- actions << transition.action if add_action
end
- end
end
actions
end
--
1.7.0.1
_______________________________________________
deltacloud-devel mailing list
deltacloud-devel(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/deltacloud-devel