From 6cfceee86547211c71f8cb6f9c63798a229de03e Mon Sep 17 00:00:00 2001 From: Kengo Seki Date: Mon, 17 Apr 2017 23:29:58 -0400 Subject: [PATCH] HADOOP-14315. Python example in the rack awareness document doesn't work due to bad indentation This closes #214 Signed-off-by: Akira Ajisaka (cherry picked from commit 654372db859656a2201ae9f9f7c374c6564ea34d) --- .../hadoop-common/src/site/markdown/RackAwareness.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/site/markdown/RackAwareness.md b/hadoop-common-project/hadoop-common/src/site/markdown/RackAwareness.md index ced6c846a97..0ae1de32959 100644 --- a/hadoop-common-project/hadoop-common/src/site/markdown/RackAwareness.md +++ b/hadoop-common-project/hadoop-common/src/site/markdown/RackAwareness.md @@ -91,12 +91,12 @@ sys.argv.pop(0) # discard name netmask = '255.255.255.0' # set netmask to what's being used in your environment. The example uses a /24 for ip in sys.argv: # loop over list of datanode IP's -address = '{0}/{1}'.format(ip, netmask) # format address string so it looks like 'ip/netmask' to make netaddr work -try: - network_address = netaddr.IPNetwork(address).network # calculate and print network address - print "/{0}".format(network_address) -except: - print "/rack-unknown" # print catch-all value if unable to calculate network address + address = '{0}/{1}'.format(ip, netmask) # format address string so it looks like 'ip/netmask' to make netaddr work + try: + network_address = netaddr.IPNetwork(address).network # calculate and print network address + print "/{0}".format(network_address) + except: + print "/rack-unknown" # print catch-all value if unable to calculate network address ``` bash Example