|
|
|
@ -134,6 +134,11 @@ func runCreate(dockerCli command.Cli, in createOptions, args []string) error {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ngOriginal := ng
|
|
|
|
|
if ngOriginal != nil {
|
|
|
|
|
ngOriginal = ngOriginal.Copy()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ng == nil {
|
|
|
|
|
ng = &store.NodeGroup{
|
|
|
|
|
Name: name,
|
|
|
|
@ -224,6 +229,30 @@ func runCreate(dockerCli command.Cli, in createOptions, args []string) error {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ngi := &nginfo{ng: ng}
|
|
|
|
|
|
|
|
|
|
timeoutCtx, cancel := context.WithTimeout(ctx, 20*time.Second)
|
|
|
|
|
defer cancel()
|
|
|
|
|
|
|
|
|
|
if err = loadNodeGroupData(timeoutCtx, dockerCli, ngi); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
for _, info := range ngi.drivers {
|
|
|
|
|
if err := info.di.Err; err != nil {
|
|
|
|
|
err := errors.Errorf("failed to initialize builder %s (%s): %s", ng.Name, info.di.Name, err)
|
|
|
|
|
var err2 error
|
|
|
|
|
if ngOriginal == nil {
|
|
|
|
|
err2 = txn.Remove(ng.Name)
|
|
|
|
|
} else {
|
|
|
|
|
err2 = txn.Save(ngOriginal)
|
|
|
|
|
}
|
|
|
|
|
if err2 != nil {
|
|
|
|
|
logrus.Warnf("Could not rollback to previous state: %s", err2)
|
|
|
|
|
}
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if in.use && ep != "" {
|
|
|
|
|
current, err := storeutil.GetCurrentEndpoint(dockerCli)
|
|
|
|
|
if err != nil {
|
|
|
|
@ -234,15 +263,6 @@ func runCreate(dockerCli command.Cli, in createOptions, args []string) error {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ngi := &nginfo{ng: ng}
|
|
|
|
|
|
|
|
|
|
timeoutCtx, cancel := context.WithTimeout(ctx, 20*time.Second)
|
|
|
|
|
defer cancel()
|
|
|
|
|
|
|
|
|
|
if err = loadNodeGroupData(timeoutCtx, dockerCli, ngi); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if in.bootstrap {
|
|
|
|
|
if _, err = boot(ctx, ngi); err != nil {
|
|
|
|
|
return err
|
|
|
|
|