Changeset 023e79b for fedd


Ignore:
Timestamp:
May 17, 2010 1:23:22 PM (15 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
Children:
139e2e2
Parents:
4b6909e
Message:

Add testbed attributes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/compose.py

    r4b6909e r023e79b  
    4949        self.add_option('--format', dest='format', default="xml",
    5050                help='Output file format')
     51        self.add_option('--add_testbeds', dest='add_testbeds', default=False,
     52                action='store_true',
     53                help='add testbed attributes to each component')
    5154        self.add_option('--lax', dest='lax', default=False,
    5255                action='store_true',
     
    567570            provides, accepts)
    568571
     572    # Add testbed attributes if requested
     573    if opts.add_testbeds:
     574        for i, t in enumerate(topos):
     575            for e in [ e for e in t.elements if isinstance(e, topdl.Computer)]:
     576                e.set_attribute('testbed', 'testbed%03d' % i)
     577
    569578    # Make a topology containing all elements and substrates from components
    570579    # that had matches.
     
    582591elif topos == 1:
    583592    comp = topos[0]
     593    if opts.add_testbeds:
     594        for e in [ e for e in comp.elements if isinstance(e, topdl.Computer)]:
     595            e.set_attribute('testbed', 'testbed001')
     596
    584597else:
    585598    sys.exit("Did not read any components.")
Note: See TracChangeset for help on using the changeset viewer.