4 from sfa.client.sfi_commands import Commands
5 from sfa.rspecs.rspec_parser import parse_rspec
7 command = Commands(usage="%prog [options] [node1 node2...]",
8 description="Delete sliver attributes from the RSpec. " +
9 "This command reads in an RSpec and outputs a modified " +
10 "RSpec. Use this to remove attributes from nodes " +
11 "in your slice. If no nodes are specified, the " +
12 "attributes will be removed from ALL nodes.",
13 epilog="NOTE: Only admins can actually set these " +
14 "attributes, with the exception of --delegations")
15 command.add_nodefile_option()
16 command.add_attribute_options()
19 if command.opts.infile:
20 attrs = command.get_attribute_dict()
21 rspec = parse_rspec(command.opts.infile)
23 if command.opts.nodefile:
24 f = open(command.opts.nodefile, "r")
25 nodes = f.read().split()
30 print >> sys.stderr, name, attrs[name]
31 for value in attrs[name]:
34 rspec.remove_default_sliver_attribute(name, value)
36 print >> sys.stderr, "FAILED: on all nodes: %s=%s" % (name, value)
40 rspec.remove_sliver_attribute(node, name, value)
42 print >> sys.stderr, "FAILED: on node %s: %s=%s" % (node, name, value)