qubes.vm.__init__ Fix pylint warnings
This commit is contained in:
parent
f318871279
commit
77d54b55ad
@ -120,6 +120,7 @@ class Features(dict):
|
|||||||
#
|
#
|
||||||
|
|
||||||
_NO_DEFAULT = object()
|
_NO_DEFAULT = object()
|
||||||
|
|
||||||
def check_with_template(self, feature, default=_NO_DEFAULT):
|
def check_with_template(self, feature, default=_NO_DEFAULT):
|
||||||
if feature in self:
|
if feature in self:
|
||||||
return self[feature]
|
return self[feature]
|
||||||
@ -200,7 +201,7 @@ class BaseVM(qubes.PropertyHolder):
|
|||||||
|
|
||||||
for node in self.xml.xpath('./properties/property'):
|
for node in self.xml.xpath('./properties/property'):
|
||||||
name = node.get('name')
|
name = node.get('name')
|
||||||
if not name in all_names:
|
if name not in all_names:
|
||||||
raise TypeError(
|
raise TypeError(
|
||||||
'property {!r} not applicable to {!r}'.format(
|
'property {!r} not applicable to {!r}'.format(
|
||||||
name, self.__class__.__name__))
|
name, self.__class__.__name__))
|
||||||
@ -211,12 +212,10 @@ class BaseVM(qubes.PropertyHolder):
|
|||||||
if hasattr(self, 'name'):
|
if hasattr(self, 'name'):
|
||||||
self.init_log()
|
self.init_log()
|
||||||
|
|
||||||
|
|
||||||
def init_log(self):
|
def init_log(self):
|
||||||
'''Initialise logger for this domain.'''
|
'''Initialise logger for this domain.'''
|
||||||
self.log = qubes.log.get_vm_logger(self.name)
|
self.log = qubes.log.get_vm_logger(self.name)
|
||||||
|
|
||||||
|
|
||||||
def __xml__(self):
|
def __xml__(self):
|
||||||
element = lxml.etree.Element('domain')
|
element = lxml.etree.Element('domain')
|
||||||
element.set('id', 'domain-' + str(self.qid))
|
element.set('id', 'domain-' + str(self.qid))
|
||||||
@ -352,7 +351,7 @@ class BaseVM(qubes.PropertyHolder):
|
|||||||
tree.write(fd, encoding="UTF-8", pretty_print=True)
|
tree.write(fd, encoding="UTF-8", pretty_print=True)
|
||||||
fd.close()
|
fd.close()
|
||||||
os.umask(old_umask)
|
os.umask(old_umask)
|
||||||
except EnvironmentError as err: # pylint: disable=broad-except
|
except EnvironmentError as err: # pylint: disable=broad-except
|
||||||
print >> sys.stderr, "{0}: save error: {1}".format(
|
print >> sys.stderr, "{0}: save error: {1}".format(
|
||||||
os.path.basename(sys.argv[0]), err)
|
os.path.basename(sys.argv[0]), err)
|
||||||
return False
|
return False
|
||||||
@ -445,7 +444,7 @@ class BaseVM(qubes.PropertyHolder):
|
|||||||
|
|
||||||
conf["rules"].append(rule)
|
conf["rules"].append(rule)
|
||||||
|
|
||||||
except EnvironmentError as err: # pylint: disable=broad-except
|
except EnvironmentError as err: # pylint: disable=broad-except
|
||||||
# problem accessing file, like ENOTFOUND, EPERM or sth
|
# problem accessing file, like ENOTFOUND, EPERM or sth
|
||||||
# return default config
|
# return default config
|
||||||
return conf
|
return conf
|
||||||
@ -492,7 +491,6 @@ class VMProperty(qubes.property):
|
|||||||
self.vmclass = vmclass
|
self.vmclass = vmclass
|
||||||
self.allow_none = allow_none
|
self.allow_none = allow_none
|
||||||
|
|
||||||
|
|
||||||
def __set__(self, instance, value):
|
def __set__(self, instance, value):
|
||||||
if value is self.__class__.DEFAULT:
|
if value is self.__class__.DEFAULT:
|
||||||
self.__delete__(instance)
|
self.__delete__(instance)
|
||||||
|
Loading…
Reference in New Issue
Block a user