Faidon Liambotis has submitted this change and it was merged.

Change subject: Gerrit manifest cleanup
......................................................................


Gerrit manifest cleanup

- Remove two unused parameters: apache_ssl (always on) and slave (not supported)
- Narrow scope in which password and ldap info is included, proxy doesn't need
  to know
- Standardize the parameters to use underscores
- Include gerrit::crons as part of gerrit::instance and require gerrit::jetty 
first

Change-Id: I845c451fdc41b28ffd2e1b461f8cfc213419cb39
---
M modules/gerrit/manifests/instance.pp
M modules/gerrit/manifests/jetty.pp
M modules/gerrit/templates/gerrit.config.erb
M modules/gerrit/templates/secure.config.erb
4 files changed, 42 insertions(+), 61 deletions(-)

Approvals:
  Chad: Looks good to me, but someone else must approve
  Faidon Liambotis: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/gerrit/manifests/instance.pp 
b/modules/gerrit/manifests/instance.pp
index e5afa1a..44e4381 100644
--- a/modules/gerrit/manifests/instance.pp
+++ b/modules/gerrit/manifests/instance.pp
@@ -1,42 +1,14 @@
 # Manifest to setup a Gerrit instance
 
 class gerrit::instance(
-    $apache_ssl  = false,
-    $slave       = false,
-    $ssh_port    = '29418',
     $db_host     = '',
-    $db_name     = 'reviewdb',
     $host        = '',
-    $db_user     = 'gerrit',
     $ssh_key     = '',
     $ssl_cert    = 'ssl-cert-snakeoil',
     $ssl_cert_key= 'ssl-cert-snakeoil',
     $replication = '',
     $smtp_host   = ''
     ) {
-
-    include standard,
-        ldap::role::config::labs
-
-    # Main config
-    include passwords::gerrit
-    $email_key = $passwords::gerrit::gerrit_email_key
-    $sshport = $ssh_port
-    $dbhost = $db_host
-    $dbname = $db_name
-    $dbuser = $db_user
-    $dbpass = $passwords::gerrit::gerrit_db_pass
-    $bzpass = $passwords::gerrit::gerrit_bz_pass
-    $phabcert = $passwords::gerrit::gerrit_phab_cert
-
-    # Setup LDAP
-    include ldap::role::config::labs
-    $ldapconfig = $ldap::role::config::labs::ldapconfig
-
-    $ldap_hosts = $ldapconfig['servernames']
-    $ldap_base_dn = $ldapconfig['basedn']
-    $ldap_proxyagent = $ldapconfig['proxyagent']
-    $ldap_proxyagent_pass = $ldapconfig['proxypass']
 
     # Configure the base URL
     $url = "https://${host}/r";
@@ -48,18 +20,15 @@
     }
 
     class { 'gerrit::jetty':
-        ldap_hosts           => $ldap_hosts,
-        ldap_base_dn         => $ldap_base_dn,
-        url                  => $url,
-        dbhost               => $dbhost,
-        dbname               => $dbname,
-        dbuser               => $dbuser,
-        hostname             => $host,
-        ldap_proxyagent      => $ldap_proxyagent,
-        ldap_proxyagent_pass => $ldap_proxyagent_pass,
-        sshport              => $sshport,
-        replication          => $replication,
-        smtp_host            => $smtp_host,
-        ssh_key              => $ssh_key,
+        url         => $url,
+        db_host     => $db_host,
+        hostname    => $host,
+        replication => $replication,
+        smtp_host   => $smtp_host,
+        ssh_key     => $ssh_key,
+    }
+
+    class { 'gerrit::crons':
+        require => Class['gerrit::jetty'],
     }
 }
diff --git a/modules/gerrit/manifests/jetty.pp 
b/modules/gerrit/manifests/jetty.pp
index 9514302..b90aaf5 100644
--- a/modules/gerrit/manifests/jetty.pp
+++ b/modules/gerrit/manifests/jetty.pp
@@ -1,20 +1,32 @@
-class gerrit::jetty ($ldap_hosts,
-    $ldap_base_dn,
-    $url,
-    $dbhost,
-    $dbname,
-    $dbuser,
+class gerrit::jetty ($url,
+    $db_host,
     $hostname,
-    $sshport,
-    $ldap_proxyagent,
-    $ldap_proxyagent_pass,
+    $ssh_port,
     $replication,
     $smtp_host,
-    $ssh_key) {
+    $ssh_key,
+    $db_name = 'reviewdb',
+    $db_user = 'gerrit',
+    $ssh_port = '29418') {
 
-    include gerrit::crons
     include nrpe
 
+    # Private config
+    include passwords::gerrit
+    $email_key = $passwords::gerrit::gerrit_email_key
+    $db_pass = $passwords::gerrit::gerrit_db_pass
+    $bz_pass = $passwords::gerrit::gerrit_bz_pass
+    $phab_cert = $passwords::gerrit::gerrit_phab_cert
+
+    # Setup LDAP
+    include ldap::role::config::labs
+    $ldapconfig = $ldap::role::config::labs::ldapconfig
+
+    $ldap_hosts = $ldapconfig['servernames']
+    $ldap_base_dn = $ldapconfig['basedn']
+    $ldap_proxyagent = $ldapconfig['proxyagent']
+    $ldap_proxyagent_pass = $ldapconfig['proxypass']
+
     package { 'openjdk-7-jre':
         ensure => latest,
     }
diff --git a/modules/gerrit/templates/gerrit.config.erb 
b/modules/gerrit/templates/gerrit.config.erb
index 617155d..1d00fba 100644
--- a/modules/gerrit/templates/gerrit.config.erb
+++ b/modules/gerrit/templates/gerrit.config.erb
@@ -10,10 +10,10 @@
     useRecursiveMerge = true
 [database]
     type = MYSQL
-    hostname = <%= @dbhost %>
-    database = <%= @dbname %>
-    username = <%= @dbuser %>
-    url = jdbc:mysql://<%= @dbhost %>/<%= @dbname 
%>?characterSetResults=utf8&characterEncoding=utf8&connectionCollation=utf8_unicode_ci
+    hostname = <%= @db_host %>
+    database = <%= @db_name %>
+    username = <%= @db_user %>
+    url = jdbc:mysql://<%= @db_host %>/<%= @db_name 
%>?characterSetResults=utf8&characterEncoding=utf8&connectionCollation=utf8_unicode_ci
 [auth]
     type = LDAP
     cookieSecure = true
@@ -39,7 +39,7 @@
     javaHome = /usr/lib/jvm/java-7-openjdk-amd64/jre
     heapLimit = 20g
 [sshd]
-    listenAddress = *:<%= @sshport %>
+    listenAddress = *:<%= @ssh_port %>
     threads = 8
     batchThreads = 2
     idleTimeout = 864000
diff --git a/modules/gerrit/templates/secure.config.erb 
b/modules/gerrit/templates/secure.config.erb
index 7fd3952..c550f47 100644
--- a/modules/gerrit/templates/secure.config.erb
+++ b/modules/gerrit/templates/secure.config.erb
@@ -1,11 +1,11 @@
 [database]
-       password = <%= scope.lookupvar('gerrit::instance::dbpass') %>
+       password = <%= @db_pass %>
 [ldap]
        username = <%= @ldap_proxyagent %>
        password = <%= @ldap_proxyagent_pass %>
 [auth]
-       registerEmailPrivateKey = <%= 
scope.lookupvar('gerrit::instance::email_key') %>
+       registerEmailPrivateKey = <%= @email_key %>
 [bugzilla]
-       password = <%= scope.lookupvar('gerrit::instance::bzpass') %>
+       password = <%= @bz_pass %>
 [its-phabricator]
-       certificate = <%= scope.lookupvar('gerrit::instance::phabcert') %>
+       certificate = <%= @phab_cert %>

-- 
To view, visit https://gerrit.wikimedia.org/r/275911
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I845c451fdc41b28ffd2e1b461f8cfc213419cb39
Gerrit-PatchSet: 4
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Chad <ch...@wikimedia.org>
Gerrit-Reviewer: Chad <ch...@wikimedia.org>
Gerrit-Reviewer: Faidon Liambotis <fai...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to