Volans has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/404439 )
Change subject: wmf-auto-reimage: fix host validation logic
......................................................................
wmf-auto-reimage: fix host validation logic
Bug: T182702
Change-Id: Id1c96f12ec7ceb42f6ce0381e6d74187bcfd5e44
---
M modules/profile/files/cumin/wmf_auto_reimage_lib.py
1 file changed, 7 insertions(+), 5 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/39/404439/1
diff --git a/modules/profile/files/cumin/wmf_auto_reimage_lib.py
b/modules/profile/files/cumin/wmf_auto_reimage_lib.py
index 8b8ef9a..f10c0ae 100644
--- a/modules/profile/files/cumin/wmf_auto_reimage_lib.py
+++ b/modules/profile/files/cumin/wmf_auto_reimage_lib.py
@@ -472,13 +472,15 @@
command = "puppet cert list --all 2> /dev/null | egrep
'({hosts})'".format(
hosts='|'.join(hosts))
- exit_code, worker = run_cumin('validate_hosts', get_puppet_ca_master(),
[command])
+ exit_code, worker = run_cumin(
+ 'validate_hosts', get_puppet_ca_master(), [command], ignore_exit=True)
- missing = []
+ missing = hosts[:]
+ output = ''
for _, output in worker.get_results():
for host in hosts:
- if '+ "{host}"'.format(host=host) not in output.message():
- missing.append(host)
+ if '+ "{host}"'.format(host=host) in output.message():
+ missing.remove(host)
if missing:
message = ('Signed cert on Puppet not found for hosts {missing} '
@@ -492,7 +494,7 @@
raise RuntimeError(message)
else:
if len(hosts) == 1:
- print_line('Validated host', host=host)
+ print_line('Validated host', host=hosts[0])
else:
print_line('Validated hosts: {hosts}'.format(hosts=hosts))
--
To view, visit https://gerrit.wikimedia.org/r/404439
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id1c96f12ec7ceb42f6ce0381e6d74187bcfd5e44
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