Alexandros Kosiaris has submitted this change and it was merged.

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

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

Approvals:
  20after4: Looks good to me, but someone else must approve
  Alexandros Kosiaris: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/manifests/role/phabricator.pp b/manifests/role/phabricator.pp
index aea70dd..7c5e836 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}",
@@ -144,8 +147,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: merged
Gerrit-Change-Id: Ie50c4ee26b5f6627c571d98f0d9ad1ed7ed3911b
Gerrit-PatchSet: 3
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Alexandros Kosiaris <akosia...@wikimedia.org>
Gerrit-Reviewer: 20after4 <mmod...@wikimedia.org>
Gerrit-Reviewer: Alexandros Kosiaris <akosia...@wikimedia.org>
Gerrit-Reviewer: Chasemp <chas...@gmail.com>
Gerrit-Reviewer: Rush <r...@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