github.com/juju/juju@v0.0.0-20240327075706-a90865de2538/worker/uniter/operation/skip.go (about) 1 // Copyright 2014-2015 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package operation 5 6 import ( 7 "fmt" 8 9 "github.com/juju/juju/worker/uniter/remotestate" 10 ) 11 12 type skipOperation struct { 13 Operation 14 } 15 16 // String is part of the Operation interface. 17 func (op *skipOperation) String() string { 18 return fmt.Sprintf("skip %s", op.Operation) 19 } 20 21 // NeedsGlobalMachineLock is part of the Operation interface. 22 func (op *skipOperation) NeedsGlobalMachineLock() bool { 23 return false 24 } 25 26 // Prepare is part of the Operation interface. 27 func (op *skipOperation) Prepare(state State) (*State, error) { 28 return nil, ErrSkipExecute 29 } 30 31 // Execute is part of the Operation interface. 32 func (op *skipOperation) Execute(state State) (*State, error) { 33 return nil, ErrSkipExecute 34 } 35 36 // RemoteStateChanged is called when the remote state changed during execution 37 // of the operation. 38 func (op *skipOperation) RemoteStateChanged(snapshot remotestate.Snapshot) { 39 } 40 41 // WrappedOperation is part of the WrappedOperation interface. 42 func (op *skipOperation) WrappedOperation() Operation { 43 return op.Operation 44 }