Yuvipanda has uploaded a new change for review.

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

Change subject: quarry: Remove duplication of clone_path and other variables
......................................................................

quarry: Remove duplication of clone_path and other variables

Change-Id: I155f3b827a73dae806afafeaea0faf747143e12c
---
M modules/quarry/manifests/celeryrunner.pp
M modules/quarry/manifests/init.pp
M modules/quarry/manifests/web.pp
3 files changed, 12 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/59/231759/1

diff --git a/modules/quarry/manifests/celeryrunner.pp 
b/modules/quarry/manifests/celeryrunner.pp
index 5e1e97c..0575b0e 100644
--- a/modules/quarry/manifests/celeryrunner.pp
+++ b/modules/quarry/manifests/celeryrunner.pp
@@ -2,13 +2,11 @@
 #
 # Runs queries submitted via celery
 class quarry::celeryrunner {
-    include quarry::base
-
-    $clone_path  = '/srv/quarry'
+    require quarry::base
 
     celery::worker { 'quarry-worker':
         app         => 'quarry.web.worker',
-        working_dir => $clone_path,
+        working_dir => $quarry::base::clone_path,
         user        => 'quarry',
         group       => 'quarry',
     }
diff --git a/modules/quarry/manifests/init.pp b/modules/quarry/manifests/init.pp
index 1c7133d..241403a 100644
--- a/modules/quarry/manifests/init.pp
+++ b/modules/quarry/manifests/init.pp
@@ -2,12 +2,12 @@
 #
 # This class sets up the basic underlying structure for both
 # Quarry web frontends and Quarry query runners.
-class quarry::base {
+class quarry::base(
+    $clone_path = '/sry/quarry',
+    $result_path_parent = '/data/project/quarry',
+    $result_path = '/data/project/quarry/results',
+) {
     include ::redis::client::python
-
-    $clone_path = '/srv/quarry'
-    $result_path_parent = '/data/project/quarry'
-    $result_path = '/data/project/quarry/results'
 
     package { [
         'python-celery',
@@ -74,7 +74,7 @@
 #
 # Sets up a cron based query-killer
 class quarry::querykiller {
-    $clone_path = '/srv/quarry'
+    require quarry::base
 
     file { '/var/log/quarry':
         ensure => directory,
@@ -83,7 +83,7 @@
     }
 
     cron { 'query-killer':
-        command => "${clone_path}/quarry/web/killer.py",
+        command => "${quarry::base::clone_path}/quarry/web/killer.py",
         minute  => '*',
         user    => 'quarry',
     }
diff --git a/modules/quarry/manifests/web.pp b/modules/quarry/manifests/web.pp
index 233d6c6..c3f0f21 100644
--- a/modules/quarry/manifests/web.pp
+++ b/modules/quarry/manifests/web.pp
@@ -4,12 +4,11 @@
 # users run SQL queries against LabsDB.
 # Deployment is handled using fabric
 class quarry::web {
-    $clone_path = '/srv/quarry'
-    $result_path = '/data/project/quarry/results'
-
     require_package('python-flask', 'python-mwoauth')
 
-    include quarry::base
+    require quarry::base
+
+    $clone_path = $::quarry::base::clone_path
 
     uwsgi::app { 'quarry-web':
         require  => Git::Clone['analytics/quarry/web'],

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I155f3b827a73dae806afafeaea0faf747143e12c
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Yuvipanda <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to