Esempio n. 1
0
 def execution_handler(*args, **kwargs):
     client = utils.Handler()
     client.rmdir(TEST_DIR)
     client.mkdir(TEST_DIR)
     sh.touch(TEST_FILE)
     func(*args, **kwargs)
     client.rmdir(TEST_DIR)
Esempio n. 2
0
def create_agent(package, download=False):
    dl_handler = retrieve.Handler()
    common = utils.Handler()
    py_handler = python.Handler()
    _prepare(package)
    py_handler.make_venv(package['sources_path'])
    if download:
        tar_file = '{0}/{1}.tar.gz'.format(
            package['sources_path'], package['name'])
        for url in package['source_urls']:
            dl_handler.download(url, file=tar_file)
        common.untar(package['sources_path'], tar_file)
        for module in package['modules']:
            py_handler.pip(module, package['sources_path'])
Esempio n. 3
0
def get_manager(download=False):
    package = get_conf('manager')

    dl_handler = retrieve.Handler()
    common = utils.Handler()
    py_handler = python.Handler()
    _prepare(package)
    py_handler.make_venv(package['sources_path'])
    tar_file = '{0}/{1}.tar.gz'.format(
        package['sources_path'], package['name'])
    for url in package['source_urls']:
        dl_handler.download(url, file=tar_file)
    common.untar(package['sources_path'], tar_file)

    common.mkdir(package['file_server_dir'])
    common.cp(package['resources_path'], package['file_server_dir'])
    if download:
        for module in package['modules']:
            py_handler.pip(module, package['sources_path'])
Esempio n. 4
0
def _prepare(package):

    common = utils.Handler()
    common.rmdir(package['sources_path'])
    common.mkdir('{0}/archives'.format(package['sources_path']))
    common.mkdir(package['package_path'])