From: Tony Mack Date: Thu, 28 Apr 2011 19:36:02 +0000 (-0400) Subject: now uses new RSpec libraries X-Git-Tag: sfa-1.0-21-ckp1~49 X-Git-Url: http://git.onelab.eu/?p=sfa.git;a=commitdiff_plain;h=2df9eb8c832e420efbfa3a7689c0c1e685cb76d5 now uses new RSpec libraries --- diff --git a/sfa/client/sfiDeleteAttribute.py b/sfa/client/sfiDeleteAttribute.py index f248e495..f3724887 100755 --- a/sfa/client/sfiDeleteAttribute.py +++ b/sfa/client/sfiDeleteAttribute.py @@ -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="Delete sliver attributes from the RSpec. " + @@ -15,20 +16,29 @@ command.add_nodefile_option() command.add_attribute_options() command.prep() -attrs = command.get_attribute_dict() -for name in attrs: - print >> sys.stderr, name, attrs[name] - for value in attrs[name]: - if not command.nodes: - try: - command.rspec.remove_default_sliver_attribute(name, value) - except: - print >> sys.stderr, "FAILED: on all nodes: %s=%s" % (name, value) +if command.opts.infile: + attrs = command.get_attribute_dict() + rspec = parse_rspec(command.opts.infile) + nodes = [] + if command.opts.nodefile: + f = open(command.opts.nodefile, "r") + nodes = f.read().split() + f.close() + + + for name in attrs: + print >> sys.stderr, name, attrs[name] + for value in attrs[name]: + if not nodes: + try: + rspec.remove_default_sliver_attribute(name, value) + except: + print >> sys.stderr, "FAILED: on all nodes: %s=%s" % (name, value) else: - for node in command.nodes: + for node in nodes: try: - command.rspec.remove_sliver_attribute(node, name, value) + rspec.remove_sliver_attribute(node, name, value) except: print >> sys.stderr, "FAILED: on node %s: %s=%s" % (node, name, value) -print command.rspec + print rspec.toxml()