Пример #1
0
        for r in added:
            print "Added resource with name '%s'" % r["name"]
        sys.exit(0)
    elif opt.remove:
        specs = [{"name":name} for name in args]
        removed = system.remove_resources(specs)
        removed.sort(key=namesort)
        for r in removed:
            print "Removed resource with name '%s'" % r["name"]
        sys.exit(0)

    # May change multiple attributes at a time
    if opt.func:
        specs = [{"name":name, "functional":False} for name in args]
        newattrs = {"functional":True}
        changed = system.set_attributes(specs, newattrs)
        changed.sort(key=namesort)
        print "Resources marked functional:"
        for r in changed:
            print "    %s" % r["name"]
    elif opt.nonfunc:
        specs = [{"name":name, "functional":True} for name in args]
        newattrs = {"functional":False}
        changed = system.set_attributes(specs, newattrs)
        changed.sort(key=namesort)
        print "Resources marked non-functional:"
        for r in changed:
            print "    %s" % r["name"]

    if opt.sched:
        specs = [{"name":name, "scheduled":False} for name in args]
Пример #2
0
        for r in added:
            print "Added resource with name '%s'" % r["name"]
        sys.exit(0)
    elif opt.remove:
        specs = [{"name": name} for name in args]
        removed = system.remove_resources(specs)
        removed.sort(key=namesort)
        for r in removed:
            print "Removed resource with name '%s'" % r["name"]
        sys.exit(0)

    # May change multiple attributes at a time
    if opt.func:
        specs = [{"name": name, "functional": False} for name in args]
        newattrs = {"functional": True}
        changed = system.set_attributes(specs, newattrs)
        changed.sort(key=namesort)
        print "Resources marked functional:"
        for r in changed:
            print "    %s" % r["name"]
    elif opt.nonfunc:
        specs = [{"name": name, "functional": True} for name in args]
        newattrs = {"functional": False}
        changed = system.set_attributes(specs, newattrs)
        changed.sort(key=namesort)
        print "Resources marked non-functional:"
        for r in changed:
            print "    %s" % r["name"]

    if opt.sched:
        specs = [{"name": name, "scheduled": False} for name in args]