summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorTim Burke <tim.burke@gmail.com>2020-04-28 10:45:27 -0700
committerTim Burke <tim.burke@gmail.com>2020-06-08 12:03:56 -0700
commit1dfa41dada30c139129cb2771b0d68c95fd84e32 (patch)
treeb422008de26728700f1ac6c6ecefff8f2ae2d8d0 /bin
parent69b8165cd87693f077a2385d9b6d53a7f459b098 (diff)
downloadswift-1dfa41dada30c139129cb2771b0d68c95fd84e32.tar.gz
swift-get-nodes: Allow users to specify either quoted or unquoted paths
Now that we can have null bytes in Swift paths, we need a way for operators to be able to locate such containers and objects. Our usual trick of making sure the name is properly quoted for the shell won't suffice; running something like swift-get-nodes /etc/swift/container.ring.gz $'AUTH_test/\0versions\0container' has the path get cut off after "AUTH_test/" because of how argv works. So, add a new option, --quoted, to let operators indicate that they already quoted the path. Drive-bys: * If account, container, or object are explicitly blank, treat them as though they were not provided. This provides better errors when account is explicitly blank, for example. * If account, container, or object are not provided or explicitly blank, skip printing them. This resolves abiguities about things like objects whose name is actually "None". * When displaying account, container, and object, quote them (since they may contain newlines or other control characters). Change-Id: I3d10e121b403de7533cc3671604bcbdecb02c795 Related-Change: If912f71d8b0d03369680374e8233da85d8d38f85 Closes-Bug: #1875734 Closes-Bug: #1875735 Closes-Bug: #1875736 Related-Bug: #1791302
Diffstat (limited to 'bin')
-rwxr-xr-xbin/swift-get-nodes2
1 files changed, 2 insertions, 0 deletions
diff --git a/bin/swift-get-nodes b/bin/swift-get-nodes
index 3d944bf56..5bc21c945 100755
--- a/bin/swift-get-nodes
+++ b/bin/swift-get-nodes
@@ -52,6 +52,8 @@ if __name__ == '__main__':
help='Specify which policy to use')
parser.add_option('-d', '--swift-dir', default='/etc/swift',
dest='swift_dir', help='Path to swift directory')
+ parser.add_option('-Q', '--quoted', action='store_true',
+ help='Assume swift paths are quoted')
options, args = parser.parse_args()
if set_swift_dir(options.swift_dir):