lib, gapi, cli: Add a wait flag to empty and a new default

Change the default "wait" state for if you run the empty frontend when
there's already an available deploy waiting. You almost certainly want
to start running it right away.

Example:

mgmt etcd

mgmt run --hostname h1 --no-server --tmp-prefix --seeds=http://127.0.0.1:2379 empty
mgmt run --hostname h2 --no-server --tmp-prefix --seeds=http://127.0.0.1:2379 empty

mgmt deploy --no-git --seeds=http://127.0.0.1:2379 lang examples/lang/hello0.mcl

mgmt run --hostname h3 --no-server --tmp-prefix --seeds=http://127.0.0.1:2379 empty

In fact, you don't even need to start up etcd first for this to all
work.
This commit is contained in:
James Shubin
2025-03-10 14:56:42 -04:00
parent 37e5a37045
commit 50bd6f5811
3 changed files with 31 additions and 3 deletions

View File

@@ -1024,6 +1024,12 @@ func (obj *Main) Run() error {
defer wg.Done()
defer close(deployChan) // no more are coming ever!
// if "empty" and we don't want to wait for a fresh deploy...
if obj.Deploy != nil && max != 0 {
if emptyGAPI, ok := obj.Deploy.GAPI.(*empty.GAPI); ok && !emptyGAPI.Wait {
obj.Deploy = nil // erase the empty deploy
}
}
// we've been asked to deploy, so do that first...
if obj.Deploy != nil {
deploy := obj.Deploy