1
// Copyright 2016 Canonical Ltd.
2
// Licensed under the AGPLv3, see LICENCE file for details.
10
type failAction struct {
17
// String is part of the Operation interface.
18
func (fa *failAction) String() string {
19
return fmt.Sprintf("fail action %s", fa.actionId)
22
// Prepare is part of the Operation interface.
23
func (fa *failAction) Prepare(state State) (*State, error) {
27
ActionId: &fa.actionId,
32
// Execute is part of the Operation interface.
33
func (fa *failAction) Execute(state State) (*State, error) {
34
if err := fa.callbacks.FailAction(fa.actionId, "action terminated"); err != nil {
41
ActionId: &fa.actionId,
46
// Commit preserves the recorded hook, and returns a neutral state.
47
// Commit is part of the Operation interface.
48
func (fa *failAction) Commit(state State) (*State, error) {
50
Kind: continuationKind(state),