Skip to content

Commit

Permalink
Give friendly notification in swift-get-nodes
Browse files Browse the repository at this point in the history
Hard coding of '/srv/node' maybe drive to some errors. But it seems
unfixable (please see talks in bug report). To avoid erros as we can,
showing a friendly notification to let user set their own device
location works better than hard coding directly.

Change-Id: I45d749dd52af8d3b051dfe98dbb9d71a5a374f97
Fixes: bug #907908
  • Loading branch information
pyKun committed Mar 9, 2013
1 parent 5e427e5 commit cb69dc8
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions bin/swift-get-nodes
Original file line number Diff line number Diff line change
Expand Up @@ -123,17 +123,20 @@ for mnode in more_nodes:
% (mnode['ip'], mnode['port'], mnode['device'], part,
urllib.quote(target))
print "\n"
print 'Use your own device location of servers:'

This comment has been minimized.

Copy link
@maplebed

maplebed Mar 19, 2013

Perhaps you can put this in a conditional so that people who take action on the suggestion have the suggestion suppressed? This way if you do choose to export DEVICE=foo, it no longer suggests that you can do that.

eg:
if test -z "$DEVICE"
then
print "Use or own ..."
fi

print 'such as "export DEVICE=/srv/node"'
for node in nodes:
if hash_str:
print 'ssh %s "ls -lah /srv/node/%s/%s/%s/%s/%s/"' % (
print 'ssh %s "ls -lah ${DEVICE:-/srv/node}/%s/%s/%s/%s/%s/"' % (
node['ip'], node['device'], loc, part, hash_str[-3:], hash_str)
else:
print 'ssh %s "ls -lah /srv/node/%s/%s/%s/"' % (
print 'ssh %s "ls -lah ${DEVICE:-/srv/node}/%s/%s/%s/"' % (
node['ip'], node['device'], loc, part)
for mnode in more_nodes:
if hash_str:
print 'ssh %s "ls -lah /srv/node/%s/%s/%s/%s/%s/" # [Handoff]' % (
mnode['ip'], mnode['device'], loc, part, hash_str[-3:], hash_str)
print 'ssh %s "ls -lah ${DEVICE:-/srv/node}/%s/%s/%s/%s/%s/" '\
'# [Handoff]' % (mnode['ip'], mnode['device'], loc, part,
hash_str[-3:], hash_str)
else:
print 'ssh %s "ls -lah /srv/node/%s/%s/%s/" # [Handoff]' % (
print 'ssh %s "ls -lah ${DEVICE:-/srv/node}/%s/%s/%s/" # [Handoff]' % (
mnode['ip'], mnode['device'], loc, part)

1 comment on commit cb69dc8

@maplebed
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the patch!

Please sign in to comment.