Alexandros Kosiaris has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/179930

Change subject: Move the top level variables in phabricator role in a class
......................................................................

Move the top level variables in phabricator role in a class

Introduce the role::phabricator::config class that houses the various
configuration variables used throughout phabricator. Update the role
manifests that use those. That way, those variables do not pollute the
top scope and unconditional inclusion of passwords::mysql::phabricator
in the top scope stops

Change-Id: Ie50c4ee26b5f6627c571d98f0d9ad1ed7ed3911b
---
M manifests/role/phabricator.pp
1 file changed, 23 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/30/179930/1

diff --git a/manifests/role/phabricator.pp b/manifests/role/phabricator.pp
index 7b69b0c..bf4b3a7 100644
--- a/manifests/role/phabricator.pp
+++ b/manifests/role/phabricator.pp
@@ -1,15 +1,17 @@
-#Both app and admin user are limited to the appropriate
-#database based on the connecting host.
-include passwords::mysql::phabricator
-$mysql_adminuser = $passwords::mysql::phabricator::admin_user
-$mysql_adminpass = $passwords::mysql::phabricator::admin_pass
-$mysql_appuser = $passwords::mysql::phabricator::app_user
-$mysql_apppass = $passwords::mysql::phabricator::app_pass
-$mysql_maniphestuser = $passwords::mysql::phabricator::manifest_user
-$mysql_maniphestpass = $passwords::mysql::phabricator::manifest_pass
-
+class role::phabricator::config {
+    #Both app and admin user are limited to the appropriate
+    #database based on the connecting host.
+    include passwords::mysql::phabricator
+    $mysql_adminuser = $passwords::mysql::phabricator::admin_user
+    $mysql_adminpass = $passwords::mysql::phabricator::admin_pass
+    $mysql_appuser = $passwords::mysql::phabricator::app_user
+    $mysql_apppass = $passwords::mysql::phabricator::app_pass
+    $mysql_maniphestuser = $passwords::mysql::phabricator::manifest_user
+    $mysql_maniphestpass = $passwords::mysql::phabricator::manifest_pass
+}
 # phabricator instance for legalpad.wikimedia.org
 class role::phabricator::legalpad {
+    include role::phabricator::config
 
     system::role { 'role::phabricator::legalpad':
         description => 'Phabricator (Legalpad)'
@@ -19,14 +21,14 @@
     class { '::phabricator':
         git_tag                  => $current_tag,
         lock_file                => '/var/run/phab_repo_lock',
-        mysql_admin_user         => $::mysql_adminuser,
-        mysql_admin_pass         => $::mysql_adminpass,
+        mysql_admin_user         => 
$role::phabricator::config::mysql_adminuser,
+        mysql_admin_pass         => 
$role::phabricator::config::mysql_adminpass,
         auth_type                => 'sul',
         settings                 => {
             'darkconsole.enabled'       => false,
             'phabricator.base-uri'      => 'https://legalpad.wikimedia.org',
-            'mysql.user'                => $::mysql_appuser,
-            'mysql.pass'                => $::mysql_apppass,
+            'mysql.user'                => 
$role::phabricator::config::mysql_appuser,
+            'mysql.pass'                => 
$role::phabricator::config::mysql_apppass,
             'mysql.host'                => 'm3-master.eqiad.wmnet',
             'storage.default-namespace' => 'phlegal',
             'phpmailer.smtp-host'       =>
@@ -46,6 +48,7 @@
 
 # production phabricator instance
 class role::phabricator::main {
+    include role::phabricator::config
 
     system::role { 'role::phabricator::main':
         description => 'Phabricator (Main)'
@@ -60,8 +63,8 @@
     class { '::phabricator':
         git_tag          => $current_tag,
         lock_file        => '/var/run/phab_repo_lock',
-        mysql_admin_user => $::mysql_adminuser,
-        mysql_admin_pass => $::mysql_adminpass,
+        mysql_admin_user => $role::phabricator::config::mysql_adminuser,
+        mysql_admin_pass => $role::phabricator::config::mysql_adminpass,
         auth_type        => 'dual',
         libext_tag       => '0.6.1.2',
         libraries        => {
@@ -77,8 +80,8 @@
             'darkconsole.enabled'                       => false,
             'phabricator.base-uri'                      => "https://${domain}";,
             'security.alternate-file-domain'            => "https://${altdom}";,
-            'mysql.user'                                => $::mysql_appuser,
-            'mysql.pass'                                => $::mysql_apppass,
+            'mysql.user'                                => 
$role::phabricator::config::mysql_appuser,
+            'mysql.pass'                                => 
$role::phabricator::config::mysql_apppass,
             'mysql.host'                                => $mysql_host,
             'phpmailer.smtp-host'                       => 
inline_template('<%= @mail_smarthost.join(";") %>'),
             'metamta.default-address'                   => 
"no-reply@${domain}",
@@ -142,8 +145,8 @@
     # redirect bugzilla URL patterns to phabricator
     # handles translation of bug numbers to maniphest task ids
     phabricator::redirector { "redirector.${domain}":
-        mysql_user    => $::mysql_maniphestuser,
-        mysql_pass    => $::mysql_maniphestpass,
+        mysql_user    => $role::phabricator::config::mysql_maniphestuser,
+        mysql_pass    => $role::phabricator::config::mysql_maniphestpass,
         mysql_host    => $mysql_host,
         rootdir       => '/srv/phab',
         field_index   => '4rRUkCdImLQU',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie50c4ee26b5f6627c571d98f0d9ad1ed7ed3911b
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Alexandros Kosiaris <akosia...@wikimedia.org>

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

Reply via email to