summaryrefslogtreecommitdiff
path: root/swiftclient
Commit message (Collapse)AuthorAgeFilesLines
* Have `delete --all` imply `--versions` for the CLITim Burke2020-10-161-2/+4
| | | | Change-Id: Id5a6d4cef3d4ed76c897a099a62a4ba3ed8f8dab
* Merge "Close connections created when calling module-level functions"Zuul2020-10-151-17/+70
|\
| * Close connections created when calling module-level functionsTim Burke2020-10-131-17/+70
| | | | | | | | | | | | | | | | Co-Authored-By: Clay Gerrard <clay.gerrard@gmail.com> Change-Id: Id62e63afc6f2ffa32eb8640787c78559481050f9 Related-Change: I200ad0cdc8b7999c3f5521b9a822122bd18714bf Related-Bug: #1873435 Closes-Bug: #1838775
* | Merge "Include transaction ID in ClientException.__str__"Zuul2020-09-222-2/+13
|\ \ | |/ |/|
| * Include transaction ID in ClientException.__str__Tim Burke2020-09-092-2/+13
| | | | | | | | | | | | | | | | | | | | It's fairly annoying getting a traceback in swift's probe tests then only having a URL and status code to go searching for in logs. Leave the shell.py output untouched, though, since we output the transaction ID on a new line anyway. Change-Id: Idb849848ec08b6c04812b088467c9a687c2a7e27
* | (Mostly) revert "Cleanup session on delete"Tim Burke2020-09-081-8/+10
|/ | | | | | | | | | This reverts commit 1f26c5736949e1c3b57c024a315e33fc419f126e for py2. Apparently the existence of the __del__ method on Python 2 prevents us from cleaning up all file descriptors. Change-Id: Id6cff5dd7b9faf9c4240c0cb26b74d05ed37da5b Closes-Bug: #1873435 Related-Bug: #1838775
* Add max_backoff and starting_backoff for get_conn in swift serviceMeuh2020-07-281-2/+4
| | | | Change-Id: I45f5d3009e0e2015c7366384ee826113fc27c70b
* Clean up some warningsTim Burke2020-06-171-2/+5
| | | | Change-Id: Iae149533d04c7b173c4ef88fb775f5fe13c16466
* Application credential support follow-upTim Burke2020-05-272-16/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Following the recent v3applicationcredentials patch, if you have your environment variables set up to work with python-openstackclient using swiftclient's v1password plugin, swiftclient won't work: $ env | egrep '^(OS|ST)_' ST_KEY=testing ST_USER=test:tester OS_AUTH_URL=http://saio/auth/v1.0 ST_AUTH=http://saio/auth/v1.0 OS_USERNAME=test:tester OS_AUTH_TYPE=v1password OS_PASSWORD=testing $ openstack object store account show +------------+----------------------------+ | Field | Value | +------------+----------------------------+ | Account | AUTH_test | | Bytes | 0 | | Containers | 11 | | Objects | 0 | +------------+----------------------------+ $ swift stat Only "v3applicationcredential" is supported for --os-auth-type We don't really want to allow (and mostly ignore) arbitrary OS_AUTH_TYPE values, though -- there are a whole bunch of plugins we don't remotely support. But it seems OK to allow any of the password plugins; while we won't actually use them (currently), we provide roughly equivalent functionality. Handful of other drive-bys: * Use a None sentinel to determine whether keystoneauth1 is installed instead of trying to catch a NameError. * Clarify error state when keystoneauth1 is not installed. * Fix a typo: "sses" -> "sess". Change-Id: Id7ea9c3ea8278ae86a04d057a472a8f8a87b8eae Related-Change: I9190e5e7e24b6a741970fa0d0ac792deccf73d25
* Merge "Support v3 application credentials auth."Zuul2020-05-133-14/+112
|\
| * Support v3 application credentials auth.Charles Hsu2020-04-163-14/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Use keystoneauth1 application credential plugin and session to fetch a token and endpoint catalog url. $ swift --os-auth-url http://172.16.1.2:5000/v3 --auth-version 3\ --os-application-credential-id THE_ID \ --os-application-credential-secret THE_SECRET \ --os-auth-type v3applicationcredential auth Change-Id: I9190e5e7e24b6a741970fa0d0ac792deccf73d25 Closes-Bug: 1843901 Closes-Bug: 1856635
* | Fixed capability discovery endpoint hardcodeIvan Kolodyazhny2020-04-241-2/+15
|/ | | | | | | | | | It fixes get_capabilities() method to process correctly endpoints like: 'https://<ip>:<port>/v1', 'https://<ip>:<port>/swift/v1'. Co-Authored-By: Daniel Cech <dcech@mirantis.com> Change-Id: Ib4037d0b49da1bce959947100629370805f510d5 Closes-bug: #1712358
* Improve `list --versions` outputTim Burke2020-04-101-4/+11
| | | | | | | | | | Have `--versions` imply `--long` and add a new column for version_id. Also, have version-aware listings show all versions as "null" on old Swifts that don't support object versioning (or when object versioning is not enabled). Change-Id: I0e009bce2471d1c140ac9b83700591cb355fee3f
* object versioning featuresClay Gerrard2020-04-084-28/+163
| | | | | | | | | | * add --versions to list * add --versions to delete * add --version-id to stat * add --version-id to delete * add --version-id to download Change-Id: I89802064921778fee7efe57c7d60c976cdde3a27
* Merge "Add test for bulk-delete-attempt-counter fix"Zuul2020-01-161-1/+1
|\
| * Add test for bulk-delete-attempt-counter fixTim Burke2019-11-151-1/+1
| | | | | | | | | | | | Change-Id: Ifdeefeb4a5a3fc6895bd6cda695684de02f8c602 Related-Change: If4af9141fe4f3436a4e9e0e2dfc24c6ec7292996 Related-Bug: #1852808
* | Merge "Cleanup session on delete"Zuul2019-12-091-0/+9
|\ \ | |/ |/|
| * Cleanup session on deleteAlex Schultz2019-12-081-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | If an external http connection was not passed into the client, we create one with a requests.Session() on our own. Once this is used, it may still have an open socket when the connection is closed. We need to handle the closing of the requests.Session() ourselves if we created one. If you do not close it, a ResourceWarning may be reported about the socket that is left open. Change-Id: I200ad0cdc8b7999c3f5521b9a822122bd18714bf Closes-Bug: #1838775
* | Fix printed object names on successful bulk-deleteSébastien Blaisot2019-11-151-4/+2
| | | | | | | | | | | | | | | | | | Replace the 1 always concatenated to printed object names for each successfully deleted object in bulk-delete with an optional [after x attempts] if x > 1 Change-Id: If4af9141fe4f3436a4e9e0e2dfc24c6ec7292996 Closes-Bug: 1852808
* | v1auth: support endpoint_data_for() apiTim Burke2019-11-061-1/+11
| | | | | | | | | | | | | | | | ...so we can be used with openstacksdk. Also, add a few functests that use openstacksdk. Change-Id: Ie6987f5de48914ec8932254cde79a973a0264877
* | docs: Fix warning treated as errorTim Burke2019-09-041-0/+6
|/ | | | Change-Id: I669533334419e94ca925e859f2b0d5d2afe9f7f1
* Merge "Fix up requests so we can send non-RFC-compliant headers on py3"Zuul2019-08-021-2/+4
|\
| * Fix up requests so we can send non-RFC-compliant headers on py3Tim Burke2019-07-251-2/+4
| | | | | | | | Change-Id: I3dac826c1f208569c5f40431f59a2045e5744415
* | Delete/overwrite symlinks betterTim Burke2019-08-011-2/+4
|/ | | | | | | | | | | | | Previously, when deleting a symlink that points to an xLO, we'd clean up the xLO's segments then delete the symlink, leaving the xLO itself busted. Similar trouble would come from overwriting a symlink pointing to an xLO. Check for a Content-Location in the HEAD response and leave such segments. Co-Authored-By: Clay Gerrard <clay.gerrard@gmail.com> Change-Id: I45b210cf380a68bd88187c91fa2d63a8b2bb709b
* Merge "Optionally display listings in raw json"Zuul2019-07-102-1/+40
|\
| * Optionally display listings in raw jsonClay Gerrard2019-07-092-1/+40
| | | | | | | | | | | | | | | | | | | | | | | | Symlinks have recently added some new keys to container listings. It's very convenient to be able to see and reason about the extra information in container listings. Allowing raw json output is similar with what the client already does for the info command, and it's forward compatible with any listing enhancements added by future middleware development. Change-Id: I88fb38529342ac4e4198aeccd2f10c69c7396704
* | Merge "Add missing <sync-to> value in command line docs"Zuul2019-07-091-1/+1
|\ \ | |/ |/|
| * Add missing <sync-to> value in command line docsKota Tsuyuzaki2018-02-231-1/+1
| | | | | | | | | | | | Because it should take a value of either realm or full url. Change-Id: I1fe30825ef1620e256c9fd3057da6808b03d7200
* | Merge "Clean up warnings from newer flake8"Zuul2019-06-283-1/+3
|\ \
| * | Clean up warnings from newer flake8Tim Burke2019-06-273-1/+3
| | | | | | | | | | | | Change-Id: I18a6327b3acdd4db5ae80097080c043f7c20c353
* | | Fix SLO re-uploadTim Burke2019-06-272-16/+22
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, if you uploaded a file as an SLO then re-uploaded it with the same segment size and mtime, the second upload would go delete the segments it just (re)uploaded. This was due to us tracking old_slo_manifest_paths and new_slo_manifest_paths in different formats; one would have a leading slash while the other would not. Now, normalize to the stripped-slash version so we stop deleting segments we just uploaded. Change-Id: Ibcbed3df4febe81cdf13855656e2daaca8d521b4
* | Isolate docs requirementsTim Burke2019-06-272-1/+9
| | | | | | | | | | | | | | | | | | | | | | ...since modern sphinx won't install on py27. While we're at it, clean up some warnings and treat warnings as errors. Also, fix up how we parse test configs so we can run func tests. Related-Change: Id3c2ed87230c5918c18e2c01d086df8157f036b1 Change-Id: I3718f69610545b0dbcb0a2ab45b400da3a45682c
* | Make proper functions instead of assigning lambdasTim Burke2019-02-212-2/+6
| | | | | | | | Change-Id: I89255f6923c649c7b9d3d36e96c09f8bc4f51a3c
* | Update hacking versionZhijunWei2019-01-033-22/+23
| | | | | | | | | | | | | | 1. update hacking version to latest 2. fix pep8 failed Change-Id: Ifc3bfeff4038c93d8c8cf2c9d7814c3003e73504
* | Add delimiter to get_account().Timur Alperovich2018-11-301-7/+12
| | | | | | | | | | | | | | Exposes the delimiter parameter, which the Swift API supports for container listings. Change-Id: Id8dfce01a9b64de9d1222aab9a4a682ce9e0f2b7
* | Stop leaking quite so many connectionsTim Burke2018-11-091-12/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | While investigating the failures when you move func tests to py3, I noticed a whole bunch of ResourceWarning: unclosed <socket.socket ...> noise. This should fix it. While we're at it, make get_capabilities less stupid. Change-Id: I3913e9334090b04a78143e0b70f621aad30fc642 Related-Change: I86d24104033b490a35178fc504d88c1e4a566628
* | Stop lazy importing keystoneclientTim Burke2018-09-071-23/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There were two basic problems: - We'd try to import on every attempt at getting auth, even when we already know keystoneclient isn't available. - Sometimes devs would hit some crazy import race involving (some combination of?) greenthreads and OS threads. So let's just try the imports *once*, at import time, and have None sentinels if it fails. Try both versions separately to decouple failures; this should let us support a wider range of keystoneclient versions. Change-Id: I2367310aac74f1b7c5ea0cb1a822a491e4ba8e68
* | Merge "Remove unnecessary calls to parse_header_string()."3.6.0Zuul2018-07-251-8/+2
|\ \
| * | Remove unnecessary calls to parse_header_string().Timur Alperovich2018-07-241-8/+2
| | | | | | | | | | | | | | | | | | | | | | | | Since we define the getheader() method on the response from HTTPConnection, we don't have to call parse_header_string, as the values will already be converted properly. Change-Id: Ia81e8674b828b3ff1f014454126b469e41adfc23
* | | Merge "Back out some version bumps"Zuul2018-07-241-3/+8
|\ \ \ | |/ / |/| |
| * | Back out some version bumpsTim Burke2018-07-111-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I'm giving up on trying to back out all of the test-requirements up-revs, but let's try to stay compatibile with old requests/six. As part of that, only disable some requests warnings on new-enough requests. Note that we should now be compatible with distro packages back to Ubuntu 16.04 and CentOS 6. Our six is still too new for Trusty, but hey, there's less than a year left on that anyway, right? Change-Id: Iccb23638393616f9ec3da660dd5e39ea4ea94220 Related-Change: I2a8f465c8b08370517cbec857933b08fca94ca38
* | | Merge "Properly handle unicode headers."Zuul2018-07-241-5/+24
|\ \ \
| * | | Properly handle unicode headers.Timur Alperovich2018-07-231-5/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix unicode handling in Python 3 and Python 2. There are currently two failure modes. In python 2, swiftclient fails to log in debug mode if the account name has a non-ASCII character. This is because the account name will appear in the storage URL, which we attempt to pass to the logger as a byte string (whereas it should be a unicode string). This patch changes the behavior to convert the path strings into unicode by calling the parse_header_string() function. The second failure mode is with Python 3, where http_lib returns headers that are latin-1 encoded, but swiftclient expects UTF-8. The patch automatically converts headers from latin-1 (iso-8859-1) to UTF-8, so that we can properly handle non-ASCII headers in responses. Change-Id: Ifa7f3d5af71bde8127129f1f8603772d80d063c1
* | | | Add close() to _RetryBody.Timur Alperovich2018-07-201-0/+3
|/ / / | | | | | | | | | | | | | | | | | | Allows clients to give up on reading the rest of the server response, if they so choose. Change-Id: Iccc95b1b5e7d066470966ee0c62a3beb260846e5
* | | Merge "Stop mutating header dicts"Zuul2018-07-171-31/+34
|\ \ \
| * | | Stop mutating header dictsTim Burke2017-08-251-31/+34
| | | | | | | | | | | | | | | | Change-Id: Ia1638c216eff9db6fbe416bc0570c27cfdcfe730
* | | | Add bash_completion to swiftclientMatthew Oliver2018-07-131-99/+213
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch basically follows the bash completion model that other OpenStack clients use. It creates a new command to swiftclient called `bash_completion`. The `bash_completion` command by default will print all base flags and exsiting commands. If you pass it a command, it'll print out all base flags and any flags that command accepts. So as you type out your swift command and auto-complete, only the current available flags are offered to you. This is used by the swift.bash_completion script to allow swift commands to be bash completed. To make it work, place the swift.bash_completion file into /etc/bash_completion.d and source it: cp tools/swift.bash_completion /etc/bash_completion.d/swift source /etc/bash_completion.d/swift Because swiftclient itself is creating this flag/command output it should automatically add anything we add to the swiftclient CLI. Change-Id: I5609a19018269762b4640403daae5827bb9ad724
* | | | Merge "Treat 404 as success when deleting segments"Zuul2018-07-121-9/+10
|\ \ \ \
| * | | | Treat 404 as success when deleting segmentsTim Burke2018-01-261-9/+10
| | |_|/ | |/| | | | | | | | | | Change-Id: I76be70ddb289bd4f1054a684a247279ab16ca34a
* | | | Add ability to generate a temporary URL with anmmcardle2018-07-102-4/+32
| |_|/ |/| | | | | | | | | | | | | | IP range restriction Change-Id: I4734599886e4f4a563162390d0ff3bb1ef639db4