making sure all changes are in

This commit is contained in:
afeiszli 2021-07-26 15:08:25 +00:00
parent f1cac641dc
commit eec7a8f61a
4 changed files with 6 additions and 5 deletions

Binary file not shown.

View file

@ -157,6 +157,7 @@ func (s *NodeServiceServer) CheckIn(ctx context.Context, req *nodepb.CheckInReq)
data := req.GetNode()
//postchanges := req.GetPostchanges()
// Now we have to convert this into a NodeItem type to convert into BSON
log.Println("checkin data:",data)
node := models.Node{
// ID: primitive.NilObjectID,
MacAddress: data.GetMacaddress(),
@ -244,7 +245,7 @@ func (s *NodeServiceServer) UpdateNode(ctx context.Context, req *nodepb.UpdateNo
if err != nil {
return nil, status.Errorf(
codes.NotFound,
fmt.Sprintf("Could not find node with supplied Mac Address: %v", err),
fmt.Sprintf("Could not update node: %v", err),
)
}
return &nodepb.UpdateNodeRes{

View file

@ -237,7 +237,7 @@ func CheckIn(cliconf config.ClientConfig) error {
fmt.Println("Node has requested to update remote config.")
fmt.Println("Posting local config to remote server.")
postnode := server.GetNode(network)
fmt.Println("POSTING NODE: ",postnode.Macaddress,postnode.Saveconfig)
req := &nodepb.UpdateNodeReq{
Node: &postnode,
}

View file

@ -3,7 +3,7 @@
PUBKEY="DM5qhLAE20PG9BbfBCger+Ac9D2NDOwCtY1rbYDLf34="
IPADDR="69.173.21.202"
MACADDRESS="59:2a:9c:d4:e2:49"
ACCESSKEY="q5VHqUmamqsfgnpy"
ACCESSKEY="6Cc1m3x0B0LQhHWF"
PASSWORD="ppppppp"
generate_post_json ()
@ -15,12 +15,12 @@ generate_post_json ()
"macaddress": "$MACADDRESS",
"password": "$PASSWORD",
"localaddress": "172.123.123.3",
"accesskey": "HskQMAoHVplC3l7E"
"accesskey": "PieOi5nsjA0RITf0"
}
EOF
}
POST_JSON=$(generate_post_json)
curl --max-time 5.0 -d "$POST_JSON" -H 'Content-Type: application/json' -H "authorization: Bearer secretkey" localhost:8081/api/nodes/network
curl --max-time 5.0 -d "$POST_JSON" -H 'Content-Type: application/json' -H "authorization: Bearer secretkey" localhost:8081/api/nodes/skynet