def execute(self, cmd, args): yield BaseHostRequestAction.execute(self, cmd, args) hostname = yield db.get(self.context, 'hostname') # Acceptance of a new HN should trigger its syncing uuid = yield register_machine(hostname, mgt_stack=ISaltInstalled) cmd.write('Host %s accepted. Syncing shortly...\n' % hostname) log.msg('Host %s accepted. Syncing in 5 seconds...' % hostname, system='action-accept') yield async_sleep(5) compute = yield get_machine_by_uuid(uuid) assert compute is not None, 'Machine not found after accept: %s' % uuid log.msg('Syncing NOW...', system='action-accept') syncaction = SyncAction(compute) syncaction._do_not_enqueue = False args = argparse.Namespace() args.full = True yield syncaction.execute(DetachedProtocol(), args)
def import_machines(self, accepted): for host in accepted: yield register_machine(host, mgt_stack=ISaltInstalled)