@ -116,8 +116,6 @@ func runDaemonPmuxOnce(
) ,
}
doneCh := ctx . Done ( )
var wg sync . WaitGroup
defer wg . Wait ( )
@ -130,18 +128,28 @@ func runDaemonPmuxOnce(
pmuxlib . Run ( ctx , os . Stdout , os . Stderr , pmuxConfig )
} ( )
wg . Add ( 1 )
go func ( ) {
defer wg . Done ( )
if err := waitForGarageAndNebula ( ctx , hostBootstrap , daemonConfig ) ; err != nil {
return bootstrap . Bootstrap { } , fmt . Errorf ( "waiting for nebula/garage to start up: %w" , err )
}
if err := waitForGarageAndNebula ( ctx , hostBootstrap , daemonConfig ) ; err != nil {
fmt . Fprintf ( os . Stderr , "aborted waiting for garage instances to be accessible: %v\n" , err )
return
err = doOnce ( ctx , func ( ctx context . Context ) error {
if err := hostBootstrap . PutGarageBoostrapHost ( ctx ) ; err != nil {
fmt . Fprintf ( os . Stderr , "updating host info in garage: %v\n" , err )
return err
}
return nil
} )
if err != nil {
return bootstrap . Bootstrap { } , fmt . Errorf ( "updating host info in garage: %w" , err )
}
if len ( daemonConfig . Storage . Allocations ) > 0 {
err := doOnce ( ctx , func ( ctx context . Context ) error {
if err := hostBootstrap . PutGarageBoostrapHost ( ctx ) ; err != nil {
fmt . Fprintf ( os . Stderr , "updating host info in garage: %v\n" , err )
if err := garageApplyLayout ( ctx , hostBootstrap , daemonConfig ) ; err != nil {
fmt . Fprintf ( os . Stderr , "applying garage layout : %v\n" , err )
return err
}
@ -149,33 +157,8 @@ func runDaemonPmuxOnce(
} )
if err != nil {
fmt . Fprintf ( os . Stderr , "aborted updating host info in garage: %v\n ", err )
return bootstrap . Bootstrap { } , fmt . Errorf ( "applying garage layout: %w ", err )
}
} ( )
if len ( daemonConfig . Storage . Allocations ) > 0 {
wg . Add ( 1 )
go func ( ) {
defer wg . Done ( )
if err := waitForGarageAndNebula ( ctx , hostBootstrap , daemonConfig ) ; err != nil {
fmt . Fprintf ( os . Stderr , "aborted waiting for garage instances to be accessible: %v\n" , err )
return
}
err := doOnce ( ctx , func ( ctx context . Context ) error {
if err := garageApplyLayout ( ctx , hostBootstrap , daemonConfig ) ; err != nil {
fmt . Fprintf ( os . Stderr , "applying garage layout: %v\n" , err )
return err
}
return nil
} )
if err != nil {
fmt . Fprintf ( os . Stderr , "aborted applying garage layout: %v\n" , err )
}
} ( )
}
ticker := time . NewTicker ( 3 * time . Minute )
@ -184,7 +167,7 @@ func runDaemonPmuxOnce(
for {
select {
case <- doneCh :
case <- ctx . Done ( ) :
return bootstrap . Bootstrap { } , ctx . Err ( )
case <- ticker . C :