Chad has uploaded a new change for review.

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

Change subject: Setup Gerrit role account for Phabricator actions
......................................................................

Setup Gerrit role account for Phabricator actions

Includes convenience class for writing standardized arcrc files
for scripts to use.

Change-Id: I7221c126a8a34fe9ddde495d84c52db0a8cde341
---
M manifests/role/phabricator.pp
A modules/phabricator/manifests/arcrc.pp
M modules/phabricator/manifests/tools.pp
A modules/phabricator/templates/ackrc.erb
4 files changed, 50 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/32/234332/1

diff --git a/manifests/role/phabricator.pp b/manifests/role/phabricator.pp
index 6d44c04..1e5331c 100644
--- a/manifests/role/phabricator.pp
+++ b/manifests/role/phabricator.pp
@@ -16,6 +16,8 @@
     include passwords::phabricator
     $phabtools_cert        = $passwords::phabricator::phabtools_cert
     $phabtools_user        = $passwords::phabricator::phabtools_user
+    $gerritbot_cert        = $passwords::phabricator::gerritbot_cert
+    $gerritbot_user        = $passwords::phabricator::gerritbot_user
 }
 
 # production phabricator instance
@@ -85,6 +87,8 @@
         rt_pass        => $role::phabricator::config::rt_pass,
         phabtools_cert => $role::phabricator::config::phabtools_cert,
         phabtools_user => $role::phabricator::config::phabtools_user,
+        gerritbot_cert => $role::phabricator::config::gerritbot_cert,
+        gerritbot_user => $role::phabricator::config::gerritbot_user,
         dump           => true,
     }
 
diff --git a/modules/phabricator/manifests/arcrc.pp 
b/modules/phabricator/manifests/arcrc.pp
new file mode 100644
index 0000000..96e5b8b
--- /dev/null
+++ b/modules/phabricator/manifests/arcrc.pp
@@ -0,0 +1,27 @@
+# == Class: phabricator::arcrc
+#
+# === Parameters
+#
+# [*rootdir*]
+#    Phabricator base directory
+# [*user*]
+#    User who's arcrc file we're writing
+# [*cert*]
+#    Their secret cert
+
+define phabricator::arcrc(
+       $rootdir = '/',
+       $user    = '',
+       $cert    = '',
+) {
+       file { "${rootdir}/arcrc":
+               ensure  => directory,
+               require => File["${rootdir}"],
+       }
+
+    file { "${rootdir}/arcrc/${user}.arcrc":
+        ensure  => 'file',
+        content => template('phabricator/arcrc.erb'),
+        require => File["${rootdir}/arcrc"],
+    }
+}
diff --git a/modules/phabricator/manifests/tools.pp 
b/modules/phabricator/manifests/tools.pp
index 16c24bf..799321d 100644
--- a/modules/phabricator/manifests/tools.pp
+++ b/modules/phabricator/manifests/tools.pp
@@ -16,6 +16,8 @@
     $rt_pass               = '',
     $phabtools_cert        = '',
     $phabtools_user        = '',
+    $gerritbot_cert        = '',
+    $gerritbot_user        = '',
     $dump                  = false,
 ) {
 
@@ -66,4 +68,10 @@
         hour    => '1',
         require => Git::Install['phabricator/tools'],
     }
+
+    phabricator::arcrc { "gerritbot":
+        rootdir => $::phabricator::phabdir,
+        user    => $gerrit_bot_user,
+        cert    => $gerrit_bot_cert,
+    }
 }
diff --git a/modules/phabricator/templates/ackrc.erb 
b/modules/phabricator/templates/ackrc.erb
new file mode 100644
index 0000000..b9fa23b
--- /dev/null
+++ b/modules/phabricator/templates/ackrc.erb
@@ -0,0 +1,11 @@
+{
+  "hosts"  : {
+    "https:\/\/phabricator.wikimedia.org\/api\/" : {
+      "user" : "<%= @user %>",
+      "cert" : "<%= @cert %>"
+    }
+  },
+  "config" : {
+    "default" : "https:\/\/phabricator.wikimedia.org\/api\/"
+  }
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7221c126a8a34fe9ddde495d84c52db0a8cde341
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Chad <ch...@wikimedia.org>

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

Reply via email to