Skip to content

Commit

Permalink
fix to windows service action
Browse files Browse the repository at this point in the history
  • Loading branch information
benPearce1 committed Aug 15, 2024
1 parent a403f19 commit afb28f4
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion octopusdeploy_framework/mappers/actions/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (a Action) ToState(ctx context.Context, actionState attr.Value, action *dep

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

return GetBaseAction(actionAttribute)
return getBaseAction(actionAttribute)

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (k KubernetesSecretActionMapper) ToDeploymentAction(actionAttribute attr.Va
return nil
}

action := GetBaseAction(actionAttribute)
action := getBaseAction(actionAttribute)
if action == nil {
return nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (m *ManualInterventionActionMapper) ToDeploymentAction(actionAttribute attr
return nil
}

action := GetBaseAction(actionAttribute)
action := getBaseAction(actionAttribute)
if action == nil {
return nil
}
Expand Down
8 changes: 4 additions & 4 deletions octopusdeploy_framework/mappers/actions/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ func (p PackageActionMapper) ToState(ctx context.Context, actionState attr.Value
mapWindowsServicePropertiesToState(action, attrs)
list := make([]attr.Value, 1)
list[0] = types.ObjectValueMust(getWindowsServiceAttrTypes(), attrs)
newAction["windows_service"] = types.ListValueMust(types.ObjectType{AttrTypes: getWindowsServiceAttrTypes()}, list)
newAction["windows_service"] = types.SetValueMust(types.ObjectType{AttrTypes: getWindowsServiceAttrTypes()}, list)
} else {
newAction["windows_service"] = types.ListNull(types.ObjectType{AttrTypes: getWindowsServiceAttrTypes()})
newAction["windows_service"] = types.SetNull(types.ObjectType{AttrTypes: getWindowsServiceAttrTypes()})
}
}

Expand All @@ -38,15 +38,15 @@ func (p PackageActionMapper) ToDeploymentAction(actionAttribute attr.Value) *dep
return nil
}

action := GetBaseAction(actionAttribute)
action := getBaseAction(actionAttribute)
if action == nil {
return nil
}

action.ActionType = "Octopus.TentaclePackage"

if v, ok := actionAttrs["windows_service"]; ok {
list := v.(types.List).Elements()
list := v.(types.Set).Elements()
for _, item := range list {
mapWindowsServiceProperties(action, item.(types.Object).Attributes())
return action
Expand Down
2 changes: 1 addition & 1 deletion octopusdeploy_framework/mappers/actions/run_script.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (r RunScriptActionMapper) ToDeploymentAction(actionAttribute attr.Value) *d
return nil
}

action := GetBaseAction(actionAttribute)
action := getBaseAction(actionAttribute)
if action == nil {
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion octopusdeploy_framework/mappers/actions/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ func GetActionAttributes(actionAttribute attr.Value) map[string]attr.Value {
return actionAttrsElements[0].(types.Object).Attributes()
}

func GetBaseAction(actionAttribute attr.Value) *deployments.DeploymentAction {
func getBaseAction(actionAttribute attr.Value) *deployments.DeploymentAction {
actionAttrs := GetActionAttributes(actionAttribute)
if actionAttrs == nil {
return nil
Expand Down
3 changes: 2 additions & 1 deletion octopusdeploy_framework/mappers/actions/windows_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (w WindowsServiceActionMapper) ToDeploymentAction(actionAttribute attr.Valu
return nil
}

action := GetBaseAction(actionAttribute)
action := getBaseAction(actionAttribute)
if action == nil {
return nil
}
Expand Down Expand Up @@ -73,6 +73,7 @@ func getWindowsServiceAttrTypes() map[string]attr.Type {
"custom_account_name": types.StringType,
"custom_account_password": types.StringType,
"dependencies": types.StringType,
"description": types.StringType,
"display_name": types.StringType,
"executable_path": types.StringType,
"service_account": types.StringType,
Expand Down

0 comments on commit afb28f4

Please sign in to comment.