def install(self): LOG.info('Installing Tempest') src_dir = '/opt/tempest' if os.path.exists(src_dir): cmd = ['git fetch --all', 'git reset --hard origin/master'] run_cmd('; '.join(cmd), cwd=src_dir) else: src_url = 'https://github.com/openstack/tempest.git' run_cmd('git clone {0} {1}'.format(src_url, src_dir)) touch('/var/log/tempest', 'tempest.log')
def populate_config(self): LOG.info('Building configuration file') template = os.path.join(os.path.dirname(__file__), 'files/tempest.conf.example') with open(template, 'r') as fp: sample = fp.read() self.config = Template(sample).render( admin=self.admin, guests=self.guests, endpoints=self.endpoints, images=self.images, network=self.network, router=self.router) config_path = touch('/etc/tempest', 'tempest.conf') with open(config_path, 'w') as fp: fp.write(self.config)