From cf03da2d2ba679c291f4e1bba3b8bbfdbbdcfdfa Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Sun, 4 Nov 2012 22:20:36 +0100 Subject: [PATCH] Attempt to more fully manage project creation. Manage project creation via yaml files. Also, Modify the manage_projects scripts to configure Gerrit project ACLs. This change expects the project yaml to exist. The change will clone the project for the localhost Gerrit install. It will then checkout the meta/config ref, copy the ACL config file into the repo, commit, and push to the origin. The ACL config location should be specified in the projects.yaml file with the acl_config key. For this to work the ACLs will need to be copied by Puppet from Puppet to the Gerrit host. Add the file resource to do this as well. Change-Id: I15a1ec13b381dce3c115c01c21f404ab79e72cc4 Reviewed-on: https://review.openstack.org/15352 Reviewed-by: Jeremy Stanley Approved: Monty Taylor Reviewed-by: Monty Taylor Tested-by: Jenkins --- files/scripts/close_pull_requests.py | 8 +++++++- manifests/init.pp | 15 +++++++++++++++ templates/github-projects.secure.config.erb | 3 +++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 templates/github-projects.secure.config.erb diff --git a/files/scripts/close_pull_requests.py b/files/scripts/close_pull_requests.py index 441aab9..cecbd32 100755 --- a/files/scripts/close_pull_requests.py +++ b/files/scripts/close_pull_requests.py @@ -16,6 +16,12 @@ # Github pull requests closer reads a project config file called projects.yaml # It should look like: +# - homepage: http://openstack.org +# team-id: 153703 +# has-wiki: False +# has-issues: False +# has-downloads: False +# --- # - project: PROJECT_NAME # options: # - has-pull-requests @@ -54,7 +60,7 @@ Please visit http://wiki.openstack.org/GerritWorkflow and follow the instruction secure_config = ConfigParser.ConfigParser() secure_config.read(GITHUB_SECURE_CONFIG) -config = yaml.load(open(PROJECTS_YAML)) +(defaults, config) = [config for config in yaml.load_all(open(PROJECTS_YAML))] if secure_config.has_option("github", "oauth_token"): ghub = github.Github(secure_config.get("github", "oauth_token")) diff --git a/manifests/init.pp b/manifests/init.pp index c04f75b..ee56ce4 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,6 +1,8 @@ class github( $username, $oauth_token, + $project_username, + $project_password, $projects = [] ) { include pip @@ -55,6 +57,19 @@ class github( ], } + file { '/etc/github/github-projects.secure.config': + ensure => present, + content => template('github/github-projects.secure.config.erb'), + group => 'github', + mode => '0440', + owner => 'root', + replace => true, + require => [ + Group['github'], + File['/etc/github'] + ], + } + file { '/usr/local/github': ensure => directory, group => 'root', diff --git a/templates/github-projects.secure.config.erb b/templates/github-projects.secure.config.erb new file mode 100644 index 0000000..887c2a7 --- /dev/null +++ b/templates/github-projects.secure.config.erb @@ -0,0 +1,3 @@ +[github] +username = <%= project_username %> +password = <%= project_password %>