Skip to content
Snippets Groups Projects
Commit 7e606beb authored by Neil-Jocelyn Schark's avatar Neil-Jocelyn Schark
Browse files

add regex for image check

parent 61c24f81
No related branches found
No related tags found
3 merge requests!406Draft: Add backup script,!404Enable export and import of SDN configuration,!377Add Linux support to venv-manager
Pipeline #116070 passed
This commit is part of merge request !404. Comments created here will be created in the context of that merge request.
......@@ -26,8 +26,16 @@ func (n *Node) FillAllFields(containerRegistryURL string) {
// Works if linux and our gnmi target is used.
softwareVersion := n.YangData.System.State.SoftwareVersion
if softwareVersion != nil {
n.Kind = "linux"
n.Image = containerRegistryURL + *softwareVersion
// Checks if software version is in compatible format.
result, _ := regexp.MatchString(`^([A-Za-z0-9\.\/])*:([A-Za-z0-9\.])*`, *softwareVersion)
if result {
n.Kind = "linux"
n.Image = containerRegistryURL + *softwareVersion
return
}
n.Kind = "couldn't detect kind"
n.Image = "couldn't detect image"
return
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment