now uses new RSpec libraries
[sfa.git] / sfa / client / sfiAddSliver.py
index be1c51c..387f9df 100755 (executable)
@@ -1,7 +1,8 @@
 #! /usr/bin/env python
 
 import sys
-from sfa.util.rspecHelper import RSpec, Commands
+from sfa.client.sfi_commands import Commands
+from sfa.rspecs.rspec_parser import parse_rspec
 
 command = Commands(usage="%prog [options] node1 node2...",
                    description="Add slivers to the RSpec. " +
@@ -10,13 +11,20 @@ command = Commands(usage="%prog [options] node1 node2...",
 command.add_nodefile_option()
 command.prep()
 
-for node in command.nodes:
+if command.opts.infile:
+    rspec = parse_rspec(command.opts.infile)
+    nodes = []
+    if command.opts.nodefile:
+        f = open(command.opts.nodefile, "r")
+        nodes = f.read().split()
+        f.close()
+
     try:
-        command.rspec.add_sliver(node)
+        rspec.add_slivers(nodes)
     except:
         print >> sys.stderr, "FAILED: %s" % node
 
-print command.rspec
+    print rspec.toxml()