From: Zack Cerza Date: Mon, 8 Sep 2014 19:13:31 +0000 (-0600) Subject: Add push_inventory() subtask X-Git-Tag: 1.1.0~1171 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=7806c6ae21af6ac8df88a1e2d3c6ccd630b9ef6b;p=teuthology.git Add push_inventory() subtask Signed-off-by: Zack Cerza --- diff --git a/teuthology/task/internal.py b/teuthology/task/internal.py index cb0b41ce0d..459740c469 100644 --- a/teuthology/task/internal.py +++ b/teuthology/task/internal.py @@ -15,6 +15,7 @@ from teuthology import lockstatus from teuthology import lock from teuthology import misc from teuthology import provision +from teuthology.config import config as teuth_config from teuthology.parallel import parallel from ..orchestra import cluster, remote, run @@ -227,6 +228,23 @@ def connect(ctx, config): ctx.cluster.add(rem, rem.name) +@contextlib.contextmanager +def push_inventory(ctx, config): + if not teuth_config.lock_server: + yield + return + + def push(): + for rem in ctx.cluster.remotes.keys(): + info = rem.inventory_info + lock.update_inventory(info) + try: + push() + yield + except Exception: + log.exception("Error pushing inventory") + + def serialize_remote_roles(ctx, config): """ Provides an explicit mapping for which remotes have been assigned what roles