Andrew Bogott has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/343453 )
Change subject: nfs-exportd: Handle missing projects
......................................................................
nfs-exportd: Handle missing projects
Previously a failure to access a project caused an exception that
unwound everything; now we catch that case, log a warning,
and continue.
Bug: T160818
Change-Id: Icbc5dd54ab7300188ec40e3dd3380f56066ac901
---
M modules/labstore/files/nfs-exportd
1 file changed, 13 insertions(+), 6 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/53/343453/1
diff --git a/modules/labstore/files/nfs-exportd
b/modules/labstore/files/nfs-exportd
index 357f871..800573d 100755
--- a/modules/labstore/files/nfs-exportd
+++ b/modules/labstore/files/nfs-exportd
@@ -28,6 +28,7 @@
import sys
import subprocess
+import keystoneauth1
from keystoneclient.session import Session as KeystoneSession
from keystoneclient.auth.identity.v3 import Password as KeystonePassword
@@ -91,13 +92,19 @@
project_domain_name='default'
))
)
+
ips = []
- for instance in client.servers.list():
- # Only provide internal IPs!
- ips += [
- str(ip['addr']) for ip in instance.addresses['public']
- if ip['OS-EXT-IPS:type'] == 'fixed' and is_valid_ipv4(ip['addr'])
- ]
+ try:
+ for instance in client.servers.list():
+ # Only provide internal IPs!
+ ips += [
+ str(ip['addr']) for ip in instance.addresses['public']
+ if ip['OS-EXT-IPS:type'] == 'fixed' and
is_valid_ipv4(ip['addr'])
+ ]
+ except keystoneauth1.exceptions.http.Unauthorized:
+ logging.warn("Failed to get server list for project %s."
+ " Maybe the project was deleted." % project)
+ ips = []
return ips
--
To view, visit https://gerrit.wikimedia.org/r/343453
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icbc5dd54ab7300188ec40e3dd3380f56066ac901
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Andrew Bogott <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits