Browse Source

Fix up curl commands when object name has unix dir characters

If an object name has something like /./ in it then curl will
resolve this. Need to use --path-as-is option for curl

Change-Id: I4e45cb62d41f6aada4fdbb00d86b4bd737b441ee
Closes-Bug: #1885244
changes/47/738147/1
Sam Morrison 1 week ago
parent
commit
5c087ad7b9
2 changed files with 3 additions and 3 deletions
  1. +1
    -1
      swift/cli/info.py
  2. +2
    -2
      test/unit/cli/test_info.py

+ 1
- 1
swift/cli/info.py View File

@@ -92,7 +92,7 @@ def curl_head_command(ip, port, device, part, target, policy_index):
else:
formatted_ip = ip

cmd = 'curl -g -I -XHEAD "http://%s:%s/%s/%s/%s"' % (
cmd = 'curl --path-as-is -g -I -XHEAD "http://%s:%s/%s/%s/%s"' % (
formatted_ip, port, device, part, urllib.parse.quote(target))
if policy_index is not None:
cmd += ' -H "%s: %s"' % ('X-Backend-Storage-Policy-Index',


+ 2
- 2
test/unit/cli/test_info.py View File

@@ -1200,7 +1200,7 @@ class TestPrintObjFullMeta(TestCliInfoBase):
os.chdir(cwd)

exp_curl = (
'curl -g -I -XHEAD '
'curl --path-as-is -g -I -XHEAD '
'"http://{host}:{port}/{device}/{part}/AUTH_admin/c/obj" '
'-H "X-Backend-Storage-Policy-Index: 2"').format(
host=node['ip'],
@@ -1241,7 +1241,7 @@ class TestPrintObjFullMeta(TestCliInfoBase):
os.chdir(cwd)

exp_curl = (
'curl -g -I -XHEAD '
'curl --path-as-is -g -I -XHEAD '
'"http://[{host}]:{port}'
'/{device}/{part}/AUTH_admin/c/obj" ').format(
host=node['ip'],


Loading…
Cancel
Save