Эх сурвалжийг харах

app: get_local_name set/from self attribute

Frédéric Pierret (fepitre) 4 жил өмнө
parent
commit
8a27c1919f
1 өөрчлөгдсөн 7 нэмэгдсэн , 3 устгасан
  1. 7 3
      qubesadmin/app.py

+ 7 - 3
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