print " %s" % r["name"] # Handle opt.setattr if opt.setattr != None: attr = opt.setattr.split() attrdict = {} for a in attr: try: key, val = a.split(":") except ValueError: print >> sys.stderr, "Attributes not formatted correctly" sys.exit(1) attrdict[key] = val specs = [{"name":name} for name in args] newattrs = {"attributes":attrdict} changed = system.set_attributes(specs, newattrs) changed.sort(key=namesort) print "Resources with set attributes:" for r in changed: print " %s" % r["name"] # Handle opt.remattr if opt.remattr != None: attrs = opt.remattr.split() specs = [{"name":name} for name in args] changed = system.remove_attributes(specs, attrs) changed.sort(key=namesort) print "Resources with removed attributes:" for r in changed: print " %s" % r["name"]
print " %s" % r["name"] # Handle opt.setattr if opt.setattr != None: attr = opt.setattr.split() attrdict = {} for a in attr: try: key, val = a.split(":") except ValueError: print >> sys.stderr, "Attributes not formatted correctly" sys.exit(1) attrdict[key] = val specs = [{"name": name} for name in args] newattrs = {"attributes": attrdict} changed = system.set_attributes(specs, newattrs) changed.sort(key=namesort) print "Resources with set attributes:" for r in changed: print " %s" % r["name"] # Handle opt.remattr if opt.remattr != None: attrs = opt.remattr.split() specs = [{"name": name} for name in args] changed = system.remove_attributes(specs, attrs) changed.sort(key=namesort) print "Resources with removed attributes:" for r in changed: print " %s" % r["name"]