Madhuvishy has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/334495 )
Change subject: toolchecker: Add script to manage toolchecker* services ...................................................................... toolchecker: Add script to manage toolchecker* services Change-Id: Iae1c38c5abb405b38eac98bad8f75f66eb1874bb --- A modules/toollabs/files/toolscheckerctl M modules/toollabs/manifests/checker.pp 2 files changed, 41 insertions(+), 0 deletions(-) Approvals: Madhuvishy: Looks good to me, approved jenkins-bot: Verified diff --git a/modules/toollabs/files/toolscheckerctl b/modules/toollabs/files/toolscheckerctl new file mode 100644 index 0000000..0a96b7c --- /dev/null +++ b/modules/toollabs/files/toolscheckerctl @@ -0,0 +1,33 @@ +#!/usr/bin/python3 + +import argparse +import os +import subprocess +import sys + +services = [os.path.splitext(fname)[0] for fname in os.listdir('/etc/init') + if (fname.startswith('toolschecker_') and fname.endswith('.conf'))] + +if __name__ == '__main__': + + if os.geteuid() != 0: + print("Script needs to be run as root") + sys.exit(1) + + argparser = argparse.ArgumentParser() + + argparser.add_argument( + 'action', + choices=['start', 'stop', 'restart', 'status'], + help=""" + start: Start all toolschecker services + stop: Stop all toolschecker services + restart: Restart all toolschecker services + status: Print status for all toolschecker services + """ + ) + + args = argparser.parse_args() + + for service in services: + subprocess.check_call(['service', service, args.action]) diff --git a/modules/toollabs/manifests/checker.pp b/modules/toollabs/manifests/checker.pp index 88abdb6..c968e4e 100644 --- a/modules/toollabs/manifests/checker.pp +++ b/modules/toollabs/manifests/checker.pp @@ -154,6 +154,14 @@ source => "/var/lib/puppet/ssl/private_keys/${::fqdn}.pem", } + file { '/usr/local/sbin/toolscheckerctl': + ensure => file, + owner => 'root', + group => 'root', + mode => '0655', + source => 'puppet:///modules/toollabs/toolscheckerctl', + } + sudo::user { 'tools.toolschecker': privileges => [ 'ALL=(tools.toolschecker-k8s-ws) NOPASSWD: ALL', -- To view, visit https://gerrit.wikimedia.org/r/334495 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iae1c38c5abb405b38eac98bad8f75f66eb1874bb Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Madhuvishy <mviswanat...@wikimedia.org> Gerrit-Reviewer: Madhuvishy <mviswanat...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits