app: get_local_name set/from self attribute

This commit is contained in:
Frédéric Pierret (fepitre) 2019-10-20 19:20:40 +02:00
parent 40d9696b90
commit 8a27c1919f
No known key found for this signature in database
GPG Key ID: 484010B5CDC576E2

View File

@ -153,6 +153,8 @@ class QubesBase(qubesadmin.base.PropertyHolder):
log = None
#: do not check for object (VM, label etc) existence before really needed
blind_mode = False
#: local name
local_name = None
def __init__(self):
super(QubesBase, self).__init__(self, 'admin.property.', 'dom0')
@ -226,10 +228,12 @@ class QubesBase(qubesadmin.base.PropertyHolder):
""" Remove a storage pool """
self.qubesd_call('dom0', 'admin.pool.Remove', name, None)
@staticmethod
def get_local_name():
def get_local_name(self):
""" Get localhost name """
return os.uname()[1]
if not self.local_name:
self.local_name = os.uname()[1]
return self.local_name
def get_label(self, label):
"""Get label as identified by index or name