Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

Commit

Permalink
Fixed mapstructure annotations + introduced notStateless const
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Ferquel <[email protected]>
  • Loading branch information
simonferquel committed Feb 12, 2019
1 parent 2dba4a4 commit 6630128
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 9 deletions.
3 changes: 3 additions & 0 deletions pkg/action/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import (
"github.com/deislabs/duffle/pkg/driver"
)

// notStateless is there just to make callers of opFromClaims more readable
const notStateless = false

// Action describes one of the primary actions that can be executed in CNAB.
//
// The actions are:
Expand Down
4 changes: 2 additions & 2 deletions pkg/action/action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func TestOpFromClaim(t *testing.T) {
}
invocImage := c.Bundle.InvocationImages[0]

op, err := opFromClaim(claim.ActionInstall, false, c, invocImage, mockSet, os.Stdout)
op, err := opFromClaim(claim.ActionInstall, notStateless, c, invocImage, mockSet, os.Stdout)
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -140,7 +140,7 @@ func TestOpFromClaim_UndefinedParams(t *testing.T) {
}
invocImage := c.Bundle.InvocationImages[0]

_, err := opFromClaim(claim.ActionInstall, false, c, invocImage, mockSet, os.Stdout)
_, err := opFromClaim(claim.ActionInstall, notStateless, c, invocImage, mockSet, os.Stdout)
assert.Error(t, err)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/action/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func (i *Install) Run(c *claim.Claim, creds credentials.Set, w io.Writer) error
return err
}

op, err := opFromClaim(claim.ActionInstall, false, c, invocImage, creds, w)
op, err := opFromClaim(claim.ActionInstall, notStateless, c, invocImage, creds, w)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/action/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func (i *Status) Run(c *claim.Claim, creds credentials.Set, w io.Writer) error {
return err
}

op, err := opFromClaim(claim.ActionStatus, false, c, invocImage, creds, w)
op, err := opFromClaim(claim.ActionStatus, notStateless, c, invocImage, creds, w)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/action/uninstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func (u *Uninstall) Run(c *claim.Claim, creds credentials.Set, w io.Writer) erro
return err
}

op, err := opFromClaim(claim.ActionUninstall, false, c, invocImage, creds, w)
op, err := opFromClaim(claim.ActionUninstall, notStateless, c, invocImage, creds, w)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/action/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func (u *Upgrade) Run(c *claim.Claim, creds credentials.Set, w io.Writer) error
return err
}

op, err := opFromClaim(claim.ActionUpgrade, false, c, invocImage, creds, w)
op, err := opFromClaim(claim.ActionUpgrade, notStateless, c, invocImage, creds, w)
if err != nil {
return err
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/bundle/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@ type Action struct {
// Modifies indicates whether this action modifies the release.
//
// If it is possible that an action modify a release, this must be set to true.
Modifies bool `json:"modifies,omitempty"`
Modifies bool `json:"modifies" mapstructure:"modifies"`

// Stateless indicates that the action is purely informational, that credentials are not required, and that the runtime should not keep track of its invocation
Stateless bool `json:"stateless,omitempty"`
Stateless bool `json:"stateless" mapstructure:"stateless"`

// Description describes the action as a user-readable string
Description string `json:"description,omitempty"`
Description string `json:"description,omitempty" mapstructure:"description,omitempty"`
}

// ValuesOrDefaults returns parameter values or the default parameter values
Expand Down

0 comments on commit 6630128

Please sign in to comment.