Make swift client easier to wrap
In the process of wrapping for profiling, a trivial wrap with def main()
ended in a ton of these:
NameError: global name 'parser' is not defined
A closer investigation revealed an apparent confusion in argument names.
The problem was introduced by commit 985968f765
of November 2010. Note that Greg fixed st_delete() correctly in that one,
but apparently forgot the others.
Unit tests pass for both current (bad) code, and the patched code.
By the magic of Python scoping, current code works, just impossible
to wrap for a quick hack.
Change-Id: I18f2494ce2a201d04d49f99ea259d141939dcb6a
This commit is contained in:
parent
3c2e85609b
commit
3aabe86e34
10
bin/swift
10
bin/swift
@ -1208,7 +1208,7 @@ download --all OR download container [options] [object] [object] ...
|
|||||||
stdout.'''.strip('\n')
|
stdout.'''.strip('\n')
|
||||||
|
|
||||||
|
|
||||||
def st_download(options, args, print_queue, error_queue):
|
def st_download(parser, args, print_queue, error_queue):
|
||||||
parser.add_option('-a', '--all', action='store_true', dest='yes_all',
|
parser.add_option('-a', '--all', action='store_true', dest='yes_all',
|
||||||
default=False, help='Indicates that you really want to download '
|
default=False, help='Indicates that you really want to download '
|
||||||
'everything in the account')
|
'everything in the account')
|
||||||
@ -1384,7 +1384,7 @@ list [options] [container]
|
|||||||
'''.strip('\n')
|
'''.strip('\n')
|
||||||
|
|
||||||
|
|
||||||
def st_list(options, args, print_queue, error_queue):
|
def st_list(parser, args, print_queue, error_queue):
|
||||||
parser.add_option('-p', '--prefix', dest='prefix', help='Will only list '
|
parser.add_option('-p', '--prefix', dest='prefix', help='Will only list '
|
||||||
'items beginning with the prefix')
|
'items beginning with the prefix')
|
||||||
parser.add_option('-d', '--delimiter', dest='delimiter', help='Will roll '
|
parser.add_option('-d', '--delimiter', dest='delimiter', help='Will roll '
|
||||||
@ -1429,7 +1429,7 @@ stat [container] [object]
|
|||||||
args given (if any).'''.strip('\n')
|
args given (if any).'''.strip('\n')
|
||||||
|
|
||||||
|
|
||||||
def st_stat(options, args, print_queue, error_queue):
|
def st_stat(parser, args, print_queue, error_queue):
|
||||||
(options, args) = parse_args(parser, args)
|
(options, args) = parse_args(parser, args)
|
||||||
args = args[1:]
|
args = args[1:]
|
||||||
conn = get_conn(options)
|
conn = get_conn(options)
|
||||||
@ -1554,7 +1554,7 @@ post [options] [container] [object]
|
|||||||
post -m Color:Blue -m Size:Large'''.strip('\n')
|
post -m Color:Blue -m Size:Large'''.strip('\n')
|
||||||
|
|
||||||
|
|
||||||
def st_post(options, args, print_queue, error_queue):
|
def st_post(parser, args, print_queue, error_queue):
|
||||||
parser.add_option('-r', '--read-acl', dest='read_acl', help='Sets the '
|
parser.add_option('-r', '--read-acl', dest='read_acl', help='Sets the '
|
||||||
'Read ACL for containers. Quick summary of ACL syntax: .r:*, '
|
'Read ACL for containers. Quick summary of ACL syntax: .r:*, '
|
||||||
'.r:-.example.com, .r:www.example.com, account1, account2:user2')
|
'.r:-.example.com, .r:www.example.com, account1, account2:user2')
|
||||||
@ -1625,7 +1625,7 @@ upload [options] container file_or_directory [file_or_directory] [...]
|
|||||||
'''.strip('\n')
|
'''.strip('\n')
|
||||||
|
|
||||||
|
|
||||||
def st_upload(options, args, print_queue, error_queue):
|
def st_upload(parser, args, print_queue, error_queue):
|
||||||
parser.add_option('-c', '--changed', action='store_true', dest='changed',
|
parser.add_option('-c', '--changed', action='store_true', dest='changed',
|
||||||
default=False, help='Will only upload files that have changed since '
|
default=False, help='Will only upload files that have changed since '
|
||||||
'the last upload')
|
'the last upload')
|
||||||
|
Loading…
Reference in New Issue
Block a user