From abf7c35db1883bfa0ad76b904a744adfcbc2c461 Mon Sep 17 00:00:00 2001 From: Ben Pearce Date: Thu, 8 Aug 2024 09:52:19 +1000 Subject: [PATCH] small fixes --- octopusdeploy_framework/mappers/actions/action.go | 5 +++++ octopusdeploy_framework/mappers/actions/shared.go | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/octopusdeploy_framework/mappers/actions/action.go b/octopusdeploy_framework/mappers/actions/action.go index b7906aabe..9976ac28f 100644 --- a/octopusdeploy_framework/mappers/actions/action.go +++ b/octopusdeploy_framework/mappers/actions/action.go @@ -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{} diff --git a/octopusdeploy_framework/mappers/actions/shared.go b/octopusdeploy_framework/mappers/actions/shared.go index b53801e46..1e84bf5fa 100644 --- a/octopusdeploy_framework/mappers/actions/shared.go +++ b/octopusdeploy_framework/mappers/actions/shared.go @@ -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)