From 3ec10f0d0da2fbf68657bf9a32220fe19cb4717f Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Thu, 26 Apr 2012 16:56:58 +0200
Subject: [PATCH] Silence Paramiko deprecation warnings

This works around a problem in Paramiko, but which looks like it's a
Ganeti problem:

[cluster] root@node4:~# gnt-node add --readd node3
/usr/lib/python2.6/dist-packages/Crypto/Util/randpool.py:40:
RandomPool_DeprecationWarning: This application uses RandomPool, which
is BROKEN in older releases.  See http://www.pycrypto.org/randpool-broken
  RandomPool_DeprecationWarning)

To silence this, we do an ugly thing (since Python 2.4 doesn't support
context managers): manually reset the warnings filter, which resets
any -W command line flags (hopefully noone calls this tool manually so
often).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
---
 tools/setup-ssh | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tools/setup-ssh b/tools/setup-ssh
index 8c406ce93..50b7b7bb7 100755
--- a/tools/setup-ssh
+++ b/tools/setup-ssh
@@ -29,11 +29,17 @@ This is needed before we can join the node into the cluster.
 
 import getpass
 import logging
-import paramiko
 import os.path
 import optparse
 import sys
 
+# workaround paramiko warnings
+# FIXME: use 'with warnings.catch_warnings' once we drop Python 2.4
+import warnings
+warnings.simplefilter("ignore")
+import paramiko
+warnings.resetwarnings()
+
 from ganeti import cli
 from ganeti import constants
 from ganeti import errors
-- 
GitLab