]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
move ship_utilities to install task (from ceph test)
authorSage Weil <sage@redhat.com>
Sat, 19 Jul 2014 16:22:27 +0000 (09:22 -0700)
committerSage Weil <sage@redhat.com>
Sat, 19 Jul 2014 16:22:27 +0000 (09:22 -0700)
No need to install ceph just to get daemon-helper, adjust-ulimits, etc..
These utilities are used by lots of tasks, not just ceph.

Signed-off-by: Sage Weil <sage@redhat.com>
teuthology/task/ceph.py
teuthology/task/install.py

index 5944dbbe20a596638d140fb1430a38471fd45308..36f3e3be12988d3910dac79f5c3f47db68a74256 100644 (file)
@@ -236,74 +236,6 @@ def ceph_log(ctx, config):
         pass
 
 
-@contextlib.contextmanager
-def ship_utilities(ctx, config):
-    """
-    Write a copy of valgrind.supp to each of the remote sites.  Set executables used
-    by Ceph in /usr/local/bin.  When finished (upon exit of the teuthology run), remove
-    these files.
-
-    :param ctx: Context
-    :param config: Configuration
-    """
-    assert config is None
-    testdir = teuthology.get_testdir(ctx)
-    filenames = []
-
-    log.info('Shipping valgrind.supp...')
-    with file(os.path.join(os.path.dirname(__file__), 'valgrind.supp'), 'rb') as f:
-        fn = os.path.join(testdir, 'valgrind.supp')
-        filenames.append(fn)
-        for rem in ctx.cluster.remotes.iterkeys():
-            teuthology.sudo_write_file(
-                remote=rem,
-                path=fn,
-                data=f,
-                )
-            f.seek(0)
-
-    FILES = ['daemon-helper', 'adjust-ulimits', 'kcon_most']
-    destdir = '/usr/bin'
-    for filename in FILES:
-        log.info('Shipping %r...', filename)
-        src = os.path.join(os.path.dirname(__file__), filename)
-        dst = os.path.join(destdir, filename)
-        filenames.append(dst)
-        with file(src, 'rb') as f:
-            for rem in ctx.cluster.remotes.iterkeys():
-                teuthology.sudo_write_file(
-                    remote=rem,
-                    path=dst,
-                    data=f,
-                )
-                f.seek(0)
-                rem.run(
-                    args=[
-                        'sudo',
-                        'chmod',
-                        'a=rx',
-                        '--',
-                        dst,
-                    ],
-                )
-
-    try:
-        yield
-    finally:
-        log.info('Removing shipped files: %s...', ' '.join(filenames))
-        run.wait(
-            ctx.cluster.run(
-                args=[
-                    'sudo',
-                    'rm',
-                    '-f',
-                    '--',
-                ] + list(filenames),
-                wait=False,
-            ),
-        )
-
-
 def assign_devs(roles, devs):
     """
     Create a dictionary of devs indexed by roles
@@ -1480,7 +1412,6 @@ def task(ctx, config):
 
     with contextutil.nested(
         lambda: ceph_log(ctx=ctx, config=None),
-        lambda: ship_utilities(ctx=ctx, config=None),
         lambda: valgrind_post(ctx=ctx, config=config),
         lambda: cluster(ctx=ctx, config=dict(
                 conf=config.get('conf', {}),
index 9ef3e211eb802c323f959a47ed802b8a6ead711d..0aef437a05ee0d7bf959ce6648ab7f774b4b37ad 100644 (file)
@@ -1089,6 +1089,74 @@ def upgrade(ctx, config):
     yield
 
 
+@contextlib.contextmanager
+def ship_utilities(ctx, config):
+    """
+    Write a copy of valgrind.supp to each of the remote sites.  Set executables used
+    by Ceph in /usr/local/bin.  When finished (upon exit of the teuthology run), remove
+    these files.
+
+    :param ctx: Context
+    :param config: Configuration
+    """
+    assert config is None
+    testdir = teuthology.get_testdir(ctx)
+    filenames = []
+
+    log.info('Shipping valgrind.supp...')
+    with file(os.path.join(os.path.dirname(__file__), 'valgrind.supp'), 'rb') as f:
+        fn = os.path.join(testdir, 'valgrind.supp')
+        filenames.append(fn)
+        for rem in ctx.cluster.remotes.iterkeys():
+            teuthology.sudo_write_file(
+                remote=rem,
+                path=fn,
+                data=f,
+                )
+            f.seek(0)
+
+    FILES = ['daemon-helper', 'adjust-ulimits', 'kcon_most']
+    destdir = '/usr/bin'
+    for filename in FILES:
+        log.info('Shipping %r...', filename)
+        src = os.path.join(os.path.dirname(__file__), filename)
+        dst = os.path.join(destdir, filename)
+        filenames.append(dst)
+        with file(src, 'rb') as f:
+            for rem in ctx.cluster.remotes.iterkeys():
+                teuthology.sudo_write_file(
+                    remote=rem,
+                    path=dst,
+                    data=f,
+                )
+                f.seek(0)
+                rem.run(
+                    args=[
+                        'sudo',
+                        'chmod',
+                        'a=rx',
+                        '--',
+                        dst,
+                    ],
+                )
+
+    try:
+        yield
+    finally:
+        log.info('Removing shipped files: %s...', ' '.join(filenames))
+        run.wait(
+            ctx.cluster.run(
+                args=[
+                    'sudo',
+                    'rm',
+                    '-f',
+                    '--',
+                ] + list(filenames),
+                wait=False,
+            ),
+        )
+
+
 @contextlib.contextmanager
 def task(ctx, config):
     """
@@ -1160,5 +1228,6 @@ def task(ctx, config):
             wait_for_package=ctx.config.get('wait_for_package', False),
             project=project,
         )),
+        lambda: ship_utilities(ctx=ctx, config=None),
     ):
         yield