Merge "Fix format device"

This commit is contained in:
Jenkins 2013-03-16 19:40:16 +00:00 committed by Gerrit Code Review
commit c2f8f00a3e

View File

@ -41,10 +41,10 @@ def format_device(dev):
Format a device for display.
"""
if ':' in dev['ip']:
return ('d%(id)sr%(region)z%(zone)s-'
return ('d%(id)sr%(region)sz%(zone)s-'
'[%(ip)s]:%(port)s/%(device)s_"%(meta)s"') % dev
else:
return ('d%(id)sr%(region)z%(zone)s-'
return ('d%(id)sr%(region)sz%(zone)s-'
'%(ip)s:%(port)s/%(device)s_"%(meta)s"') % dev
@ -471,7 +471,7 @@ swift-ring-builder <builder_file> remove <search-value> [search-value ...]
if len(devs) > 1:
print 'Matched more than one device:'
for dev in devs:
print ' d%(id)sr%(region)z%(zone)s-%(ip)s:%(port)s/' \
print ' d%(id)sr%(region)sz%(zone)s-%(ip)s:%(port)s/' \
'%(device)s_"%(meta)s"' % dev
if raw_input('Are you sure you want to remove these %s '
'devices? (y/N) ' % len(devs)) != 'y':
@ -494,7 +494,7 @@ swift-ring-builder <builder_file> remove <search-value> [search-value ...]
print '-' * 79
exit(EXIT_ERROR)
print 'd%(id)sr%(region)z%(zone)s-%(ip)s:%(port)s/' \
print 'd%(id)sr%(region)sz%(zone)s-%(ip)s:%(port)s/' \
'%(device)s_"%(meta)s" marked for removal and will ' \
'be removed next rebalance.' % dev
pickle.dump(builder.to_dict(), open(argv[1], 'wb'), protocol=2)