Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
benPearce1 committed Aug 7, 2024
1 parent 2f68fb9 commit abf7c35
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions octopusdeploy_framework/mappers/actions/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,16 @@ func (a Action) ToState(ctx context.Context, action *deployments.DeploymentActio
}

newAction["action_type"] = types.StringValue(action.ActionType)
mapPropertyToStateBool(action, newAction, "Octopus.Action.RunOnServer", "run_on_server", false)
newAction["worker_pool_id"] = types.StringValue(action.WorkerPool)
newAction["worker_pool_variable"] = types.StringValue(action.WorkerPoolVariable)
return nil
}

func (a Action) ToDeploymentAction(actionAttribute attr.Value) *deployments.DeploymentAction {

return GetBaseAction(actionAttribute)

}

var _ MappableAction = &Action{}
5 changes: 5 additions & 0 deletions octopusdeploy_framework/mappers/actions/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,11 @@ func GetBaseAction(actionAttribute attr.Value) *deployments.DeploymentAction {
action.Environments = getArray(actionAttrs, "environments")
action.ExcludedEnvironments = getArray(actionAttrs, "excluded_environments")

// TODO map properties from state
for k, v := range actionAttrs["properties"].(types.Map).Elements() {
action.Properties[k] = core.NewPropertyValue(v.(types.String).ValueString(), false)
}

features := getArray(actionAttrs, "features")
if features != nil {
action.Properties["Octopus.Action.EnabledFeatures"] = core.NewPropertyValue(strings.Join(features, ","), false)
Expand Down

0 comments on commit abf7c35

Please sign in to comment.