[Swift-commit] r3324 - in SwiftApps/adem-osg: lib/adem test

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Mon May 3 14:57:13 CDT 2010


Author: aespinosa
Date: 2010-05-03 14:57:13 -0500 (Mon, 03 May 2010)
New Revision: 3324

Modified:
   SwiftApps/adem-osg/lib/adem/app.rb
   SwiftApps/adem-osg/test/test_online.rb
Log:
Package remove functionality and tests

Modified: SwiftApps/adem-osg/lib/adem/app.rb
===================================================================
--- SwiftApps/adem-osg/lib/adem/app.rb	2010-05-03 19:57:10 UTC (rev 3323)
+++ SwiftApps/adem-osg/lib/adem/app.rb	2010-05-03 19:57:13 UTC (rev 3324)
@@ -50,6 +50,24 @@
   conf[:sites]
 end
 
+def app_remove(app, conf)
+  conf[:sites].each do |site|
+    puts "Site #{site.key}"
+    path = "#{site[:app_directory]}/#{conf[:virtual_organization]}"
+    contact = site_fork site[:compute_element]
+    site[:pacman] = pacman_find(contact, path) if not site[:pacman] 
+    target = {
+      :contact => contact,
+      :pacman => site[:pacman],
+      :path => path
+    }
+    package = "#{conf[:pacman_cache]}:#{app}"
+    pacman_remove package, target 
+  end
+  conf[:sites]
+end
+
+
 def site_fork(compute_element)
   compute_element.gsub /jobmanager-.*$/, "jobmanager-fork"
 end
@@ -77,3 +95,16 @@
   File.delete "pacman_install.sh"
   resp
 end
+
+def pacman_remove(package, target)
+  File.open("pacman_install.sh", "w") do |dump|
+    dump.puts "#!/bin/bash"
+    dump.puts "source #{target[:pacman]}/setup.sh"
+    dump.puts "pacman -trust-all-caches -remove #{package}"
+  end
+  File.chmod 0755, "pacman_remove.sh"
+  `globus-job-run #{target[:contact]} /bin/mkdir -p #{target[:path]}`
+  resp = `globus-job-run #{target[:contact]} -d #{target[:path]} -stage pacman_remove.sh`
+  File.delete "pacman_remove.sh"
+  resp
+end

Modified: SwiftApps/adem-osg/test/test_online.rb
===================================================================
--- SwiftApps/adem-osg/test/test_online.rb	2010-05-03 19:57:10 UTC (rev 3323)
+++ SwiftApps/adem-osg/test/test_online.rb	2010-05-03 19:57:13 UTC (rev 3324)
@@ -33,15 +33,6 @@
     assert assumption, "Missing attributes: \n\t#{missing.uniq.join(", ")}"
   end
 
-  def test_app_avail
-    pacman_cache = "test/dummy_cache"
-    response = <<-eos
-test/dummy_cache
-    [ ] jbsim3d
-    eos
-    assert_equal(response, app_avail(pacman_cache))
-  end
-
   def test_pacman_find_firefly
     # Firefly
     site = {




More information about the Swift-commit mailing list