HADOOP-14315. Python example in the rack awareness document doesn't work due to bad indentation
This closes #214 Signed-off-by: Akira Ajisaka <aajisaka@apache.org> (cherry picked from commit 654372db859656a2201ae9f9f7c374c6564ea34d)
This commit is contained in:
parent
a17bd70892
commit
6cfceee865
@ -91,11 +91,11 @@ 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
|
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
|
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
|
address = '{0}/{1}'.format(ip, netmask) # format address string so it looks like 'ip/netmask' to make netaddr work
|
||||||
try:
|
try:
|
||||||
network_address = netaddr.IPNetwork(address).network # calculate and print network address
|
network_address = netaddr.IPNetwork(address).network # calculate and print network address
|
||||||
print "/{0}".format(network_address)
|
print "/{0}".format(network_address)
|
||||||
except:
|
except:
|
||||||
print "/rack-unknown" # print catch-all value if unable to calculate network address
|
print "/rack-unknown" # print catch-all value if unable to calculate network address
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user