From 78062de9e6b1658f7018b2f0cdf2193129a4faaa Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Wed, 24 Oct 2012 02:01:42 +0200 Subject: [PATCH] Make Paramiko an optional dependency for listrunner MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With the move away from βsetup-sshβ, Paramiko is no longer necessary to configure SSH on nodes. Signed-off-by: Michael Hanselmann <hansmi@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- INSTALL | 4 ++-- configure.ac | 7 ------- lib/ssh.py | 13 ------------- test/ganeti.ssh_unittest.py | 6 ------ tools/ganeti-listrunner | 9 ++++++++- 5 files changed, 10 insertions(+), 29 deletions(-) diff --git a/INSTALL b/INSTALL index 03e936323..0087e538b 100644 --- a/INSTALL +++ b/INSTALL @@ -41,8 +41,8 @@ Before installing, please verify that you have the following programs: python 2.4 (optional, used for node daemon memory locking) - `socat <http://www.dest-unreach.org/socat/>`_, see :ref:`note <socat-note>` below -- `Paramiko <http://www.lag.net/paramiko/>`_, if you want automated SSH - setup; optional otherwise but manual setup of the nodes required +- `Paramiko <http://www.lag.net/paramiko/>`_, if you want to use + ``ganeti-listrunner`` - `affinity Python module <http://pypi.python.org/pypi/affinity/0.1.0>`_, optional python package for supporting CPU pinning under KVM - `ElementTree Python module <http://effbot.org/zone/element-index.htm>`_, diff --git a/configure.ac b/configure.ac index da464152b..14554a3ac 100644 --- a/configure.ac +++ b/configure.ac @@ -663,14 +663,7 @@ AC_PYTHON_MODULE(pyparsing, t) AC_PYTHON_MODULE(pyinotify, t) AC_PYTHON_MODULE(pycurl, t) AC_PYTHON_MODULE(affinity) - -# This is optional but then we've limited functionality AC_PYTHON_MODULE(paramiko) -if test "$HAVE_PYMOD_PARAMIKO" = "no"; then - AC_MSG_WARN(m4_normalize([You do not have Paramiko installed. While this is - optional you have to configure SSH and the node - daemon on the joining nodes yourself.])) -fi AC_CONFIG_FILES([ Makefile ]) diff --git a/lib/ssh.py b/lib/ssh.py index 13071485d..dba13df4b 100644 --- a/lib/ssh.py +++ b/lib/ssh.py @@ -26,7 +26,6 @@ import os import logging -import re from ganeti import utils from ganeti import errors @@ -37,18 +36,6 @@ from ganeti import vcluster from ganeti import compat -def FormatParamikoFingerprint(fingerprint): - """Format paramiko PKey fingerprint. - - @type fingerprint: str - @param fingerprint: PKey fingerprint - @return: The string hex representation of the fingerprint - - """ - assert len(fingerprint) % 2 == 0 - return ":".join(re.findall(r"..", fingerprint.lower())) - - def GetUserFiles(user, mkdir=False, dircheck=True, kind=constants.SSHK_DSA, _homedir_fn=None): """Return the paths of a user's SSH files. diff --git a/test/ganeti.ssh_unittest.py b/test/ganeti.ssh_unittest.py index bb4f01530..a2c13cd14 100755 --- a/test/ganeti.ssh_unittest.py +++ b/test/ganeti.ssh_unittest.py @@ -49,12 +49,6 @@ class TestKnownHosts(testutils.GanetiTestCase): "%s ssh-rsa %s\n" % (cfg.GetClusterName(), mocks.FAKE_CLUSTER_KEY)) - def testFormatParamikoFingerprintCorrect(self): - self.assertEqual(ssh.FormatParamikoFingerprint("C0Ffee"), "c0:ff:ee") - - def testFormatParamikoFingerprintNotDividableByTwo(self): - self.assertRaises(AssertionError, ssh.FormatParamikoFingerprint, "C0Ffe") - class TestGetUserFiles(unittest.TestCase): def setUp(self): diff --git a/tools/ganeti-listrunner b/tools/ganeti-listrunner index 566d9860a..061d53b4a 100755 --- a/tools/ganeti-listrunner +++ b/tools/ganeti-listrunner @@ -64,7 +64,14 @@ import sys import time import traceback -import paramiko +try: + import paramiko +except ImportError: + print >> sys.stderr, \ + ("The \"paramiko\" module could not be imported. Install it from your" + " distribution's repository. The package is usually named" + " \"python-paramiko\".") + sys.exit(1) REMOTE_PATH_BASE = "/tmp/listrunner" -- GitLab