From 8a27c1919f6fc0051f0d5c95c470a5e282b1db70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Pierret=20=28fepitre=29?= Date: Sun, 20 Oct 2019 19:20:40 +0200 Subject: [PATCH] app: get_local_name set/from self attribute --- qubesadmin/app.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/qubesadmin/app.py b/qubesadmin/app.py index f512c38..9bfc5b3 100644 --- a/qubesadmin/app.py +++ b/qubesadmin/app.py @@ -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