This patch fixes an issue discovered by blomquisg; the delayed_job instance launch would fail when using a config server. The solution is to pass ids to the delayed job instead of objects.
Mainn
--- src/app/models/deployment.rb | 33 +++++++++++++++++++++------------ 1 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/src/app/models/deployment.rb b/src/app/models/deployment.rb index be60802..277f9b3 100644 --- a/src/app/models/deployment.rb +++ b/src/app/models/deployment.rb @@ -254,23 +254,32 @@ class Deployment < ActiveRecord::Base all_inst_match.map!{|m| m.attributes}
if deployable_xml.requires_config_server? - # the instance configurations need to be generated from the entire set of - # instances (and not each individual instance) in order to do parameter - # dependency resolution across the set - config_server = account.config_server - instance_configs = ConfigServerUtil.instance_configs(self, - instances, - config_server) + config_server_id = account.config_server.id else - config_server = nil - instance_configs = {} + config_server_id = nil end
- delay.send_launch_requests(all_inst_match, config_server, - instance_configs, user) + delay.send_launch_requests(all_inst_match, + instances.map{|i| i.id}, + config_server_id, user.id) end
- def send_launch_requests(all_inst_match, config_server, instance_configs, user) + def send_launch_requests(all_inst_match, instance_ids, config_server_id, user_id) + user = User.find(user_id) + instances = instance_ids.map{|instance_id| Instance.find(instance_id)} + + if config_server_id.nil? + config_server = nil + instance_configs = {} + else + config_server = ConfigServer.find(config_server_id) + + # the instance configurations need to be generated from the entire set of + # instances (and not each individual instance) in order to do parameter + # dependency resolution across the set + instance_configs = ConfigServerUtil.instance_configs(self,instances,config_server) + end + instances.each do |instance| instance.reset_attrs unless instance.state == Instance::STATE_NEW instance.instance_matches << InstanceMatch.new(
On 18/07/2012, at 11:13 PM, Tzu-Mainn Chen wrote:
src/app/models/deployment.rb | 33 +++++++++++++++++++++------------ 1 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/src/app/models/deployment.rb b/src/app/models/deployment.rb index be60802..277f9b3 100644 --- a/src/app/models/deployment.rb +++ b/src/app/models/deployment.rb @@ -254,23 +254,32 @@ class Deployment < ActiveRecord::Base all_inst_match.map!{|m| m.attributes}
From a functional perspective, this works. (whoo hooo!) :)
However, something with Ruby skills should probably code review this just to be sure. :>
Regards and best wishes,
Justin Clift
-- Aeolus Community Manager http://www.aeolusproject.org
On 07/19/2012 07:39 AM, Justin Clift wrote:
On 18/07/2012, at 11:13 PM, Tzu-Mainn Chen wrote:
src/app/models/deployment.rb | 33 +++++++++++++++++++++------------ 1 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/src/app/models/deployment.rb b/src/app/models/deployment.rb index be60802..277f9b3 100644 --- a/src/app/models/deployment.rb +++ b/src/app/models/deployment.rb @@ -254,23 +254,32 @@ class Deployment < ActiveRecord::Base all_inst_match.map!{|m| m.attributes}
From a functional perspective, this works. (whoo hooo!) :)
However, something with Ruby skills should probably code review this just to be sure. :>
Regards and best wishes,
Justin Clift
-- Aeolus Community Manager http://www.aeolusproject.org
Code review done, ACK! :-)
aeolus-devel@lists.fedorahosted.org