Skip to content

Commit 905a7f4

Browse files
claireguyotteo
authored andcommitted
[core][OCTRL-574] The odc_topology_fullname value is generated in a separate function.
1 parent f7aa964 commit 905a7f4

1 file changed

Lines changed: 45 additions & 26 deletions

File tree

core/integration/odc/plugin.go

Lines changed: 45 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,6 @@ func (p *Plugin) ObjectStack(varStack map[string]string) (stack map[string]inter
281281
pdpO2PdpSuiteVersion, pdpQcJsonVersion string
282282
odcNEpnsMaxFail, epnStoreRawDataFraction string
283283
pdpEpnShmId, pdpEpnShmRecreate string
284-
odcTopologyFullname string
285284
)
286285
accumulator = make([]string, 0)
287286

@@ -638,47 +637,67 @@ func (p *Plugin) ObjectStack(varStack map[string]string) (stack map[string]inter
638637
}
639638
accumulator = append(accumulator, strings.TrimSpace(pdpGeneratorScriptPath))
640639

641-
odcTopologyFullname = ""
640+
out = strings.Join(accumulator, " ")
641+
return
642+
}
643+
stack["GenerateEPNTopologyFullname"] = func() (out string) {
644+
pdpConfigOption, ok := varStack["pdp_config_option"]
645+
if !ok {
646+
log.WithField("partition", envId).
647+
WithField("call", "GenerateEPNTopologyFullname").
648+
Error("cannot acquire PDP workflow configuration mode")
649+
return
650+
}
651+
652+
pdpLibraryFile, ok := varStack["pdp_topology_description_library_file"]
653+
if !ok {
654+
log.WithField("partition", envId).
655+
WithField("call", "GenerateEPNTopologyFullname").
656+
Error("cannot acquire topology description library file")
657+
return
658+
}
659+
660+
pdpLibWorkflowName, ok := varStack["pdp_workflow_name"]
661+
if !ok {
662+
log.WithField("partition", envId).
663+
WithField("call", "GenerateEPNTopologyFullname").
664+
Error("cannot acquire PDP workflow name in topology library file")
665+
return
666+
}
667+
668+
odcTopologyFullname := ""
642669
switch pdpConfigOption {
643670
case "Repository hash":
671+
o2DPSource, ok := varStack["pdp_o2_data_processing_hash"]
672+
if !ok {
673+
log.WithField("partition", envId).
674+
WithField("call", "GenerateEPNTopologyFullname").
675+
Error("cannot acquire PDP Repository hash")
676+
return
677+
}
644678
odcTopologyFullname = "(hash, " + o2DPSource + ", " + pdpLibraryFile + ", " + pdpLibWorkflowName + ")"
645679

646680
case "Repository path":
681+
o2DPSource, ok := varStack["pdp_o2_data_processing_path"]
682+
if !ok {
683+
log.WithField("partition", envId).
684+
WithField("call", "GenerateEPNTopologyFullname").
685+
Error("cannot acquire PDP Repository hash")
686+
return
687+
}
647688
odcTopologyFullname = "(path, " + o2DPSource + ", " + pdpLibraryFile + ", " + pdpLibWorkflowName + ")"
648689

649690
case "Manual XML":
650691
odc_topology, ok := varStack["odc_topology"]
651692
if !ok {
652693
log.WithField("partition", envId).
653-
WithField("call", "GenerateEPNWorkflowScript").
694+
WithField("call", "GenerateEPNTopologyFullname").
654695
Error("cannot acquire ODC topology variable")
655696
return
656697
}
657698
odcTopologyFullname = "(xml, " + odc_topology + ")"
658699
}
659-
660-
log.Debugf("ODC topology pretty name: %s", odcTopologyFullname)
661-
//FIXME: Disabled because env does not exist yet when GenerateEPNWorkflowScript is called
662-
//parsedEnvId, err := uid.FromString(envId)
663-
//if err != nil {
664-
// log.WithField("partition", envId).
665-
// WithField("call", "GenerateEPNWorkflowScript").
666-
// Error("cannot parse environment ID")
667-
// return
668-
//}
669-
//envMan := environment.ManagerInstance()
670-
//env, err := envMan.Environment(parsedEnvId)
671-
//if err != nil {
672-
// log.WithField("partition", envId).
673-
// WithField("call", "GenerateEPNWorkflowScript").
674-
// Error("cannot acquire environment from parsed environment ID")
675-
// return
676-
//}
677-
//
678-
//env.Workflow().SetRuntimeVar("odc_topology_fullname", odcTopologyFullname)
679-
680-
out = strings.Join(accumulator, " ")
681-
return
700+
return odcTopologyFullname
682701
}
683702
return stack
684703
}

0 commit comments

Comments
 (0)