From 4e122d13c09119a9db7963dc1a350287e69f0524 Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Thu, 13 Aug 2015 08:22:49 -0400 Subject: [PATCH] [RM-11115] allow a list of callbacks when creating a connection Signed-off-by: Alfredo Deza --- ceph_deploy/hosts/__init__.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ceph_deploy/hosts/__init__.py b/ceph_deploy/hosts/__init__.py index 17aa99e..a5f9fcb 100644 --- a/ceph_deploy/hosts/__init__.py +++ b/ceph_deploy/hosts/__init__.py @@ -17,7 +17,8 @@ def get(hostname, username=None, fallback=None, detect_sudo=True, - use_rhceph=False): + use_rhceph=False, + callbacks=None): """ Retrieve the module that matches the distribution of a ``hostname``. This function will connect to that host and retrieve the distribution @@ -36,6 +37,10 @@ def get(hostname, :param use_rhceph: Whether or not to install RH Ceph on a RHEL machine or the community distro. Changes what host module is returned for RHEL. + :params callbacks: A list of callables that accept one argument (the actual + module that contains the connection) that will be + called, in order at the end of the instantiation of the + module. """ conn = get_connection( hostname, @@ -71,6 +76,10 @@ def get(hostname, module.machine_type = machine_type module.init = module.choose_init(module) module.packager = module.get_packager(module) + # execute each callback if any + if callbacks: + for c in callbacks: + c(module) return module -- 2.47.3