fix wrong slice renewed when doing batch renew
[sface.git] / sface / sfiprocess.py
index 6950554..cfa1109 100644 (file)
@@ -119,20 +119,38 @@ class SfiProcess(QObject):
         self.start()
         return filename
 
+    def retrieveResources(self):
+        mgr = config.getSlicemgr()
+        # Write RSpec to file
+        filename = config.getResourcesRSpecFile()
+        try:
+            os.remove(filename)
+        except:
+            pass
+        args = ["-u", config.getUser(), "-a", config.getAuthority(),
+                "-r", config.getRegistry(), "-s", mgr, "resources",
+                "-o", filename]
+
+        self.__init_command(args)
+        self.start()
+        return filename
+
 
     def listRecords(self, hrn, rectype=None, filename=None):
         args = ["-u", config.getUser(), "-a", config.getAuthority(),
-                "-r", config.getRegistry(), "-s", config.getSlicemgr(), "list", hrn]
+                "-r", config.getRegistry(), "-s", config.getSlicemgr(), "list", "-F", "xmllist", hrn]
 
-        if filename:
-            # we can't tell whether SFI will create one file or many, so delete
-            # leftovers from last time, then we'll know what we got, after we get it.
-            if os.path.exists(filename):
-                os.remove(filename)
-            if os.path.exists(filename + ".1"):
-                os.remove(filename + ".1")
-            args.append("-o")
-            args.append(filename)
+        if not filename:
+            filename = config.getAuthorityListFile()
+
+        # we can't tell whether SFI will create one file or many, so delete
+        # leftovers from last time, then we'll know what we got, after we get it.
+        if os.path.exists(filename):
+            os.remove(filename)
+        if os.path.exists(filename + ".1"):
+            os.remove(filename + ".1")
+        args.append("-o")
+        args.append(filename)
 
         if rectype:
             args.append("-t")
@@ -182,10 +200,13 @@ class SfiProcess(QObject):
         self.__init_command(args)
         self.start()
 
-    def renewSlivers(self, expiration):
+    def renewSlivers(self, expiration, slice=None):
+        if not slice:
+            slice = config.getSlice()
+
         args = ["-u", config.getUser(), "-a", config.getAuthority(),
                 "-r", config.getRegistry(), "-s", config.getSlicemgr(), "renew",
-                config.getSlice(), expiration]
+                slice, expiration]
         self.__init_command(args)
         self.start()