diff --git a/go.mod b/go.mod index 36cf94a3..da9bbd2c 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ replace github.com/anexia-it/fsquota => github.com/aosedge/fsquota v0.0.0-202311 require ( code.cloudfoundry.org/bytefmt v0.0.0-20231017140541-3b893ed0421b - github.com/aosedge/aos_common v0.0.0-20240902084419-53e429d5c68a + github.com/aosedge/aos_common v0.0.0-20240919073545-c003861229df github.com/apparentlymart/go-cidr v1.1.0 github.com/cavaliergopher/grab/v3 v3.0.1 github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf diff --git a/go.sum b/go.sum index 3b16eabe..73f96cf1 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ code.cloudfoundry.org/bytefmt v0.0.0-20231017140541-3b893ed0421b h1:/2OEIBwZAaJ8n8iTXrM4v/+bdyLDTLwcW6RZtkO4+r0= code.cloudfoundry.org/bytefmt v0.0.0-20231017140541-3b893ed0421b/go.mod h1:CKNYSQxmKcMCNIKoRG5rRR4AIgJMIoK65ya+Z5xHnk4= -github.com/aosedge/aos_common v0.0.0-20240902084419-53e429d5c68a h1:vTyrUt3lGoPbiAAf+ckr2vreksbK4pGi/KmM9GNoUKI= -github.com/aosedge/aos_common v0.0.0-20240902084419-53e429d5c68a/go.mod h1:CG/e1tQPMo2fvdwRHi+Cx5StpNURu7InTZSgyfmBVYM= +github.com/aosedge/aos_common v0.0.0-20240919073545-c003861229df h1:9dD1t9oC7Qbig7KZVuWZX8a7Zi3NW3JKDmsoYPsOMbM= +github.com/aosedge/aos_common v0.0.0-20240919073545-c003861229df/go.mod h1:CG/e1tQPMo2fvdwRHi+Cx5StpNURu7InTZSgyfmBVYM= github.com/aosedge/crypto11 v1.0.3-0.20220217163524-ddd0ace39e6f h1:xL5hA9axQFHnoVVF/Q8CkKl9JiTvA7U72jRDltMBB9M= github.com/aosedge/crypto11 v1.0.3-0.20220217163524-ddd0ace39e6f/go.mod h1:ILDKtnCKiQ7zRoNxcp36Y1ZR8LBPmR2E23+wTQe/MlE= github.com/aosedge/fsquota v0.0.0-20231127111317-842d831105a7 h1:KR+SuYXJ9HigUaJdUwRlkDOOpkCrliFF3liBVKu2GKY= diff --git a/umcontroller/umcontroller.go b/umcontroller/umcontroller.go index 6f554a7a..fb457e61 100644 --- a/umcontroller/umcontroller.go +++ b/umcontroller/umcontroller.go @@ -1148,7 +1148,7 @@ func (umCtrl *Controller) notifyNewComponents(umID string, componsStatus []syste ComponentID: status.componentID, ComponentType: status.componentType, Version: status.version, - NodeID: umID, + NodeID: &umID, Status: status.status, } diff --git a/umcontroller/umcontroller_test.go b/umcontroller/umcontroller_test.go index faf2b918..45ef72c5 100644 --- a/umcontroller/umcontroller_test.go +++ b/umcontroller/umcontroller_test.go @@ -341,8 +341,8 @@ func TestNewComponentsUpdate(t *testing.T) { select { case newComponents := <-umCtrl.NewComponentsChannel(): if !reflect.DeepEqual(newComponents, []cloudprotocol.ComponentStatus{ - {ComponentID: "component3", Version: "1.0.0", Status: "installed", NodeID: "umID2"}, - {ComponentID: "component4", Version: "1.0.0", Status: "installed", NodeID: "umID2"}, + {ComponentID: "component3", Version: "1.0.0", Status: "installed", NodeID: convertToNodeID("umID2")}, + {ComponentID: "component4", Version: "1.0.0", Status: "installed", NodeID: convertToNodeID("umID2")}, }) { t.Errorf("Incorrect new components: %v", newComponents) } @@ -1897,3 +1897,7 @@ func generateFile(fileName string, size uint64) (err error) { func convertToComponentID(id string) *string { return &id } + +func convertToNodeID(nodeID string) *string { + return &nodeID +} diff --git a/unitstatushandler/unitstatushandler_test.go b/unitstatushandler/unitstatushandler_test.go index 8ee8d1b9..90c929c1 100644 --- a/unitstatushandler/unitstatushandler_test.go +++ b/unitstatushandler/unitstatushandler_test.go @@ -1175,15 +1175,15 @@ func TestNewComponents(t *testing.T) { newComponents := []cloudprotocol.ComponentStatus{ { ComponentID: "comp1", ComponentType: "type1", Version: "1.0.0", - Status: cloudprotocol.InstalledStatus, NodeID: "node1", + Status: cloudprotocol.InstalledStatus, NodeID: convertToNodeID("node1"), }, { ComponentID: "comp2", ComponentType: "type2", Version: "1.0.0", - Status: cloudprotocol.InstalledStatus, NodeID: "node2", + Status: cloudprotocol.InstalledStatus, NodeID: convertToNodeID("node2"), }, { ComponentID: "comp3", ComponentType: "type3", Version: "1.0.0", - Status: cloudprotocol.InstalledStatus, NodeID: "node3", + Status: cloudprotocol.InstalledStatus, NodeID: convertToNodeID("node3"), }, } @@ -1388,3 +1388,7 @@ func handleUpdateStatus(handler *unitstatushandler.Instance) { func convertToComponentID(id string) *string { return &id } + +func convertToNodeID(nodeID string) *string { + return &nodeID +} diff --git a/vendor/github.com/aosedge/aos_common/api/cloudprotocol/unitstatus.go b/vendor/github.com/aosedge/aos_common/api/cloudprotocol/unitstatus.go index ac7dd55f..3f4df0d1 100644 --- a/vendor/github.com/aosedge/aos_common/api/cloudprotocol/unitstatus.go +++ b/vendor/github.com/aosedge/aos_common/api/cloudprotocol/unitstatus.go @@ -161,7 +161,7 @@ type ComponentStatus struct { ComponentID string `json:"id"` ComponentType string `json:"type"` Version string `json:"version"` - NodeID string `json:"nodeId"` + NodeID *string `json:"nodeId,omitempty"` Status string `json:"status"` Annotations json.RawMessage `json:"annotations,omitempty"` ErrorInfo *ErrorInfo `json:"errorInfo,omitempty"` diff --git a/vendor/modules.txt b/vendor/modules.txt index 4b1517aa..0f682f51 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -7,7 +7,7 @@ github.com/ThalesIgnite/crypto11 # github.com/anexia-it/fsquota v0.0.0-00010101000000-000000000000 => github.com/aosedge/fsquota v0.0.0-20231127111317-842d831105a7 ## explicit; go 1.21 github.com/anexia-it/fsquota -# github.com/aosedge/aos_common v0.0.0-20240902084419-53e429d5c68a +# github.com/aosedge/aos_common v0.0.0-20240919073545-c003861229df ## explicit; go 1.21 github.com/aosedge/aos_common/aoserrors github.com/aosedge/aos_common/aostypes