Skip to content

Commit

Permalink
remove service
Browse files Browse the repository at this point in the history
  • Loading branch information
tedim52 committed Feb 26, 2024
1 parent 8c7a419 commit 579a432
Showing 1 changed file with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -716,8 +716,24 @@ func (pyg *PlanYamlGeneratorImpl) updatePlanYamlFromExec(execInstruction *instru
return nil
}

func (pyg *PlanYamlGeneratorImpl) updatePlanYamlFromRemoveService(RemoveServiceInstruction *instructions_plan.ScheduledInstruction) error {
// TODO: update the plan yaml based on an add_service
func (pyg *PlanYamlGeneratorImpl) updatePlanYamlFromRemoveService(removeServiceInstruction *instructions_plan.ScheduledInstruction) error {
arguments := removeServiceInstruction.GetInstruction().GetArguments()

serviceName, err := builtin_argument.ExtractArgumentValue[starlark.String](arguments, remove_service.ServiceNameArgName)
if err != nil {
return startosis_errors.WrapWithInterpretationError(err, "Unable to extract value for '%s' argument", remove_service.ServiceNameArgName)
}

delete(pyg.serviceIndex, serviceName.GoString())

for idx, service := range pyg.planYaml.Services {
if service.Name == serviceName.GoString() {
pyg.planYaml.Services[idx] = pyg.planYaml.Services[len(pyg.planYaml.Services)-1]
pyg.planYaml.Services = pyg.planYaml.Services[:len(pyg.planYaml.Services)-1]
return nil
}
}

return nil
}

Expand Down

0 comments on commit 579a432

Please sign in to comment.