summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvuko <vuko@hackerspace.pl>2021-01-11 15:36:04 +0100
committervuko <vuko@hackerspace.pl>2021-01-11 15:38:08 +0100
commit6d2ae54ed0d81b202c10996c7f6cf7f8cfbccabf (patch)
tree592177ddba841b9e8b4f44b5e20897734571383e
parent547de3dedcad943d0f83c4a993ed81fcc2dc61ce (diff)
downloadcheckinator-6d2ae54ed0d81b202c10996c7f6cf7f8cfbccabf.tar.gz
checkinator-6d2ae54ed0d81b202c10996c7f6cf7f8cfbccabf.tar.bz2
checkinator-6d2ae54ed0d81b202c10996c7f6cf7f8cfbccabf.zip
fix proto and proto checking
-rw-r--r--at/tracker.proto2
-rw-r--r--at/tracker.py4
-rw-r--r--setup.py6
3 files changed, 8 insertions, 4 deletions
diff --git a/at/tracker.proto b/at/tracker.proto
index 269ec40..7db4e5c 100644
--- a/at/tracker.proto
+++ b/at/tracker.proto
@@ -5,7 +5,7 @@ service DhcpTracker {
rpc GetClients (ClientsRequest) returns (DhcpClients) {};
/* get Layer 2 addess (MAC) for LAN ip address (v4 or v6) */
- rpc GetHwAddr (HwAddrRequest) returns (HwAddr) {};
+ rpc GetHwAddr (HwAddrRequest) returns (HwAddrResponse) {};
}
message ClientsRequest {
diff --git a/at/tracker.py b/at/tracker.py
index a6a0e8e..18a139e 100644
--- a/at/tracker.py
+++ b/at/tracker.py
@@ -9,7 +9,7 @@ import logging
from concurrent import futures
from datetime import datetime
-from .tracker_pb2 import DhcpClient, DhcpClients, HwAddr
+from .tracker_pb2 import DhcpClient, DhcpClients, HwAddrResponse
from .tracker_pb2_grpc import DhcpTrackerServicer, add_DhcpTrackerServicer_to_server
import argparse
@@ -71,7 +71,7 @@ class DhcpTrackerServicer(DhcpTrackerServicer):
neighs = json.loads(r.stdout)
if neighs:
return HwAddrResponse(hw_address=bytes.fromhex(neighs[0]['lladdr'].replace(':', '')))
- return HwAddr(hw_address=None)
+ return HwAddrResponse(hw_address=None)
def server():
args = parser.parse_args()
diff --git a/setup.py b/setup.py
index 9d42f66..be35cc5 100644
--- a/setup.py
+++ b/setup.py
@@ -7,6 +7,10 @@ setupdir = Path(__file__).parent
proto_include = pkg_resources.resource_filename('grpc_tools', '_proto')
+compiled_proto = Path('at/tracker_pb2.py')
+if compiled_proto.exists():
+ compiled_proto.unlink()
+
grpc_tools.protoc.main([
'grpc_tools.protoc',
f'-I{setupdir!s}',
@@ -15,7 +19,7 @@ grpc_tools.protoc.main([
'at/tracker.proto'
])
-assert Path('at/tracker_pb2.py').exists()
+assert compiled_proto.exists()
setup(
name='hswaw-at',