container: allow additional state between ops
All checks were successful
Test / Create distribution (push) Successful in 33s
Test / Sandbox (push) Successful in 2m12s
Test / Hakurei (push) Successful in 3m15s
Test / Hpkg (push) Successful in 4m8s
Test / Sandbox (race detector) (push) Successful in 4m21s
Test / Hakurei (race detector) (push) Successful in 5m8s
Test / Flake checks (push) Successful in 1m26s
All checks were successful
Test / Create distribution (push) Successful in 33s
Test / Sandbox (push) Successful in 2m12s
Test / Hakurei (push) Successful in 3m15s
Test / Hpkg (push) Successful in 4m8s
Test / Sandbox (race detector) (push) Successful in 4m21s
Test / Hakurei (race detector) (push) Successful in 5m8s
Test / Flake checks (push) Successful in 1m26s
This is useful for ops that need to be aware of previous instances of themselves. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -28,7 +28,7 @@ type AutoRootOp struct {
|
||||
resolved []Op
|
||||
}
|
||||
|
||||
func (r *AutoRootOp) early(params *Params) error {
|
||||
func (r *AutoRootOp) early(state *setupState) error {
|
||||
if r.Host == nil {
|
||||
return syscall.EBADE
|
||||
}
|
||||
@@ -45,7 +45,7 @@ func (r *AutoRootOp) early(params *Params) error {
|
||||
Target: AbsFHSRoot.Append(name),
|
||||
Flags: r.Flags,
|
||||
}
|
||||
if err = op.early(params); err != nil {
|
||||
if err = op.early(state); err != nil {
|
||||
return err
|
||||
}
|
||||
r.resolved = append(r.resolved, op)
|
||||
@@ -55,10 +55,10 @@ func (r *AutoRootOp) early(params *Params) error {
|
||||
}
|
||||
}
|
||||
|
||||
func (r *AutoRootOp) apply(params *Params) error {
|
||||
func (r *AutoRootOp) apply(state *setupState) error {
|
||||
for _, op := range r.resolved {
|
||||
msg.Verbosef("%s %s", op.prefix(), op)
|
||||
if err := op.apply(params); err != nil {
|
||||
if err := op.apply(state); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user