示例#1
0
def list_vnets(db: ResourceDB):
    log.info('Fetching available vnets')
    for vnet in db.get_vnets(list(db._by_id.values())):
        group = vnet['id'].split('/')[4]
        print('Group:', group)
        print('VNet:', vnet['name'])
        print()
示例#2
0
def validate_vnet(db: ResourceDB, name: str, summary_only=False):
    matched = False
    for cfg in db.get_vnets(list(db._by_id.values())):
        vnet = VNet(db, cfg)
        if vnet.name == name:
            matched = True
            if summary_only:
                # Temporarily disable console logging for summary only
                log.enabled = False
                res = vnet.validate()
                log.enabled = True
            else:
                res = vnet.validate()
            # Disable noise
            if res.valid:
                log.info(f'VNet {name} is ready for migration.')
            else:
                log.warning(f'VNet {name} failed validation.')
    if not matched:
        log.warning(f'VNet {name} not found.')
示例#3
0
 def __init__(self, db: ResourceDB, resources: list[dict], group: str):
     self.db = db
     self.vnets = [VNet(db, c) for c in db.get_vnets(resources)]
     self.name = group