From ddff3e8b571fd907e423ea8888c482eb1f4c05f6 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 11:55:29 +0200 Subject: [PATCH] support changing the initial manifest Signed-off-by: Nico Schottelius --- bin/cdist | 14 +++++++++++++- bin/cdist-deploy-to | 1 - 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/bin/cdist b/bin/cdist index d6421161..766a2acf 100755 --- a/bin/cdist +++ b/bin/cdist @@ -31,6 +31,8 @@ import logging BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) CONF_DIR = os.path.join(BASE_DIR, "conf") GLOBAL_EXPLORER_DIR = os.path.join(CONF_DIR, "explorer") +MANIFEST_DIR = os.path.join(CONF_DIR, "manifest") + REMOTE_BASE_DIR = "/var/lib/cdist" REMOTE_CONF_DIR = os.path.join(REMOTE_BASE_DIR, "conf") REMOTE_GLOBAL_EXPLORER_DIR = os.path.join(REMOTE_CONF_DIR, "explorer") @@ -63,7 +65,7 @@ class Cdist: """Cdist main class to hold arbitrary data""" version="2.0.0" - def __init__(self, hostname): + def __init__(self, hostname, initial_manifest=False): self.hostname = hostname # log.info("foobar") @@ -75,6 +77,12 @@ class Cdist: self.global_explorer_out_dir = os.path.join(self.out_dir, "explorer") os.mkdir(self.global_explorer_out_dir) + # Mostly static, but can be overwritten on user demand + if initial_manifest: + self.initial_manifest = initial_manifest + else: + self.initial_manifest = os.path.join(MANIFEST_DIR, "init") + def cleanup(self): # Do not use in __del__: # http://docs.python.org/reference/datamodel.html#customization @@ -157,11 +165,15 @@ class Cdist: # # Link configuraion source directory - consistent with remote # run_or_fail(["ln -sf", "$__cdist_conf_dir", "$__cdist_local_base_dir/$__cdist_name_conf_dir"]) + def initial_manifes(self): + """Run the initial manifest""" + def deploy_to(self): """Mimic the old deploy to: Deploy to one host""" log.info("Deploying to host " + self.hostname) self.init_deploy() self.global_explore() + self.initial_manifest() if __name__ == "__main__": diff --git a/bin/cdist-deploy-to b/bin/cdist-deploy-to index 84181bbd..79f42931 100755 --- a/bin/cdist-deploy-to +++ b/bin/cdist-deploy-to @@ -43,7 +43,6 @@ __cdist_echo info "cdist $__cdist_version: Configuring $__cdist_target_host " # See cdist-stages(7) # -cdist-explorer-run-global "$__cdist_target_host" cdist-manifest-run-init "$__cdist_target_host" cdist-object-all "$__cdist_target_host" cdist-object-prepare cdist-object-all "$__cdist_target_host" cdist-object-run