Gehel has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/391039 )

Change subject: wdqs: ensure blazegraph data file has correct ownership
......................................................................


wdqs: ensure blazegraph data file has correct ownership

A rather ugly exec is used as a guard to ensure the data file is not created
by puppet, but that the permissions are managed if it exists.

Change-Id: Ie4e5dd21ac8cb895365ef1acb6d9dfbfc7dc4580
---
M modules/wdqs/manifests/init.pp
1 file changed, 18 insertions(+), 0 deletions(-)

Approvals:
  Smalyshev: Looks good to me, but someone else must approve
  jenkins-bot: Verified
  Gehel: Looks good to me, approved



diff --git a/modules/wdqs/manifests/init.pp b/modules/wdqs/manifests/init.pp
index 2623668..567660f 100644
--- a/modules/wdqs/manifests/init.pp
+++ b/modules/wdqs/manifests/init.pp
@@ -29,6 +29,7 @@
 ) {
 
     $deploy_user = 'deploy-service'
+    $data_file = "${data_dir}/wikidata.jnl"
 
     group { $username:
         ensure => present,
@@ -81,6 +82,23 @@
         }
     }
 
+    # This is a rather ugly hack to ensure that permissions of $data_file are
+    # managed, but that the file is not created by puppet. If that file does
+    # not exist, puppet will raise an error and skip the File[$data_file]
+    # resource (and only that resource). It means that puppet will be in error
+    # until data import is started, but that's a reasonable behaviour.
+    exec { "${data_file} exists":
+        command => '/bin/true',
+        onlyif  => "/usr/bin/test -e ${data_file}",
+    }
+    file { $data_file:
+        ensure  => file,
+        owner   => $username,
+        group   => $username,
+        mode    => '0664',
+        require => Exec["${data_file} exists"],
+    }
+
     $config_dir_group = $use_git_deploy ? {
         true    => $deploy_user,
         default => 'root',

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie4e5dd21ac8cb895365ef1acb6d9dfbfc7dc4580
Gerrit-PatchSet: 5
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Gehel <[email protected]>
Gerrit-Reviewer: Alexandros Kosiaris <[email protected]>
Gerrit-Reviewer: Gehel <[email protected]>
Gerrit-Reviewer: Giuseppe Lavagetto <[email protected]>
Gerrit-Reviewer: Smalyshev <[email protected]>
Gerrit-Reviewer: Volans <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to