Move WissKI Parts to new ingredients system
This commit is contained in:
parent
b5b1ce2340
commit
42b8cbd865
83 changed files with 1016 additions and 646 deletions
|
|
@ -52,7 +52,7 @@ func (bu blindUpdate) Run(context wisski_distillery.Context) error {
|
|||
|
||||
// and do the actual blind_update!
|
||||
return status.StreamGroup(context.IOStream, bu.Parallel, func(instance *wisski.WissKI, str stream.IOStream) error {
|
||||
return instance.BlindUpdate(str)
|
||||
return instance.Drush().Update(str)
|
||||
}, wissKIs, status.SmartMessage(func(item *wisski.WissKI) string {
|
||||
return fmt.Sprintf("blind_update %q", item.Slug)
|
||||
}))
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ func (cr cron) Run(context wisski_distillery.Context) error {
|
|||
|
||||
// and do the actual blind_update!
|
||||
return status.StreamGroup(context.IOStream, cr.Parallel, func(instance *wisski.WissKI, io stream.IOStream) error {
|
||||
return instance.Cron(io)
|
||||
return instance.Drush().Cron(io)
|
||||
}, wissKIs, status.SmartMessage(func(item *wisski.WissKI) string {
|
||||
return fmt.Sprintf("cron %q", item.Slug)
|
||||
}))
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ func (ds setting) Run(context wisski_distillery.Context) error {
|
|||
|
||||
if ds.Positionals.Value == "" {
|
||||
// get the setting
|
||||
value, err := instance.GetSettingsPHP(nil, ds.Positionals.Setting)
|
||||
value, err := instance.Settings().Get(nil, ds.Positionals.Setting)
|
||||
if err != nil {
|
||||
return errSettingGet.Wrap(err)
|
||||
}
|
||||
|
|
@ -69,7 +69,7 @@ func (ds setting) Run(context wisski_distillery.Context) error {
|
|||
}
|
||||
|
||||
// set the serialized value!
|
||||
if err := instance.SetSettingsPHP(nil, ds.Positionals.Setting, data); err != nil {
|
||||
if err := instance.Settings().Set(nil, ds.Positionals.Setting, data); err != nil {
|
||||
return errSettingSet.Wrap(err)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ func (i info) Run(context wisski_distillery.Context) error {
|
|||
return err
|
||||
}
|
||||
|
||||
info, err := instance.Info(false)
|
||||
info, err := instance.Info().Fetch(false)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package cmd
|
|||
import (
|
||||
wisski_distillery "github.com/FAU-CDI/wisski-distillery"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/cli"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/wisski/ingredient/locker"
|
||||
"github.com/tkw1536/goprogram/exit"
|
||||
)
|
||||
|
||||
|
|
@ -51,15 +52,15 @@ func (l instanceLock) Run(context wisski_distillery.Context) error {
|
|||
}
|
||||
|
||||
if l.Unlock {
|
||||
if !instance.Unlock() {
|
||||
if !instance.Locker().TryUnlock() {
|
||||
return errNotUnlock
|
||||
}
|
||||
context.Println("unlocked")
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := instance.TryLock(); err != nil {
|
||||
return err
|
||||
if !instance.Locker().TryLock() {
|
||||
return locker.Locked
|
||||
}
|
||||
|
||||
context.Println("locked")
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ func (pb pathbuilders) Run(context wisski_distillery.Context) error {
|
|||
|
||||
// get all of the pathbuilders
|
||||
if pb.Positionals.Name == "" {
|
||||
names, err := instance.Pathbuilders(nil)
|
||||
names, err := instance.Pathbuilder().All(nil)
|
||||
if err != nil {
|
||||
return errPathbuilders.WithMessageF(err)
|
||||
}
|
||||
|
|
@ -57,7 +57,7 @@ func (pb pathbuilders) Run(context wisski_distillery.Context) error {
|
|||
}
|
||||
|
||||
// get all the pathbuilders
|
||||
xml, err := instance.Pathbuilder(nil, pb.Positionals.Name)
|
||||
xml, err := instance.Pathbuilder().Get(nil, pb.Positionals.Name)
|
||||
if xml == "" {
|
||||
return errNoPathbuilder.WithMessageF(pb.Positionals.Name)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ func (p prefixes) Run(context wisski_distillery.Context) error {
|
|||
return err
|
||||
}
|
||||
|
||||
prefixes, err := instance.Prefixes(nil)
|
||||
prefixes, err := instance.Prefixes().All(nil)
|
||||
if err != nil {
|
||||
return errPrefixesGeneric.Wrap(err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ func (p provision) Run(context wisski_distillery.Context) error {
|
|||
|
||||
// Store in the instances table!
|
||||
if err := logging.LogOperation(func() error {
|
||||
if err := instance.Save(); err != nil {
|
||||
if err := instance.Bookkeeping().Save(); err != nil {
|
||||
return errProvisionGeneric.WithMessageF(slug, err)
|
||||
}
|
||||
|
||||
|
|
@ -90,7 +90,7 @@ func (p provision) Run(context wisski_distillery.Context) error {
|
|||
|
||||
// run the provision script
|
||||
if err := logging.LogOperation(func() error {
|
||||
if err := instance.Provision(context.IOStream); err != nil {
|
||||
if err := instance.Provisioner().Provision(context.IOStream); err != nil {
|
||||
return errProvisionGeneric.WithMessageF(slug, err)
|
||||
}
|
||||
|
||||
|
|
@ -101,7 +101,7 @@ func (p provision) Run(context wisski_distillery.Context) error {
|
|||
|
||||
// start the container!
|
||||
logging.LogMessage(context.IOStream, "Starting Container")
|
||||
if err := instance.Barrel().Up(context.IOStream); err != nil {
|
||||
if err := instance.Barrel().Stack().Up(context.IOStream); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ func (p purge) Run(context wisski_distillery.Context) error {
|
|||
|
||||
// remove docker stack
|
||||
logging.LogMessage(context.IOStream, "Stopping and removing docker container")
|
||||
if err := instance.Barrel().Down(context.IOStream); err != nil {
|
||||
if err := instance.Barrel().Stack().Down(context.IOStream); err != nil {
|
||||
context.EPrintln(err)
|
||||
}
|
||||
|
||||
|
|
@ -93,13 +93,13 @@ func (p purge) Run(context wisski_distillery.Context) error {
|
|||
|
||||
// remove from bookkeeping
|
||||
logging.LogMessage(context.IOStream, "Removing instance from bookkeeping")
|
||||
if err := instance.Delete(); err != nil {
|
||||
if err := instance.Bookkeeping().Delete(); err != nil {
|
||||
context.EPrintln(err)
|
||||
}
|
||||
|
||||
// remove the filesystem
|
||||
logging.LogMessage(context.IOStream, "Remove lock data", instance.FilesystemBase)
|
||||
if !instance.Unlock() {
|
||||
if instance.Locker().TryUnlock() {
|
||||
context.EPrintln("instance was not locked")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ func (rb rebuild) Run(context wisski_distillery.Context) error {
|
|||
|
||||
// and do the actual rebuild
|
||||
return status.StreamGroup(context.IOStream, rb.Parallel, func(instance *wisski.WissKI, io stream.IOStream) error {
|
||||
return instance.Build(io, true)
|
||||
return instance.Barrel().Build(io, true)
|
||||
}, wissKIs, status.SmartMessage(func(item *wisski.WissKI) string {
|
||||
return fmt.Sprintf("rebuild %q", item.Slug)
|
||||
}))
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ func (r reserve) Run(context wisski_distillery.Context) error {
|
|||
}
|
||||
|
||||
// setup docker stack
|
||||
s := instance.Reserve()
|
||||
s := instance.Reserve().Stack()
|
||||
{
|
||||
if err := logging.LogOperation(func() error {
|
||||
return s.Install(context.IOStream, component.InstallationContext{})
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ func (sh shell) Run(context wisski_distillery.Context) error {
|
|||
return err
|
||||
}
|
||||
|
||||
code, err := instance.Shell(context.IOStream, sh.Positionals.Args...)
|
||||
code, err := instance.Barrel().Shell(context.IOStream, sh.Positionals.Args...)
|
||||
if err != nil {
|
||||
return errShell.WithMessageF(err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ func (upc updateprefixconfig) Run(context wisski_distillery.Context) error {
|
|||
|
||||
return status.StreamGroup(context.IOStream, upc.Parallel, func(instance *wisski.WissKI, io stream.IOStream) error {
|
||||
io.Println("reading prefixes")
|
||||
err := instance.UpdatePrefixes()
|
||||
err := instance.Prefixes().UpdatePrefixes()
|
||||
if err != nil {
|
||||
return errPrefixUpdateFailed.Wrap(err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue