Merge "Change usage help and Attention messages to warnings"
This commit is contained in:
commit
47b611e1d0
@ -26,7 +26,7 @@ if __name__ == '__main__':
|
||||
|
||||
usage = '''
|
||||
Shows the nodes responsible for the item specified.
|
||||
Usage: %prog [-a] <ring.gz> <account> [<container>] [<object>]
|
||||
Usage: %prog [-a] <ring.gz> <account> [<container> [<object>]]
|
||||
Or: %prog [-a] <ring.gz> -p partition
|
||||
Or: %prog [-a] -P policy_name <account> <container> <object>
|
||||
Note: account, container, object can also be a single arg separated by /
|
||||
|
@ -25,7 +25,7 @@
|
||||
.SH SYNOPSIS
|
||||
.LP
|
||||
.B swift-get-nodes
|
||||
\ <ring.gz> <account> [<container>] [<object>]
|
||||
\ <ring.gz> <account> [<container> [<object>]]
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
|
@ -382,7 +382,7 @@ def print_obj(datafile, check_etag=True, swift_dir='/etc/swift',
|
||||
if (policy_index is not None and
|
||||
policy_index_for_name is not None and
|
||||
policy_index != policy_index_for_name):
|
||||
print 'Attention: Ring does not match policy!'
|
||||
print 'Warning: Ring does not match policy!'
|
||||
print 'Double check your policy name!'
|
||||
if not ring and policy_index_for_name:
|
||||
ring = POLICIES.get_object_ring(policy_index_for_name,
|
||||
@ -472,9 +472,9 @@ def print_item_locations(ring, ring_name=None, account=None, container=None,
|
||||
policy = POLICIES.get_by_name(policy_name)
|
||||
if policy:
|
||||
if ring_name != policy.ring_name:
|
||||
print 'Attention! mismatch between ring and policy detected!'
|
||||
print 'Warning: mismatch between ring and policy name!'
|
||||
else:
|
||||
print 'Attention! Policy %s is not valid' % policy_name
|
||||
print 'Warning: Policy %s is not valid' % policy_name
|
||||
|
||||
policy_index = None
|
||||
if ring is None and (obj or part):
|
||||
@ -518,14 +518,16 @@ def print_item_locations(ring, ring_name=None, account=None, container=None,
|
||||
ring = Ring(swift_dir, ring_name='container')
|
||||
else:
|
||||
if ring_name != 'container':
|
||||
print 'Attention! mismatch between ring and item detected!'
|
||||
print 'Warning: account/container specified ' + \
|
||||
'but ring not named "container"'
|
||||
if account and not container and not obj:
|
||||
loc = 'accounts'
|
||||
if not any([ring, ring_name]):
|
||||
ring = Ring(swift_dir, ring_name='account')
|
||||
else:
|
||||
if ring_name != 'account':
|
||||
print 'Attention! mismatch between ring and item detected!'
|
||||
print 'Warning: account specified ' + \
|
||||
'but ring not named "account"'
|
||||
|
||||
print '\nAccount \t%s' % account
|
||||
print 'Container\t%s' % container
|
||||
|
@ -411,7 +411,7 @@ class TestPrintObjFullMeta(TestCliInfoBase):
|
||||
out = StringIO()
|
||||
with mock.patch('sys.stdout', out):
|
||||
print_obj(self.datafile, policy_name='two', swift_dir=self.testdir)
|
||||
ring_alert_msg = 'Attention: Ring does not match policy'
|
||||
ring_alert_msg = 'Warning: Ring does not match policy!'
|
||||
self.assertTrue(ring_alert_msg in out.getvalue())
|
||||
|
||||
def test_valid_etag(self):
|
||||
|
Loading…
Reference in New Issue
Block a user