import os
import sys
import tempfile
-import yaml
from common.backenddb import BackendDB
from common.gerrit import get_gerrit_event
int(os.getenv('REDIS_PORT')))
return bdb.read_repos(file(config_file, 'r').read())
-def update_repos_conf_on_filesystem(path_to_new_repos_conf,
- path_to_repos_conf="/etc/repos/repos.yaml"):
- """
- Temporary solution before BOSS replaced
-
- Update the repos.yaml files on the filesystem, it request
- this job runs on the repos server
-
- Args:
- path_to_new_repos_conf (str): path to new repos.yaml file location
- path_to_repos_conf (str): the path of repos.yaml on repos server
- """
- with open(path_to_new_repos_conf, 'r') as repo_fh:
- repos = yaml.load(repo_fh)
- # add the prefix /srv/ for BOSS
- for repo in repos['Repositories']:
- if 'SnapshotDir' in repo:
- repo['SnapshotDir'] = os.path.join('/srv',
- repo['SnapshotDir'])
- with open(path_to_repos_conf, 'w') as repo_fh:
- repo_fh.write(yaml.dump(repos))
-
def main():
"""Script entry point.
"""
mygit = Git(prjdir)
mygit.checkout(event['newrev'])
- # updte repos.yaml on repos server
- update_repos_conf_on_filesystem(os.path.join(prjdir, 'repos.yaml'))
-
return load_repos(os.path.join(prjdir, 'repos.yaml'))
if __name__ == '__main__':