Skip to content

Commit f3dade9

Browse files
authored
harden update worker for empty zoslight version (#2477)
Signed-off-by: Ashraf Fouda <ashraf.m.fouda@gmail.com>
1 parent 1f696a3 commit f3dade9

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

tools/zos-update-worker/internal/update_worker.go

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,20 +134,23 @@ func (w *Worker) updateZosVersion(network Network, manager client.Manager) error
134134
//zos
135135
zosCurrent := fmt.Sprintf("%v/.tag-%v", w.src, chainVersion.Version)
136136
zosLatest := fmt.Sprintf("%v/%v", w.dst, network)
137+
137138
// zos light
138-
zosLightCurrent := fmt.Sprintf("%v/.tag-%v", w.src, chainVersion.VersionLight)
139-
zosLightLatest := fmt.Sprintf("%v/%v-v4", w.dst, network)
139+
if chainVersion.VersionLight != "" {
140+
zosLightCurrent := fmt.Sprintf("%v/.tag-%v", w.src, chainVersion.VersionLight)
141+
zosLightLatest := fmt.Sprintf("%v/%v-v4", w.dst, network)
142+
zosLightLink := fmt.Sprintf("%v/.tag-%v", path, chainVersion.VersionLight)
143+
if err = w.updateLink(zosLightCurrent, zosLightLatest, zosLightLink); err != nil {
144+
return err
145+
}
146+
}
140147
// the link is like zosCurrent but it has the path relative from the symlink
141148
// point of view (so relative to the symlink, how to reach zosCurrent)
142149
// hence the link is instead used in all calls to symlink
143150
zosLink := fmt.Sprintf("%v/.tag-%v", path, chainVersion.Version)
144-
zosLightLink := fmt.Sprintf("%v/.tag-%v", path, chainVersion.VersionLight)
145151

146-
// update links for both zos and zoslight
147-
if err = w.updateLink(zosCurrent, zosLatest, zosLink); err != nil {
148-
return err
149-
}
150-
return w.updateLink(zosLightCurrent, zosLightLatest, zosLightLink)
152+
// update links zos
153+
return w.updateLink(zosCurrent, zosLatest, zosLink)
151154
}
152155

153156
func (w *Worker) updateLink(current string, latest string, link string) error {

0 commit comments

Comments
 (0)