forked from ungleich-public/cdist
transfer_dir() added
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
parent
09c58e2327
commit
6e3c228a6f
1 changed files with 10 additions and 1 deletions
11
bin/cdist
11
bin/cdist
|
@ -36,6 +36,7 @@ def exit_error(*args):
|
|||
|
||||
def run_or_fail(*args):
|
||||
newargs = ["echo"]
|
||||
newargs = []
|
||||
newargs.extend(*args)
|
||||
|
||||
try:
|
||||
|
@ -49,6 +50,8 @@ def remote_run_or_fail(hostname, *args):
|
|||
|
||||
run_or_fail(newargs)
|
||||
|
||||
def transfer_dir(hostname, source, destination):
|
||||
run_or_fail(["scp", "-r", source, hostname + ":" + destination])
|
||||
|
||||
def base_directory():
|
||||
"""Returns the directory in which all cdist stuff is based in"""
|
||||
|
@ -64,17 +67,23 @@ def global_explorer_directory():
|
|||
"""Returns path to directory containing the global explorers"""
|
||||
return os.path.join(conf_directory(), "explorer")
|
||||
|
||||
def remote_global_explorer_directory():
|
||||
"""Returns path to directory containing the global explorers"""
|
||||
return os.path.join(conf_directory(), "explorer")
|
||||
|
||||
def list_global_explorers():
|
||||
"""Return list of available explorers"""
|
||||
return os.listdir(global_explorer_directory())
|
||||
|
||||
def transfer_global_explorers(hostname):
|
||||
transfer_dir(hostname, global_explorer_directory(), remote_global_explorer_directory())
|
||||
|
||||
def global_explore(hostname):
|
||||
"""Run global explorers"""
|
||||
explorer = list_global_explorers()
|
||||
if(len(explorer) == 0):
|
||||
exit_error("No explorers found in", global_explorer_directory())
|
||||
|
||||
|
||||
def init_deploy(hostname):
|
||||
logger("info", "Creating clean directory structure")
|
||||
|
||||
|
|
Loading…
Reference in a new issue