@@ -726,11 +726,11 @@ func handleDockerEvents(event *dockerclient.Event, ec chan error, args ...interf
726
726
return
727
727
}
728
728
if event .ID != "" {
729
- labelMap := getLabelsFromContainerInspect (event . ID , & containerInfo )
729
+ labelMap := getLabelsFromContainerInspect (& containerInfo )
730
730
731
- containerTenant := getTenantFromContainerInspect (event . ID , & containerInfo )
732
- network , ipAddress := getEpNetworkInfoFromContainerInspect (event . ID , & containerInfo )
733
- container := getContainerFromContainerInspect (event . ID , & containerInfo )
731
+ containerTenant := getTenantFromContainerInspect (& containerInfo )
732
+ network , ipAddress := getEpNetworkInfoFromContainerInspect (& containerInfo )
733
+ container := getContainerFromContainerInspect (& containerInfo )
734
734
if ipAddress != "" {
735
735
//Create provider info
736
736
networkname := strings .Split (network , "/" )[0 ]
@@ -740,7 +740,7 @@ func handleDockerEvents(event *dockerclient.Event, ec chan error, args ...interf
740
740
providerUpdReq .Network = networkname
741
741
providerUpdReq .Event = "start"
742
742
providerUpdReq .Container = container
743
- providerUpdReq .Labels = make (map [string ]string )
743
+ providerUpdReq .Labels = make (map [string ]string )
744
744
745
745
for k , v := range labelMap {
746
746
providerUpdReq .Labels [k ] = v
@@ -774,15 +774,15 @@ func handleDockerEvents(event *dockerclient.Event, ec chan error, args ...interf
774
774
}
775
775
776
776
//getLabelsFromContainerInspect returns the labels associated with the container
777
- func getLabelsFromContainerInspect (containerID string , containerInfo * types.ContainerJSON ) map [string ]string {
777
+ func getLabelsFromContainerInspect (containerInfo * types.ContainerJSON ) map [string ]string {
778
778
if containerInfo != nil && containerInfo .Config != nil {
779
779
return containerInfo .Config .Labels
780
780
}
781
781
return nil
782
782
}
783
783
784
784
//getTenantFromContainerInspect returns the tenant the container belongs to.
785
- func getTenantFromContainerInspect (containerID string , containerInfo * types.ContainerJSON ) string {
785
+ func getTenantFromContainerInspect (containerInfo * types.ContainerJSON ) string {
786
786
tenant := "default"
787
787
if containerInfo != nil && containerInfo .NetworkSettings != nil {
788
788
for network := range containerInfo .NetworkSettings .Networks {
@@ -796,7 +796,7 @@ func getTenantFromContainerInspect(containerID string, containerInfo *types.Cont
796
796
}
797
797
798
798
/*getEpNetworkInfoFromContainerInspect inspects the network info from containerinfo returned by dockerclient*/
799
- func getEpNetworkInfoFromContainerInspect (containerID string , containerInfo * types.ContainerJSON ) (string , string ) {
799
+ func getEpNetworkInfoFromContainerInspect (containerInfo * types.ContainerJSON ) (string , string ) {
800
800
var networkName string
801
801
var IPAddress string
802
802
@@ -813,12 +813,13 @@ func getEpNetworkInfoFromContainerInspect(containerID string, containerInfo *typ
813
813
return networkName , IPAddress
814
814
}
815
815
816
- func getContainerFromContainerInspect (event.ID ,& containerInfo ) string {
816
+ func getContainerFromContainerInspect (containerInfo * types.ContainerJSON ) string {
817
+
817
818
container := ""
818
819
if containerInfo != nil && containerInfo .NetworkSettings != nil {
819
- for _ , endpoint := range containerInfo .NetworkSettings .Networks {
820
- container = endpoint .EndpointID
821
- }
820
+ for _ , endpoint := range containerInfo .NetworkSettings .Networks {
821
+ container = endpoint .EndpointID
822
+ }
822
823
}
823
824
return container
824
825
0 commit comments