Browse Source

making sure all changes are in

afeiszli 4 years ago
parent
commit
eec7a8f61a

BIN
controllers/.nodeGrpcController.go.swp


+ 2 - 1
controllers/nodeGrpcController.go

@@ -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{

+ 1 - 1
netclient/functions/checkin.go

@@ -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,
                         }

+ 3 - 3
test/nodecreate.sh

@@ -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