Merge branch 'master' of ssh://bakers@git.planet-lab.org/git/sfa
[sfa.git] / sfa / client / sfiListNodes.py
index df14fe3..f9e794b 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 import RSpec 
 
 command = Commands(usage="%prog [options]",
                    description="List all nodes in the RSpec. " + 
@@ -9,9 +10,15 @@ command = Commands(usage="%prog [options]",
                    "possible to create a slice.")
 command.prep()
 
-nodes = command.rspec.get_node_list()
-for node in nodes:
-    print node
+if command.opts.infile:
+    rspec = RSpec(command.opts.infile)
+    nodes = rspec.version.get_nodes()
+    if command.opts.outfile:
+        sys.stdout = open(command.opts.outfile, 'w')
+    
+    for node in nodes:
+        print node
+