diff --git a/Dockerfile.build b/Dockerfile.build index 59836ec09f..881cb46a2f 100644 --- a/Dockerfile.build +++ b/Dockerfile.build @@ -1,4 +1,4 @@ -FROM golang:1.8.1 +FROM golang:1.9.4 RUN apt-get update && apt-get install -y zip diff --git a/cni/cni.go b/cni/cni.go index f9ab3bda98..712bd8dc92 100644 --- a/cni/cni.go +++ b/cni/cni.go @@ -11,6 +11,7 @@ const ( // CNI commands. Cmd = "CNI_COMMAND" CmdAdd = "ADD" + CmdGet = "GET" CmdDel = "DEL" // CNI errors. @@ -26,5 +27,6 @@ var supportedVersions = []string{"0.1.0", "0.2.0", "0.3.0", "0.3.1"} // CNI contract. type PluginApi interface { Add(args *cniSkel.CmdArgs) error + Get(args *cniSkel.CmdArgs) error Delete(args *cniSkel.CmdArgs) error } diff --git a/cni/ipam/ipam.go b/cni/ipam/ipam.go index eac4bc5ffe..8ad2e507f0 100644 --- a/cni/ipam/ipam.go +++ b/cni/ipam/ipam.go @@ -250,6 +250,11 @@ func (plugin *ipamPlugin) Add(args *cniSkel.CmdArgs) error { return nil } +// Get handles CNI get commands. +func (plugin *ipamPlugin) Get(args *cniSkel.CmdArgs) error { + return nil +} + // Delete handles CNI delete commands. func (plugin *ipamPlugin) Delete(args *cniSkel.CmdArgs) error { var err error diff --git a/cni/network/network.go b/cni/network/network.go index 185e2d4def..54943d5075 100644 --- a/cni/network/network.go +++ b/cni/network/network.go @@ -362,6 +362,11 @@ func (plugin *netPlugin) Add(args *cniSkel.CmdArgs) error { return nil } +// Get handles CNI get commands. +func (plugin *netPlugin) Get(args *cniSkel.CmdArgs) error { + return nil +} + // Delete handles CNI delete commands. func (plugin *netPlugin) Delete(args *cniSkel.CmdArgs) error { var err error diff --git a/cni/plugin.go b/cni/plugin.go index af2127c609..a614a0140f 100644 --- a/cni/plugin.go +++ b/cni/plugin.go @@ -109,7 +109,7 @@ func (plugin *Plugin) Execute(api PluginApi) (err error) { pluginInfo := cniVers.PluginSupports(supportedVersions...) // Parse args and call the appropriate cmd handler. - cniErr := cniSkel.PluginMainWithError(api.Add, api.Delete, pluginInfo) + cniErr := cniSkel.PluginMainWithError(api.Add, api.Get, api.Delete, pluginInfo) if cniErr != nil { cniErr.Print() return cniErr diff --git a/telemetry/telemetry_linux.go b/telemetry/telemetry_linux.go index 09d2bd840d..a89743f240 100644 --- a/telemetry/telemetry_linux.go +++ b/telemetry/telemetry_linux.go @@ -88,14 +88,19 @@ func (report *Report) GetSystemDetails() { // This function creates a report with os details(ostype, version). func (report *Report) GetOSDetails() { - linesArr, err := ReadFileByLines("/etc/issue") + linesArr, err := ReadFileByLines("/etc/os-release") if err != nil || len(linesArr) <= 0 { report.OSDetails = &OSInfo{OSType: runtime.GOOS} - report.OSDetails.ErrorMessage = "reading /etc/issue failed with" + err.Error() + report.OSDetails.ErrorMessage = "reading /etc/os-release failed with" + err.Error() return } - osInfoArr := strings.Split(linesArr[0], " ") + osInfoArr := make(map[string]string) + + for i := range linesArr { + s := strings.Split(linesArr[i], "=") + osInfoArr[s[0]] = strings.TrimSuffix(s[1], "\n") + } out, err := exec.Command("uname", "-r").Output() if err != nil { @@ -109,8 +114,8 @@ func (report *Report) GetOSDetails() { report.OSDetails = &OSInfo{ OSType: runtime.GOOS, - OSVersion: osInfoArr[1], + OSVersion: osInfoArr["VERSION"], KernelVersion: kernelVersion, - OSDistribution: osInfoArr[0], + OSDistribution: osInfoArr["ID"], } }