зеркало из https://github.com/Azure/ARO-RP.git
Fix broken mirror specific version arg
This commit is contained in:
Родитель
f061d44562
Коммит
67d427d1ce
|
@ -99,9 +99,19 @@ func mirror(ctx context.Context, log *logrus.Entry) error {
|
|||
Payload: version.InstallStream.PullSpec,
|
||||
})
|
||||
} else {
|
||||
vers, err := version.ParseVersion(arg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
node, err := pkgmirror.VersionInfo(vers)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
releases = append(releases, pkgmirror.Node{
|
||||
Version: arg,
|
||||
Payload: arg,
|
||||
Version: node.Version,
|
||||
Payload: node.Payload,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,3 +75,19 @@ func AddFromGraph(min *version.Version) ([]Node, error) {
|
|||
|
||||
return releases, nil
|
||||
}
|
||||
|
||||
// VersionInfo fetches the Node containing the version payload
|
||||
func VersionInfo(ver *version.Version) (Node, error) {
|
||||
nodes, err := AddFromGraph(ver)
|
||||
if err != nil {
|
||||
return Node{}, err
|
||||
}
|
||||
|
||||
for _, node := range nodes {
|
||||
if strings.EqualFold(node.Version, ver.String()) {
|
||||
return node, nil
|
||||
}
|
||||
}
|
||||
|
||||
return Node{}, fmt.Errorf("version '%s' not found", ver.String())
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче