From: Jan Provaznik <[email protected]>

this patch is not correct, but makes conromatic not to throw exceptions :).
a condor expert should look at condormatic and fix it correctly
---
 src/app/util/condormatic.rb |   56 ++++++++++++++++++++-----------------------
 1 files changed, 26 insertions(+), 30 deletions(-)

diff --git a/src/app/util/condormatic.rb b/src/app/util/condormatic.rb
index d93a4b1..052b03a 100644
--- a/src/app/util/condormatic.rb
+++ b/src/app/util/condormatic.rb
@@ -38,7 +38,7 @@ def condormatic_instance_create(task)
     pipe.puts "executable = #{job_name}\n"
     Rails.logger.info "executable = #{job_name}\n"
 
-    resource = "grid_resource = dcloud $$(provider_url) $$(username) 
$$(password) $$(image_key) #{instance.name}"
+    resource = "grid_resource = dcloud $$(provider_url) $$(username) 
$$(password) $$(template_key) #{instance.name}"
     if realm != nil
       resource += " $$(realm_key)"
     else
@@ -49,7 +49,7 @@ def condormatic_instance_create(task)
     pipe.puts resource
     Rails.logger.info resource
 
-    requirements = "requirements = hardwareprofile == 
\"#{instance.hardware_profile.id}\" && image == \"#{instance.image.id}\""
+    requirements = "requirements = hardwareprofile == 
\"#{instance.hardware_profile.id}\" && template == \"#{instance.template.id}\""
     requirements += " && realm == \"#{realm.name}\"" if realm != nil
     requirements += "\n"
 
@@ -179,34 +179,30 @@ def condormatic_classads_sync
 
   providers.each do |provider|
     provider.cloud_accounts.each do |account|
-      provider.images.each do |image|
-        provider.hardware_profiles.each do |hwp|
-          provider.realms.each do |realm|
-            pipe = IO.popen("condor_advertise UPDATE_STARTD_AD 2>&1", "w+")
-
-            pipe.puts "Name=\"provider_combination_#{index}\""
-            pipe.puts 'MyType="Machine"'
-            pipe.puts 'Requirements=true'
-            pipe.puts "\n# Stuff needed to match:"
-            pipe.puts 
"hardwareprofile=\"#{hwp.aggregator_hardware_profiles[0].id}\""
-            pipe.puts "image=\"#{image.aggregator_images[0].id}\""
-            pipe.puts "realm=\"#{realm.name}\""
-            pipe.puts "\n# Backend info to complete this job:"
-            pipe.puts "image_key=\"#{image.external_key}\""
-            pipe.puts "hardwareprofile_key=\"#{hwp.external_key}\""
-            pipe.puts "realm_key=\"#{realm.external_key}\""
-            pipe.puts "provider_url=\"#{account.provider.url}\""
-            pipe.puts "username=\"#{account.username}\""
-            pipe.puts "password=\"#{account.password}\""
-            pipe.close_write
-
-            out = pipe.read
-            pipe.close
-
-            Rails.logger.error "Unable to submit condor classad: #{out}" if $? 
!= 0
-
-            index += 1
-          end
+      provider.hardware_profiles.each do |hwp|
+        provider.realms.each do |realm|
+          pipe = IO.popen("condor_advertise UPDATE_STARTD_AD 2>&1", "w+")
+
+          pipe.puts "Name=\"provider_combination_#{index}\""
+          pipe.puts 'MyType="Machine"'
+          pipe.puts 'Requirements=true'
+          pipe.puts "\n# Stuff needed to match:"
+          pipe.puts 
"hardwareprofile=\"#{hwp.aggregator_hardware_profiles[0].id}\""
+          pipe.puts "realm=\"#{realm.name}\""
+          pipe.puts "\n# Backend info to complete this job:"
+          pipe.puts "hardwareprofile_key=\"#{hwp.external_key}\""
+          pipe.puts "realm_key=\"#{realm.external_key}\""
+          pipe.puts "provider_url=\"#{account.provider.url}\""
+          pipe.puts "username=\"#{account.username}\""
+          pipe.puts "password=\"#{account.password}\""
+          pipe.close_write
+
+          out = pipe.read
+          pipe.close
+
+          Rails.logger.error "Unable to submit condor classad: #{out}" if $? 
!= 0
+
+          index += 1
         end
       end
     end
-- 
1.7.2.2

_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel

Reply via email to