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/0円versions0円container' 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
This commit is contained in:
3 changed files with 94 additions and 73 deletions
@@ -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):
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.