mirror of
https://github.com/containers/podman.git
synced 2025-06-27 05:26:50 +08:00
Refactor version handling in cmd tree
* Move from simple string to semver objects * Change client API Version from '1' to 2.0.0 Signed-off-by: Jhon Honce <jhonce@redhat.com>
This commit is contained in:
@ -22,5 +22,5 @@ var (
|
||||
PFalse = &pFalse
|
||||
|
||||
// APIVersion - podman will fail to run if this value is wrong
|
||||
APIVersion = semver.MustParse("1.0.0")
|
||||
APIVersion = semver.MustParse("2.0.0")
|
||||
)
|
||||
|
@ -118,10 +118,10 @@ func Version(ctx context.Context) (*entities.SystemVersionReport, error) {
|
||||
if err = response.Process(&component); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
f, _ := strconv.ParseFloat(component.APIVersion, 64)
|
||||
|
||||
b, _ := time.Parse(time.RFC3339, component.BuildTime)
|
||||
report.Server = &define.Version{
|
||||
APIVersion: int64(f),
|
||||
APIVersion: component.APIVersion,
|
||||
Version: component.Version.Version,
|
||||
GoVersion: component.GoVersion,
|
||||
GitCommit: component.GitCommit,
|
||||
@ -129,6 +129,12 @@ func Version(ctx context.Context) (*entities.SystemVersionReport, error) {
|
||||
Built: b.Unix(),
|
||||
OsArch: fmt.Sprintf("%s/%s", component.Os, component.Arch),
|
||||
}
|
||||
|
||||
for _, c := range component.Components {
|
||||
if c.Name == "Podman Engine" {
|
||||
report.Server.APIVersion = c.Details["APIVersion"]
|
||||
}
|
||||
}
|
||||
return &report, err
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user