diff options
| author | bozo.kopic <bozo.kopic@gmail.com> | 2017-08-18 15:24:16 +0200 |
|---|---|---|
| committer | bozo.kopic <bozo.kopic@gmail.com> | 2017-08-18 15:24:16 +0200 |
| commit | 6424cbc7cef9185564c5e3574575b4a5e617b9cb (patch) | |
| tree | 82b04cc2e3344a9743d67acf9fce4c6be6e005f5 /src_py/hatter/executor.py | |
| parent | 6e52ded7a8c4e49102f7a10a942f65e4490ea3bd (diff) | |
documentation
Diffstat (limited to 'src_py/hatter/executor.py')
| -rw-r--r-- | src_py/hatter/executor.py | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src_py/hatter/executor.py b/src_py/hatter/executor.py index 271d60d..2d1ae2a 100644 --- a/src_py/hatter/executor.py +++ b/src_py/hatter/executor.py @@ -23,20 +23,21 @@ def run(log, repo_path, commit='HEAD', archive_name='hatter_archive'): _git_archive(repo_path, commit, archive_path) log.info('loading project configuration') conf = _load_conf(archive_path) - log.info('starting virtual machine') - with contextlib.closing(_VM(conf['vm'])) as vm: - log.info('creating SSH connection') - with contextlib.closing(_SSH(conf['ssh'], vm.address)) as ssh: - log.info('transfering repository to virtual machine') - ssh.execute('rm -rf {} {}'.format(archive_file_name, - archive_name)) - ssh.upload(archive_path, archive_file_name) - ssh.execute('mkdir {}'.format(archive_name)) - ssh.execute('tar xf {} -C {}'.format(archive_file_name, - archive_name)) - log.info('executing scripts') - for script in conf['scripts']: - ssh.execute(script, archive_name, log) + for i in conf: + log.info('starting virtual machine') + with contextlib.closing(_VM(i['vm'])) as vm: + log.info('creating SSH connection') + with contextlib.closing(_SSH(i['ssh'], vm.address)) as ssh: + log.info('transfering repository to virtual machine') + ssh.execute('rm -rf {} {}'.format(archive_file_name, + archive_name)) + ssh.upload(archive_path, archive_file_name) + ssh.execute('mkdir {}'.format(archive_name)) + ssh.execute('tar xf {} -C {}'.format(archive_file_name, + archive_name)) + log.info('executing scripts') + for script in i['scripts']: + ssh.execute(script, archive_name, log) t_end = time.monotonic() log.info('executor finished (duration: {}s)'.format(t_end - t_begin)) |
