← Back to team overview

yellow team mailing list archive

[Merge] lp:~frankban/lpsetup/urandom-hack into lp:lpsetup

 

Francesco Banconi has proposed merging lp:~frankban/lpsetup/urandom-hack into lp:lpsetup.

Requested reviews:
  Launchpad Yellow Squad (yellow)

For more details, see:
https://code.launchpad.net/~frankban/lpsetup/urandom-hack/+merge/101347

Added the random/urandom hack (ported from setuplxc).
-- 
https://code.launchpad.net/~frankban/lpsetup/urandom-hack/+merge/101347
Your team Launchpad Yellow Squad is requested to review the proposed merge of lp:~frankban/lpsetup/urandom-hack into lp:lpsetup.
=== modified file 'lpsetup/subcommands/install.py'
--- lpsetup/subcommands/install.py	2012-03-30 10:52:41 +0000
+++ lpsetup/subcommands/install.py	2012-04-10 09:27:39 +0000
@@ -114,7 +114,7 @@
 
 def initialize(
     user, full_name, email, lpuser, private_key, public_key, valid_ssh_keys,
-    ssh_key_path, dependencies_dir, directory):
+    ssh_key_path, use_urandom, dependencies_dir, directory):
     """Initialize host machine."""
     # Install necessary deb packages.  This requires Oneiric or later.
     call('apt-get', 'update')
@@ -165,6 +165,12 @@
         for line in lines:
             location = line.format(checkout_dir=checkout_dir, lpuser=lpuser)
             file_append(bzr_locations, location)
+    # rng-tools is used to set /dev/urandom as random data source, avoiding
+    # entropy exhaustion during automated parallel tests.
+    if use_urandom:
+        apt_get_install('rng-tools', caller=call)
+        file_append('/etc/default/rng-tools', 'HRNGDEVICE=/dev/urandom')
+        call('/etc/init.d/rng-tools', 'start')
 
 
 def setup_apt(no_repositories=True):
@@ -218,7 +224,7 @@
         (initialize,
          'user', 'full_name', 'email', 'lpuser',
          'private_key', 'public_key', 'valid_ssh_keys', 'ssh_key_path',
-         'dependencies_dir', 'directory'),
+         'use_urandom', 'dependencies_dir', 'directory'),
         (setup_apt,
          'no_repositories'),
         (setup_launchpad,
@@ -289,3 +295,7 @@
         parser.add_argument(
             '-N', '--no-repositories', action='store_true',
             help='Do not add APT repositories.')
+        parser.add_argument(
+            '-U', '--use-urandom', action='store_true',
+            help='Use /dev/urandom to feed /dev/random and avoid '
+                 'entropy exhaustion.')

=== modified file 'lpsetup/subcommands/lxcinstall.py'
--- lpsetup/subcommands/lxcinstall.py	2012-03-30 16:52:14 +0000
+++ lpsetup/subcommands/lxcinstall.py	2012-04-10 09:27:39 +0000
@@ -158,7 +158,7 @@
         (install.initialize,
          'user', 'full_name', 'email', 'lpuser',
          'private_key', 'public_key', 'valid_ssh_keys', 'ssh_key_path',
-         'dependencies_dir', 'directory'),
+         'use_urandom', 'dependencies_dir', 'directory'),
         (create_lxc,
          'user', 'lxc_name', 'lxc_arch', 'lxc_os'),
         (start_lxc,