Filippo Giunchedi has submitted this change and it was merged.
Change subject: es-tool: support IPv6 addresses in (un)ban-node
......................................................................
es-tool: support IPv6 addresses in (un)ban-node
Change-Id: I46664fbcefab6726137e6814e3722840db359745
---
M modules/elasticsearch/files/es-tool
1 file changed, 14 insertions(+), 10 deletions(-)
Approvals:
Filippo Giunchedi: Verified; Looks good to me, approved
diff --git a/modules/elasticsearch/files/es-tool
b/modules/elasticsearch/files/es-tool
index e5e27cd..c585fd9 100755
--- a/modules/elasticsearch/files/es-tool
+++ b/modules/elasticsearch/files/es-tool
@@ -68,17 +68,25 @@
return []
+def get_node_type(node):
+ try:
+ ipaddr.IPv4Address(node)
+ return "_ip"
+ except ipaddr.AddressValueError:
+ try:
+ ipaddr.IPv6Address(node)
+ return "_ip"
+ except ipaddr.AddressValueError:
+ return "_host"
+
+
# Add new command functions here
def es_ban_node():
if args.node == "":
print "No node provided"
return os.EX_UNAVAILABLE
- try:
- ipaddr.IPv4Address(args.node)
- node_type = "_ip"
- except ipaddr.AddressValueError:
- node_type = "_host"
+ node_type = get_node_type(args.node)
banned = get_banned_nodes(node_type)
if args.node in banned:
@@ -192,11 +200,7 @@
print "No node provided"
return os.EX_UNAVAILABLE
- try:
- ipaddr.IPv4Address(args.node)
- node_type = "_ip"
- except ipaddr.AddressValueError:
- node_type = "_host"
+ node_type = get_node_type(args.node)
banned = get_banned_nodes(node_type)
if args.node not in banned:
--
To view, visit https://gerrit.wikimedia.org/r/191357
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I46664fbcefab6726137e6814e3722840db359745
Gerrit-PatchSet: 5
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Chad <[email protected]>
Gerrit-Reviewer: Filippo Giunchedi <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits