github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/worker/uniter/operation/noopupgrade.go (about)

     1  // Copyright 2018 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package operation
     5  
     6  import (
     7  	"fmt"
     8  
     9  	"gopkg.in/juju/charm.v6"
    10  	"gopkg.in/juju/charm.v6/hooks"
    11  
    12  	"github.com/juju/juju/worker/uniter/hook"
    13  )
    14  
    15  type noOpUpgrade struct {
    16  	Operation
    17  
    18  	charmURL *charm.URL
    19  }
    20  
    21  // String is part of the Operation interface.
    22  func (op *noOpUpgrade) String() string {
    23  	return fmt.Sprintf("no-op upgrade operation to %v", op.charmURL.String())
    24  }
    25  
    26  // Commit is part of the Operation interface.
    27  func (op *noOpUpgrade) Commit(state State) (*State, error) {
    28  	change := stateChange{
    29  		Kind: RunHook,
    30  		Step: Queued,
    31  		Hook: &hook.Info{Kind: hooks.UpgradeCharm},
    32  	}
    33  	newState := change.apply(state)
    34  	return newState, nil
    35  }