Skip to content

Commit 2ac2d7c

Browse files
committed
Add way how to support signature to dbus call
- If dbus method is called with empty array as an argument then dbus is not able to determine type of arguments and throws Error - This commit adds way how to add it in such case
1 parent 3e919cd commit 2ac2d7c

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

authconn.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,10 @@ def _make_binding (self, fname, fn):
233233

234234
def _authloop (self, fname, fn, *args, **kwds):
235235
self._passes = 0
236+
# remove signature if dbus is not being used and signature is provided
237+
if not self._using_polkit():
238+
kwds.pop('signature', None)
239+
236240
c = self._connection
237241
retry = False
238242
while True:

cupspk.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ def _get_cups_pk(self):
9999

100100
def _call_with_pk_and_fallback(self, use_fallback, pk_function_name, pk_args, fallback_function, *args, **kwds):
101101
pk_function = None
102+
# take signature from kwds if is provided
103+
dbus_args_signature = kwds.pop('signature', None)
102104

103105
if not use_fallback:
104106
cups_pk = self._get_cups_pk()
@@ -116,7 +118,7 @@ def _call_with_pk_and_fallback(self, use_fallback, pk_function_name, pk_args, fa
116118
while True:
117119
try:
118120
# FIXME: async call or not?
119-
pk_retval = pk_function(*pk_args)
121+
pk_retval = pk_function(*pk_args, signature = dbus_args_signature)
120122

121123
# if the PK call has more than one return values, we pop the
122124
# first one as the error message

troubleshoot/DeviceListed.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ def display (self):
8686
self.authconn = answers['_authenticated_connection']
8787
try:
8888
self.op = TimedOperation (self.authconn.getDevices,
89+
kwargs={'signature': 'iiasas'},
8990
parent=parent)
9091
devices = self.op.run ()
9192
devices_list = []

0 commit comments

Comments
 (0)