now uses new RSpec libraries
[sfa.git] / sfa / client / sfiDeleteSliver.py
1 #! /usr/bin/env python
2
3 import sys
4 from sfa.client.sfi_commands import Commands
5 from sfa.rspecs.rspec_parser import parse_rspec
6
7 command = Commands(usage="%prog [options] node1 node2...",
8                    description="Delete slivers from the RSpec. " +
9                    "This command reads in an RSpec and outputs a modified " +
10                    "RSpec. Use this to remove nodes from your slice.")
11 command.add_nodefile_option()
12 command.prep()
13
14 if command.opts.infile:
15     rspec = parse_rspec(command.opts.infile)
16     nodes = []
17     if command.opts.nodefile:
18         f = open(command.opts.nodefile, "r")
19         nodes = f.read().split()
20         f.close()
21        
22         try:
23             rspec.remove_slivers(nodes)
24         except:
25             print >> sys.stderr, "FAILED: %s"  
26
27     print rspec.toxml()
28     
29
30