def main(): shortnames = [get_shortname(machine_type, i) for i in range(3, 123)] fqdns = ['.'.join((name, lab_domain)) for name in shortnames] for fqdn in fqdns: log.info("Creating %s", fqdn) try: info = get_info(user, fqdn) except Exception: info = dict( name=fqdn, up=False, ) info.update(dict( locked=True, locked_by='initial@setup', machine_type=machine_type, description="Initial node creation", )) update_inventory(info)
def main(): shortnames = [get_shortname(machine_type, i) for i in machine_index_range] fqdns = ['.'.join((name, lab_domain)) for name in shortnames] for fqdn in fqdns: log.info("Creating %s", fqdn) base_info = dict( name=fqdn, locked=True, locked_by='initial@setup', machine_type=machine_type, description="Initial node creation", ) try: info = get_info(user, fqdn) base_info.update(info) base_info['up'] = True except Exception as exc: log.error("{fqdn} is down".format(fqdn=fqdn)) base_info['up'] = False base_info['description'] = repr(exc) update_inventory(base_info)
def push(): for rem in ctx.cluster.remotes.keys(): info = rem.inventory_info lock.update_inventory(info)