|
|
@ -31,6 +31,8 @@ import logging |
|
|
|
BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) |
|
|
|
BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) |
|
|
|
CONF_DIR = os.path.join(BASE_DIR, "conf") |
|
|
|
CONF_DIR = os.path.join(BASE_DIR, "conf") |
|
|
|
GLOBAL_EXPLORER_DIR = os.path.join(CONF_DIR, "explorer") |
|
|
|
GLOBAL_EXPLORER_DIR = os.path.join(CONF_DIR, "explorer") |
|
|
|
|
|
|
|
MANIFEST_DIR = os.path.join(CONF_DIR, "manifest") |
|
|
|
|
|
|
|
|
|
|
|
REMOTE_BASE_DIR = "/var/lib/cdist" |
|
|
|
REMOTE_BASE_DIR = "/var/lib/cdist" |
|
|
|
REMOTE_CONF_DIR = os.path.join(REMOTE_BASE_DIR, "conf") |
|
|
|
REMOTE_CONF_DIR = os.path.join(REMOTE_BASE_DIR, "conf") |
|
|
|
REMOTE_GLOBAL_EXPLORER_DIR = os.path.join(REMOTE_CONF_DIR, "explorer") |
|
|
|
REMOTE_GLOBAL_EXPLORER_DIR = os.path.join(REMOTE_CONF_DIR, "explorer") |
|
|
@ -63,7 +65,7 @@ class Cdist: |
|
|
|
"""Cdist main class to hold arbitrary data""" |
|
|
|
"""Cdist main class to hold arbitrary data""" |
|
|
|
version="2.0.0" |
|
|
|
version="2.0.0" |
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, hostname): |
|
|
|
def __init__(self, hostname, initial_manifest=False): |
|
|
|
self.hostname = hostname |
|
|
|
self.hostname = hostname |
|
|
|
|
|
|
|
|
|
|
|
# log.info("foobar") |
|
|
|
# log.info("foobar") |
|
|
@ -75,6 +77,12 @@ class Cdist: |
|
|
|
self.global_explorer_out_dir = os.path.join(self.out_dir, "explorer") |
|
|
|
self.global_explorer_out_dir = os.path.join(self.out_dir, "explorer") |
|
|
|
os.mkdir(self.global_explorer_out_dir) |
|
|
|
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): |
|
|
|
def cleanup(self): |
|
|
|
# Do not use in __del__: |
|
|
|
# Do not use in __del__: |
|
|
|
# http://docs.python.org/reference/datamodel.html#customization |
|
|
|
# http://docs.python.org/reference/datamodel.html#customization |
|
|
@ -157,11 +165,15 @@ class Cdist: |
|
|
|
# # Link configuraion source directory - consistent with remote |
|
|
|
# # Link configuraion source directory - consistent with remote |
|
|
|
# run_or_fail(["ln -sf", "$__cdist_conf_dir", "$__cdist_local_base_dir/$__cdist_name_conf_dir"]) |
|
|
|
# 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): |
|
|
|
def deploy_to(self): |
|
|
|
"""Mimic the old deploy to: Deploy to one host""" |
|
|
|
"""Mimic the old deploy to: Deploy to one host""" |
|
|
|
log.info("Deploying to host " + self.hostname) |
|
|
|
log.info("Deploying to host " + self.hostname) |
|
|
|
self.init_deploy() |
|
|
|
self.init_deploy() |
|
|
|
self.global_explore() |
|
|
|
self.global_explore() |
|
|
|
|
|
|
|
self.initial_manifest() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__": |
|
|
|
if __name__ == "__main__": |
|
|
|