mgmt: drop ProtocolRepr

Since we've added type= argument to property.Get format, it isn't
useful anymore.

QubesOS/qubes-issues#2622
This commit is contained in:
Marek Marczykowski-Górecki 2017-03-16 20:29:13 +01:00
parent d21f54887d
commit f93674de1a
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -23,7 +23,6 @@ Qubes OS Management API
''' '''
import asyncio import asyncio
import reprlib
import string import string
import functools import functools
@ -32,26 +31,6 @@ import qubes.vm.qubesvm
import qubes.storage import qubes.storage
class ProtocolRepr(reprlib.Repr):
def repr1(self, x, level):
if isinstance(x, qubes.vm.qubesvm.QubesVM):
x = x.name
return super().repr1(x, level)
# pylint: disable=invalid-name
def repr_str(self, x, level):
'''Warning: this is incompatible with python 3 wrt to b'' '''
return "'{}'".format(''.join(
chr(c)
if 0x20 < c < 0x7f and c not in (ord("'"), ord('\\'))
else '\\x{:02x}'.format(c)
for c in x.encode()))
def repr_Label(self, x, level):
return self.repr1(x.name, level)
class ProtocolError(AssertionError): class ProtocolError(AssertionError):
'''Raised when something is wrong with data received''' '''Raised when something is wrong with data received'''
pass pass
@ -65,6 +44,7 @@ def not_in_api(func):
func.not_in_api = True func.not_in_api = True
return func return func
def no_payload(func): def no_payload(func):
@functools.wraps(func) @functools.wraps(func)
def wrapper(self, untrusted_payload): def wrapper(self, untrusted_payload):
@ -73,6 +53,7 @@ def no_payload(func):
return func(self) return func(self)
return wrapper return wrapper
class QubesMgmt(object): class QubesMgmt(object):
def __init__(self, app, src, method, dest, arg): def __init__(self, app, src, method, dest, arg):
self.app = app self.app = app
@ -81,8 +62,6 @@ class QubesMgmt(object):
self.dest = self.app.domains[dest.decode('ascii')] self.dest = self.app.domains[dest.decode('ascii')]
self.arg = arg.decode('ascii') self.arg = arg.decode('ascii')
self.prepr = ProtocolRepr()
self.method = method.decode('ascii') self.method = method.decode('ascii')
untrusted_func_name = self.method untrusted_func_name = self.method
@ -132,9 +111,6 @@ class QubesMgmt(object):
iterable = filter(selector, iterable) iterable = filter(selector, iterable)
return iterable return iterable
@not_in_api
def repr(self, *args, **kwargs):
return self.prepr.repr(*args, **kwargs)
# #
# ACTUAL RPC CALLS # ACTUAL RPC CALLS