[PATCH 5/9] move vncpassword handling into anaconda; remove recoverVNCPassword

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

 



loader was writing the vncpassword out to a file, because:

  a) many years ago, VNC got started by loader, and
  b) VNC used to need to read its password from a file.

But now it is the Glorious Future and anaconda can just read the
'vncpassword' boot/cmdline arg and hand it to the VncServer object.

This also removes recoverVNCPassword and pw_init_file from the VncServer
class, and the tests associated with them.
---
 anaconda                          |    3 ++-
 pyanaconda/vnc.py                 |   19 +------------------
 tests/pyanaconda_test/vnc_test.py |   17 -----------------
 3 files changed, 3 insertions(+), 36 deletions(-)

diff --git a/anaconda b/anaconda
index f236397..0094ef9 100755
--- a/anaconda
+++ b/anaconda
@@ -229,6 +229,7 @@ def parseOptions(argv = None):
     op.add_option("--virtpconsole")
     op.add_option("--vnc", action="store_true", default=False)
     op.add_option("--vncconnect")
+    op.add_option("--vncpassword", default="")
     op.add_option("--xdriver", dest="xdriver", action="store", type="string", default=None)
 
     # Language
@@ -426,7 +427,7 @@ def setupDisplay(anaconda, opts):
     if opts.vnc:
         flags.usevnc = 1
         anaconda.displayMode = 'g'
-        vncS.recoverVNCPassword()
+        vncS.password = opts.vncpassword
 
         # Only consider vncconnect when vnc is a param
         if opts.vncconnect:
diff --git a/pyanaconda/vnc.py b/pyanaconda/vnc.py
index 47e42eb..784d5f7 100644
--- a/pyanaconda/vnc.py
+++ b/pyanaconda/vnc.py
@@ -44,7 +44,7 @@ class VncServer:
     def __init__(self, display="1", root="/", ip=None, name=None,
                 desktop="Desktop", password="", vncconnecthost="",
                 vncconnectport="", log_file="/tmp/vncserver.log",
-                pw_file="/tmp/vncpassword", pw_init_file="/tmp/vncpassword.dat"):
+                pw_file="/tmp/vncpassword"):
         self.display = display
         self.root = root
         self.ip = ip
@@ -55,27 +55,10 @@ class VncServer:
         self.vncconnectport = vncconnectport
         self.log_file = log_file
         self.pw_file = pw_file
-        self.pw_init_file = pw_init_file
         self.connxinfo = None
         self.anaconda = None
         self.log = logging.getLogger("anaconda.stdout")
 
-    def recoverVNCPassword(self):
-        """Rescue the vncpassword from where loader left it 
-
-        We are not to check for validity yet, if there is a file
-        pass it to the variable, if there is not, set the var 
-        to ''. We will check valididty later.
-        """
-        # see if there is a vnc password file
-        try:
-            pfile = open(self.pw_init_file, "r")
-            self.password=pfile.readline().strip()
-            pfile.close()
-            os.unlink(self.pw_init_file)
-        except (OSError, IOError):
-            self.password=""
-
     def setVNCPassword(self):
         """Set the vnc server password. Output to file. """
 
diff --git a/tests/pyanaconda_test/vnc_test.py b/tests/pyanaconda_test/vnc_test.py
index 45b79e2..8b703c8 100644
--- a/tests/pyanaconda_test/vnc_test.py
+++ b/tests/pyanaconda_test/vnc_test.py
@@ -27,29 +27,12 @@ class VncTest(mock.TestCase):
         self.DESKTOP = 'Desktop'
         self.PASS = ''
         self.LOG_FILE = '/tmp/vnc.log'
-        self.PW_INIT_FILE = '/tmp/vncpassword.dat'
         self.PW_FILE = '/tmp/vncpassword'
         self.VNCCONNECTHOST = 'host'
 
     def tearDown(self):
         self.tearDownModules()
 
-    def recover_vnc_password_1_test(self):
-        import pyanaconda.vnc
-        pyanaconda.vnc.open = mock.Mock(side_effect=IOError())
-
-        server = pyanaconda.vnc.VncServer()
-        server.recoverVNCPassword()
-        self.assertEqual(server.password, '')
-
-    def recover_vnc_password_2_test(self):
-        import pyanaconda.vnc
-        self.fs.open(self.PW_INIT_FILE, 'w').write('abcdef')
-
-        server = pyanaconda.vnc.VncServer(pw_init_file=self.PW_INIT_FILE)
-        server.recoverVNCPassword()
-        self.assertEqual(server.password, 'abcdef')
-
     def set_vnc_password_1_test(self):
         import pyanaconda.vnc
         server = pyanaconda.vnc.VncServer()
-- 
1.7.7.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux