<html><head></head><body><div class="ydpfa47bfeayahoo-style-wrap" style="font-family: lucida console, sans-serif; font-size: 16px;"><div dir="ltr" data-setdir="false">My host service is as below:</div><div dir="ltr" data-setdir="false"><br><div><div>root@sonic:/tmp# busctl introspect org.SONiC.HostService.keyhandler /org/SONiC/HostService/keyhandler</div><div>NAME TYPE SIGNATURE RESULT/VALUE FLAGS</div><div>org.SONiC.HostService.keyhandler interface - - -</div><div>.key_ctl method as is -</div><div>org.freedesktop.DBus.Introspectable interface - - -</div><div>.Introspect method - s -</div><div>root@sonic:/tmp# </div><div><br></div></div><br><br>When I try to connect and execute a method, I am getting <span><span style="color: rgb(0, 0, 0); font-family: lucida console, sans-serif; font-size: 16px;">UnknownMethodException</span></span></div><div dir="ltr" data-setdir="false"><br><div><div dir="ltr" data-setdir="false">My client code is as below:</div><div dir="ltr" data-setdir="false">=========================================================================</div><div>import dbus<br></div><div>import sys</div><div><br></div><div>class HostQuery:</div><div> def __init__(self):</div><div> try:</div><div> self._bus = dbus.SystemBus()</div><div> self._proxy = self._bus.get_object('org.SONiC.HostService',"/org/SONiC/HostService")</div><div> except Exception as e:<br></div><div> msg = "Failed to connect.\nException :'{}'".format(str(e))</div><div> print(msg, file=sys.stderr)</div><div> sys.exit(1)</div><div><br></div><div> def action(self, path, values):</div><div> print("in hostquery action")</div><div> res = path.split('.')</div><div> print("res is {}".format(res))</div><div> intf = dbus.Interface(self._proxy, dbus_interface=('org.SONiC.HostService.'+res[0]))</div><div> print(intf.getProperties())</div><div> ret = intf.key_ctl(values)</div><div> print("ret is {}".format(ret))</div><div> return ret</div><div><br></div><div>ut = HostQuery()</div><div>ut.action("keyhandler.key_ctl", ["pwEncrypt", "test"])</div><div>==============================================================================================</div><div><br></div><div dir="ltr" data-setdir="false">Logs shows as below:<br><div><div>root@sonic:/tmp# python3 hostcomm.py </div><div>in hostquery action</div><div>res is ['keyhandler', 'key_ctl']</div><div>Traceback (most recent call last):</div><div> File "hostcomm.py", line 27, in <module></div><div> ut.action("keyhandler.key_ctl", ["pwEncrypt", "test"])</div><div> File "hostcomm.py", line 22, in action</div><div> ret = intf.key_ctl(values)</div><div> File "/usr/local/lib/python3.7/dist-packages/dbus/proxies.py", line 72, in __call__</div><div> return self._proxy_method(*args, **keywords)</div><div> File "/usr/local/lib/python3.7/dist-packages/dbus/proxies.py", line 147, in __call__</div><div> **keywords)</div><div> File "/usr/local/lib/python3.7/dist-packages/dbus/connection.py", line 653, in call_blocking</div><div> message, timeout)</div><div>dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod: Traceback (most recent call last):</div><div> File "/usr/local/lib/python3.7/dist-packages/dbus/service.py", line 658, in _message_cb</div><div> (candidate_method, parent_method) = _method_lookup(self, method_name, interface_name)</div><div> File "/usr/local/lib/python3.7/dist-packages/dbus/service.py", line 248, in _method_lookup</div><div> raise UnknownMethodException('%s is not a valid method of interface %s' % (method_name, dbus_interface))</div><div>dbus.exceptions.UnknownMethodException: org.freedesktop.DBus.Error.UnknownMethod: Unknown method: key_ctl is not a valid method of interface org.SONiC.HostService.keyhandler</div><div><br></div></div><br>Even getProperties() fails.</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">Any idea what is wrong here?<br><br><br></div></div></div><div><br></div><div class="ydpfa47bfeasignature"><div style="font-family:sans-serif;font-size:16px;"><div style="font-family:sans-serif;font-size:16px;" dir="ltr"><span><span style="color:rgb(0, 0, 0);font-family:sans-serif;font-size:16px;">~~ Thanks, Srinadh</span></span></div><div style="font-family:sans-serif;font-size:16px;"><div><br></div><div><br></div></div></div></div></div></body></html>