Merge "Add a command to generate configs for hound"
This commit is contained in:
commit
6ac1fc84d7
|
@ -0,0 +1,59 @@
|
||||||
|
#! /usr/bin/env python
|
||||||
|
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
#
|
||||||
|
# create_hound_config.py reads the project config file called projects.yaml
|
||||||
|
# and generates a hound configuration file.
|
||||||
|
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
|
||||||
|
import jeepyb.utils as u
|
||||||
|
|
||||||
|
|
||||||
|
PROJECTS_YAML = os.environ.get('PROJECTS_YAML', '/home/hound/projects.yaml')
|
||||||
|
GIT_SERVER = os.environ.get('GIT_BASE', 'git.openstack.org')
|
||||||
|
DATA_PATH = os.environ.get('DATA_PATH', 'data')
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
registry = u.ProjectsRegistry(PROJECTS_YAML)
|
||||||
|
projects = [entry['project'] for entry in registry.configs_list]
|
||||||
|
repos = {}
|
||||||
|
for project in projects:
|
||||||
|
repos[os.path.basename(project)] = {
|
||||||
|
'url': "git://%(gitbase)s/%(project)s" % dict(
|
||||||
|
gitbase=GIT_SERVER, project=project),
|
||||||
|
'url-pattern': {
|
||||||
|
'base-url': "http://%(gitbase)s/cgit/%(project)s"
|
||||||
|
"/tree/{path}{anchor}" % dict(gitbase=GIT_SERVER,
|
||||||
|
project=project),
|
||||||
|
'anchor': '#n{line}',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
config = {
|
||||||
|
"dbpath": "data",
|
||||||
|
"repos": repos
|
||||||
|
}
|
||||||
|
with open('config.json', 'w') as config_file:
|
||||||
|
config_file.write(
|
||||||
|
json.dumps(
|
||||||
|
config, indent=2,
|
||||||
|
separators=(',', ': '), sort_keys=False,
|
||||||
|
default=unicode))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
|
@ -20,6 +20,7 @@ classifier =
|
||||||
console_scripts =
|
console_scripts =
|
||||||
close-pull-requests = jeepyb.cmd.close_pull_requests:main
|
close-pull-requests = jeepyb.cmd.close_pull_requests:main
|
||||||
create-cgitrepos = jeepyb.cmd.create_cgitrepos:main
|
create-cgitrepos = jeepyb.cmd.create_cgitrepos:main
|
||||||
|
create-hound-config = jeepyb.cmd.create_hound_config:main
|
||||||
expire-old-reviews = jeepyb.cmd.expire_old_reviews:main
|
expire-old-reviews = jeepyb.cmd.expire_old_reviews:main
|
||||||
manage-projects = jeepyb.cmd.manage_projects:main
|
manage-projects = jeepyb.cmd.manage_projects:main
|
||||||
notify-impact = jeepyb.cmd.notify_impact:main
|
notify-impact = jeepyb.cmd.notify_impact:main
|
||||||
|
|
Loading…
Reference in New Issue