Volans has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398087 )

Change subject: wmf-auto-reimage: improve systemd-specific commands
......................................................................

wmf-auto-reimage: improve systemd-specific commands

* Improve systemd detection
* Ignore failures for the reset-failed command that exit with non-zero
  exit code if there is no failure to be reset.

Change-Id: I1d34ce3946d7d4ac255de89f8703f1b0764465c7
---
M modules/profile/files/cumin/wmf_auto_reimage_lib.py
1 file changed, 6 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/87/398087/1

diff --git a/modules/profile/files/cumin/wmf_auto_reimage_lib.py 
b/modules/profile/files/cumin/wmf_auto_reimage_lib.py
index 3bc5ace..31685cf 100644
--- a/modules/profile/files/cumin/wmf_auto_reimage_lib.py
+++ b/modules/profile/files/cumin/wmf_auto_reimage_lib.py
@@ -614,10 +614,10 @@
     Arguments:
     host -- the FQDN of the host for which the Puppet certificate has to be 
revoked
     """
-    _, worker = run_cumin('detect_distribution', host, ["lsb_release -i | awk 
'{ print $3 }'"],
+    _, worker = run_cumin('detect_init', host, ['ps --no-headers -o comm 1'],
                           installer=True)
     for _, output in worker.get_results():
-        distro = output.message()
+        init_system = output.message()
         break
 
     base_commands = [
@@ -625,11 +625,11 @@
         ('puppet agent --onetime --no-daemonize --verbose --no-splay 
--show_diff '
          '--ignorecache --no-usecacheonfailure')]
 
-    if distro.lower() == 'ubuntu':
-        commands = base_commands
-    else:
+    if init_system == 'systemd':
         commands = ['systemctl stop puppet.service',
-                    'systemctl reset-failed puppet.service'] + base_commands
+                    'systemctl reset-failed puppet.service || true'] + 
base_commands
+    else:
+        commands = base_commands
 
     print_line('Started first puppet run (sit back, relax, and enjoy the 
wait)', host=host)
     run_cumin('puppet_first_run', host, commands, timeout=7200, installer=True)

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

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

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

Reply via email to