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

Change subject: wmf-auto-reimage: ignore exit code for cert gen
......................................................................

wmf-auto-reimage: ignore exit code for cert gen

* The first puppet run that generates the certificate on hosts with
  a puppet4 client, exit with a non-zero exit status.
* Allow to ignore exit codes when executing cumin commands, ignore them
  in the case of puppet certificate generation.

Bug: T182702
Change-Id: I4a884bfb832f48e574b55de04fc54f52ec5e9cf5
---
M modules/profile/files/cumin/wmf_auto_reimage_lib.py
1 file changed, 7 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/03/398803/1

diff --git a/modules/profile/files/cumin/wmf_auto_reimage_lib.py 
b/modules/profile/files/cumin/wmf_auto_reimage_lib.py
index 5dcab32..32d131c 100644
--- a/modules/profile/files/cumin/wmf_auto_reimage_lib.py
+++ b/modules/profile/files/cumin/wmf_auto_reimage_lib.py
@@ -422,7 +422,7 @@
     return command_args
 
 
-def run_cumin(label, hosts_query, commands, timeout=30, installer=False):
+def run_cumin(label, hosts_query, commands, timeout=30, installer=False, 
ignore_exit=False):
     """Run a remote command via Cumin.
 
     Arguments:
@@ -443,7 +443,10 @@
     target = transports.Target(hosts, logger=logger)
     worker = transport.Transport.new(config, target, logger=logger)
 
-    worker.commands = [transports.Command(command, timeout=timeout)
+    ok_codes = None
+    if ignore_exit:
+        ok_codes = []
+    worker.commands = [transports.Command(command, timeout=timeout, 
ok_codes=ok_codes)
                        for command in commands]
     worker.handler = 'async'
     exit_code = worker.execute()
@@ -614,7 +617,8 @@
     Arguments:
     host -- the FQDN of the host to run puppet on
     """
-    run_cumin('puppet_generate_certs', host, ['puppet agent --test'], 
installer=True)
+    run_cumin('puppet_generate_certs', host, ['puppet agent --test'], 
installer=True,
+              ignore_exit=True)
     print_line('Run Puppet to generate the certificate', host=host)
 
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4a884bfb832f48e574b55de04fc54f52ec5e9cf5
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