[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH] Add a method to cmdline.py:InstallInterface to handle missing attrs.



The presence of this method means that we no longer need to add methods to
the cmdline interface that just sleep, as missing methods will map to
__getattr__ and sleep there.
---
 cmdline.py |   46 +++++++++++-----------------------------------
 1 files changed, 11 insertions(+), 35 deletions(-)

diff --git a/cmdline.py b/cmdline.py
index 700e741..348fea7 100644
--- a/cmdline.py
+++ b/cmdline.py
@@ -67,6 +67,17 @@ class InstallInterface:
 #        signal.signal(signal.SIGINT, signal.SIG_IGN)
         signal.signal(signal.SIGTSTP, signal.SIG_DFL)
 
+    def __getattr__(self, attr):
+        # This method is called if "attr" does not exist in this class.  It's
+        # useful for catching calls to methods that other InstallInterface
+        # classes have but cmdline mode does not.
+        print(_("Can't have a question in command line mode!"))
+        print("(%s)" % attr)
+
+        # don't exit
+        while True:
+            time.sleep(5)
+
     def __del__(self):
         pass
 
@@ -113,47 +124,12 @@ class InstallInterface:
         self.messageWindow(title, text, type=type, default=default,
                            custom_buttons=custom_buttons, custom_icon=custom_icon)
 
-    def passphraseEntryWindow(self, device):
-        print(_("Can't have a question in command line mode!"))
-        print("(passphraseEntryWindow: '%s')" % device)
-        # don't exit
-        while 1:
-            time.sleep(5)
-
-    def getLUKSPassphrase(self, passphrase = "", isglobal = False):
-        print(_("Can't have a question in command line mode!"))
-        print("(getLUKSPassphrase)")
-        # don't exit
-        while 1:
-            time.sleep(5)
-
-    def enableNetwork(self):
-        print(_("Can't have a question in command line mode!"))
-        print("(enableNetwork)")
-        # don't exit
-        while 1:
-            time.sleep(5)
-
     def resetInitializeDiskQuestion(self):
         pass
 
-    def questionInitializeDisk(self, path, description, size, details=""):
-        print(_("Can't have a question in command line mode!"))
-        print("(questionInitializeDisk)")
-        # don't exit
-        while 1:
-            time.sleep(5)
-
     def resetReinitInconsistentLVMQuestion(self):
         pass
 
-    def questionReinitInconsistentLVM(self, pv_names=None, lv_name=None, vg_name=None):
-        print(_("Can't have a question in command line mode!"))
-        print("(questionReinitInconsistentLVM)")
-        # don't exit
-        while 1:
-            time.sleep(5)
-
     def mainExceptionWindow(self, shortText, longTextFile):
         print(shortText)
 
-- 
1.6.5.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]