SEBA-741 report django version
Change-Id: I2ecfc403dbf163dc81bd9d882df90057c24789b5
diff --git a/commands/version.go b/commands/version.go
index 38d2f7a..44d7213 100644
--- a/commands/version.go
+++ b/commands/version.go
@@ -43,6 +43,7 @@
BuildTime string `json:"buildtime"`
Os string `json:"os"`
Arch string `json:"arch"`
+ DjangoVersion string `json:"djangoversion"`
}
type VersionOutput struct {
@@ -74,6 +75,7 @@
Os: "unknown",
Arch: "unknown",
BuildTime: "unknown",
+ DjangoVersion: "unknown",
},
}
@@ -93,6 +95,7 @@
Server:
Version {{.Server.Version}}
Python version: {{.Server.PythonVersion}}
+ Django version: {{.Server.DjangoVersion}}
Git commit: {{.Server.GitCommit}}
Built: {{.Server.BuildTime}}
OS/Arch: {{.Server.Os}}/{{.Server.Arch}}
@@ -134,6 +137,12 @@
versionInfo.Server.BuildTime = d.GetFieldByName("buildTime").(string)
versionInfo.Server.Os = d.GetFieldByName("os").(string)
versionInfo.Server.Arch = d.GetFieldByName("arch").(string)
+
+ // djangoVersion was added to GetVersion() in xos-core 3.3.1-dev
+ djangoVersion, err := d.TryGetFieldByName("djangoVersion")
+ if err == nil {
+ versionInfo.Server.DjangoVersion = djangoVersion.(string)
+ }
}
result := CommandResult{
diff --git a/commands/version_test.go b/commands/version_test.go
index 6835fc2..e37b6d1 100644
--- a/commands/version_test.go
+++ b/commands/version_test.go
@@ -64,6 +64,7 @@
"Server:\n" +
" Version 3.2.6\n" +
" Python version: 2.7.16 (default, May 6 2019, 19:35:26)\n" +
+ " Django version: unknown\n" +
" Git commit: b0df1bf6ed1698285eda6a6725c5da0c80aa4aee\n" +
" Built: 2019-05-20T17:04:14Z\n" +
" OS/Arch: linux/x86_64\n" +