Skip to content

Commit

Permalink
Add push_inventory() subtask
Browse files Browse the repository at this point in the history
Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
  • Loading branch information
Zack Cerza committed Sep 11, 2014
1 parent 33f8f08 commit 7806c6a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions teuthology/task/internal.py
Expand Up @@ -15,6 +15,7 @@
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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7806c6a

Please sign in to comment.