Kaynağa Gözat

utils: add name attribute to FakeDevice class.

When an error occurs trying to parse the dp values into the
matched entity, the error handling is throwing an exception
because it is trying to output a log message mentioning the
device name.  Provide a dummy name so it has something to
log.
Jason Rumney 2 yıl önce
ebeveyn
işleme
fbee20cbba
2 değiştirilmiş dosya ile 6 ekleme ve 0 silme
  1. 3 0
      util/config_match.py
  2. 3 0
      util/match_against.py

+ 3 - 0
util/config_match.py

@@ -12,6 +12,9 @@ class FakeDevice:
     def get_property(self, id):
     def get_property(self, id):
         return self._dps.get(id)
         return self._dps.get(id)
 
 
+    @property
+    def name(self):
+        return "cmdline"
 
 
 def main() -> int:
 def main() -> int:
     dps = json.loads(" ".join(sys.argv[1:]))
     dps = json.loads(" ".join(sys.argv[1:]))

+ 3 - 0
util/match_against.py

@@ -15,6 +15,9 @@ class FakeDevice:
     def get_property(self, id):
     def get_property(self, id):
         return self._dps.get(id)
         return self._dps.get(id)
 
 
+    @property
+    def name(self):
+        return "cmdline"
 
 
 def main() -> int:
 def main() -> int:
     dps = json.loads(" ".join(sys.argv[2:]))
     dps = json.loads(" ".join(sys.argv[2:]))