Fix environment recovery
As the environment is no longer stored in the meta information, Poseidon wasn't able to recover environments. It expected the environment id to be found in the meta data. We now recover the environment id from the job id.
This commit is contained in:
@@ -355,3 +355,11 @@ func IsEnvironmentTemplateID(jobID string) bool {
|
||||
parts := strings.Split(jobID, "-")
|
||||
return len(parts) == 2 && parts[0] == nomad.TemplateJobPrefix
|
||||
}
|
||||
|
||||
func EnvironmentIDFromTemplateJobID(id string) (string, error) {
|
||||
parts := strings.Split(id, "-")
|
||||
if len(parts) < 2 {
|
||||
return "", fmt.Errorf("invalid template job id: %w", ErrorInvalidJobID)
|
||||
}
|
||||
return parts[1], nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user