Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.8.1
FROM golang:1.9.4

RUN apt-get update && apt-get install -y zip

Expand Down
2 changes: 2 additions & 0 deletions cni/cni.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const (
// CNI commands.
Cmd = "CNI_COMMAND"
CmdAdd = "ADD"
CmdGet = "GET"
CmdDel = "DEL"

// CNI errors.
Expand All @@ -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
}
5 changes: 5 additions & 0 deletions cni/ipam/ipam.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions cni/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cni/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 10 additions & 5 deletions telemetry/telemetry_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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"],
}
}