55 Commits

Author SHA1 Message Date
Jenkins
cb922f4dc6 Merge "Add v1password keystoneauth plugin" 2016-11-08 18:35:50 +00:00
Matthew Oliver
5296daad83 Correct the example keystone session code imports
This is a follow up to patch Ia3fd947ff619c11ff0ce474897533dcf7b49d9b3.
One of the imports for the keystone session example was wrong. It was
trying to import v3 like:

  from keystoneauth1 import v3

Whereas in my testing v3 actually exists deeper under identity:

  from keystoneauth1.identity import v3

This patch fixes this import in the example documentation.

Change-Id: Ie31144fe65116d20a36b83a96079a3804bf55f29
2016-10-29 11:43:02 +02:00
Jenkins
e9887703d0 Merge "Adding keystoneauth sessions support" 2016-10-26 11:41:21 +00:00
Tim Burke
a38efb6031 Add v1password keystoneauth plugin
This lets us use Keystone sessions against endpoints like swauth and
tempauth with code like:

    import keystoneauth1.loading
    import keystoneauth1.session
    import swiftclient

    loader = keystoneauth1.loading.get_plugin_loader('v1password')
    auth_plugin = loader.load_from_options(
        auth_url='http://saio:8080/auth/v1.0',
        username='test:tester',
        password='testing')
    keystone_session = keystoneauth1.session.Session(auth_plugin)

    conn = swiftclient.Connection(session=keystone_session)

The plugin includes an optional project_name option, which may be used
to override the swift account from the storage url that was returned.
Additionally, it includes enough infrastructure to support some commands
in python-openstackclient>=3.0:

    export OS_AUTH_TYPE=v1password
    export OS_AUTH_URL=http://saio:8080/auth/v1.0
    export OS_PROJECT_NAME=AUTH_test2
    export OS_USERNAME=test:tester
    export OS_PASSWORD=testing

    openstack token issue
    openstack catalog list
    openstack catalog show object-store
    openstack object store account show
    openstack container list
    openstack container create <container>
    openstack container save <container>
    openstack container show <container>
    openstack container delete <container>
    openstack object list <container>
    openstack object create <container> <file>
    openstack object save <container> <object>
    opsentack object show <container> <object>
    openstack object delete <container> <object>

Change-Id: Ia963dc44415f72a6518227e86d9528a987e07491
2016-10-24 01:52:37 +02:00
Anh Tran
ab7a8b2453 TrivialFix: Removed redundant 'the'
Change-Id: I3b3c0e7e4d5c8a1934378e2083a64bb686754f18
2016-09-27 16:10:14 +07:00
Jenkins
0feb83a00c Merge "Change Examples from headings to topics" 2016-09-05 18:55:01 +00:00
Jenkins
39b9db35a0 Merge "Add swift tempurl and swift auth command docstring" 2016-08-30 23:21:40 +00:00
zheng yin
8753c4dea3 Add swift tempurl and swift auth command docstring
Swift has commands including 'swift tempurl' and 'swift auth',
but it has no 'swift tempurl' and 'swift auth' in doc/source/cli.rst.
Therefore, I add them and their examples.

Change-Id: I9a935b648556e2718727d25ac553c860ebbadd82
2016-08-30 20:57:35 +00:00
Tim Burke
7cd7df410a Change Examples from headings to topics
Previously, they appeared in the table of contents, which seemed unnecessary.

Additionally, de-dent the bullet list for stat since it looked weird.

Change-Id: Ief5d480beb4a7daa2fd87c27019601332f087602
2016-08-26 13:50:31 -07:00
Jenkins
a2371cc6d8 Merge "Fix examples and missing code-block" 2016-08-25 20:29:54 +00:00
Joel Wright
daed43a44a Fix examples and missing code-block
This patch fixes a missing code-block section in the
capabilities section of service-api.rst, and fixes
the import of walk in the upload.py examples to support
both python2 and python3.

Change-Id: I572769f971f84e0029f2948e42c130e73517f434
2016-08-25 11:27:49 +00:00
Jenkins
b57044a853 Merge "Add copy object method" 2016-08-24 23:59:34 +00:00
Marek Kaleta
4a2465fb12 Add copy object method
Implement copy object method in swiftclient Connection, Service and CLI.

Although COPY functionality can be accomplished with 'X-Copy-From'
header in PUT request, using copy is more convenient especially when
using copy for updating object metadata non-destructively.

Closes-Bug: 1474939
Change-Id: I1338ac411f418f4adb3d06753d044a484a7f32a4
2016-08-23 14:37:11 -07:00
John Dickinson
ed4ee79273 reenable sidebar links
uses new method from https://review.openstack.org/#/c/340509/

Change-Id: I4d19b71b632546fc2e5d5dac2b0d8d43152dabed
2016-08-11 15:15:06 -07:00
Tim Burke
335570e511 Add --json option to swift capabilities / swift info
This lets us do things like:

    $ swift info --json | jq '[.swift.policies[].name]'
    [
      "Standard-Replica",
      "EC"
    ]

Also, escape more dashes in the man page, so they won't be
misinterpreted as hyphens.

Change-Id: Ic7690bdbcfc55f55e5dde9bc11bb0644085973ce
2016-08-02 16:18:44 -07:00
Shashirekha Gundur
5be9b7e310 fixing nit picks in python-swiftclient doc
Change-Id: Ifde19be175ea828a3137951a0382492434727b5b
2016-07-07 22:15:45 +00:00
Jenkins
c91c8d575e Merge "Add an option: disable etag check on downloads" 2016-06-06 10:33:25 +00:00
Cheng Li
69bf4634b9 Add an option: disable etag check on downloads
This patch is to add an option of disable etag
check on downloads.

Change-Id: I9ad389dd691942dea6db470ca3f0543eb6e9703e
Closes-bug: #1581147
2016-06-02 22:53:18 +08:00
Nandini Tata
2e78ca5e75 Fixed a typo in SwiftService API doc
Fixed misspelled word in the Service API description.

Change-Id: I0bb6b2aa319ba217dd0d09a2c7a0d8eff9a67aff
2016-06-01 15:12:10 +00:00
Paulo Ewerton
73e4296a38 Adding keystoneauth sessions support
This patch allows authentication in swiftclient with a keystonauth
session.

Co-Authored-By: Tim Burke <tim@swiftstack.com>

Change-Id: Ia3fd947ff619c11ff0ce474897533dcf7b49d9b3
Closes-Bug: 1518938
2016-05-19 17:27:31 -07:00
Joel Wright
3a5a25fe98 Add new doc structure and contents for swiftclient
As a result of the Hackathon we have produced a new
documentation structure for the python-swiftclient.
This patch introduces the new structure and adds the
required content.

The intention is to document the CLI, the SwiftService
and Connection API. Importantly, we also provide
guidance on important considerations when using a swift
object store, such as which aspect of the python-swiftclient
to use for various use cases, common authentication patterns
and some useful examples.

Co-Authored-By: Alexandra Settle <alexandra.settle@rackspace.com>
Co-Authored-By: Mohit Motiani <mohit.motiani@intel.com>
Co-Authored-By: Hisashi Osanai <osanai.hisashi@jp.fujitsu.com>

Change-Id: I9eb41f8e9137efa66cead67dc264a76a3c03fbda
2016-04-29 19:21:36 +01:00
Alexandra
671d6febb2 Minor edits to the api page
Change-Id: Ie65f73532e53a858ee9ab4b4634dcfcaf8a93c3b
2016-02-29 13:50:10 +00:00
Jenkins
4244b99b02 Merge "Update api docs title to make ToC better" 2016-02-24 03:26:39 +00:00
John Dickinson
011d730c9b Update api docs title to make ToC better
Change-Id: Ie8eeb3dd8eddf1868f0fa99911c459ae9f7b0091
2016-02-22 10:32:28 -08:00
Alexandra
f82d26063a New python swiftclient doc
Updating with new ToC to be worked on at hackathon

Change-Id: I55ee83626dd88fcc3e6352b3854b758dd7090590
2016-02-10 18:33:34 +10:00
Tim Burke
7a1e192803 Use bulk-delete middleware when available
When issuing `delete` commands that would require three or more
individual deletes, check whether the cluster supports bulk deletes
and use that if it's available.

Additionally, a new option is added to the `delete` command:

  * --prefix <prefix>

    Delete all objects that start with <prefix>. This is similar to the
    --prefix option for the `list` command.

Example:

$ swift delete c --prefix obj_prefix/

    ...will delete from container "c" all objects whose name begins with
    "obj_prefix/", such as "obj_prefix/foo" and "obj_prefix/bar".

Change-Id: I6b9504848d6ef562cf4f570bbcd17db4e3da8264
2016-01-12 15:40:57 -08:00
Jenkins
423ede01c4 Merge "New API documentation for python-swiftclient" 2015-12-10 20:28:52 +00:00
Joel Wright
a3a78be87b New API documentation for python-swiftclient
New documentation for python-swiftclient that introduces
the APIs available and gives some opinionated advice about
when to use the shell, the client API and the service API.

Change-Id: I19020f041fab2e72469979f712ffe3951c431d24
2015-11-25 15:15:09 +00:00
Peter Lisák
3b1f4fda72 Unification of manpages and docstrings
* adding missing options
* unification of help

Change-Id: I2365e66433b63de8fd4da205611d9c1bf3bb6730
2015-11-13 17:32:12 +01:00
Zack M. Davis
6b3638ecec enable autodocumentation for utils module; docstring fixes
This commit adds the utils module to those for which Sphinx
automatically generates documentation from docstrings. (Many of the
functions here may be of little interest to users, but
`generate_temp_url`, at least, definitely deserves to be in the
documentation; in this way, this commit can be seen as a spiritual
companion to ca70dd9e.)

Also, a few markup errors and perceived infelicities in existing
docstrings are amended.

Change-Id: I8c66a23cb359d7dd9302a16459fad9825fedb690
2015-09-10 15:19:26 -07:00
Zack M. Davis
52d39bebc1 absolute expiry option for tempURL generation
The `tempurl` subcommand's second positional argument is called
`seconds` and has heretofore interpreted as the number of seconds for
which the tempURL should be valid, counting from the moment of running
the command. This is indeed a common, if not the most common,
use-case. But some users, occasionally, might want to generate a tempURL
that expires at some particular ("absolute") time, rather than a
particular amount of time relative to the moment of happening to run the
command. (One might make an analogy to the way in which Swift's expiring
object support supports an `X-Delete-At` header in addition to
`X-Delete-After`—and it's the former that must be regarded as
ontologically prior.) Thus, this commit adds an `--absolute` optional
argument to the `tempurl` subcommand; if present, the `seconds` argument
will be interpreted as a Unix timestamp of when the tempURL should be
expire, rather than a duration for which the tempURL should be valid
starting from "now".

Change-Id: If9ded96f2799800958d5063127f3de812f50ef06
2015-09-04 14:57:30 -07:00
Zack M. Davis
ca70dd9e15 add tempurl command to swift.1 man page
Change-Id: Ifccc7f6dc049ca0ac2c53c00b1704cff4d1a770f
Closes-Bug: #1450606
2015-07-13 11:38:58 -07:00
Hirokazu Sakata
eb85f8c1a4 Add help message for "<subcommand> --help"
This patch fixed help message for "<subcommand> --help" in
general help message. Previous help message was only
"this help message". It has not described for subcommand.

Change-Id: I2fe6413baf98ba3881425ee6bed29c618e29fff8
Closes-Bug: 1420253
2015-02-10 20:52:17 +09:00
Joel Wright
24673f8d19 Add importable SwiftService incorporating shell.py logic
This patch adds a SwiftService class that incorporates the high
level logic from swiftclient/shell.py. It also ports shell.py to
use the new class, and updates the code in swiftclient/multithreading.py
to allow the SwiftService to be used for multiple operations whilst
using only one thread pool.

Currently, code that imports swiftclient has to have its own logic for
things like creating large objects, parallel uploads, and parallel
downloads. This patch adds a SwiftService class that makes that
functionality available in Python code as well as through the shell.

Change-Id: I08c5796b4c01001d79fd571651c3017c16462ffd
Implements: blueprint bin-swift-logic-as-importable-library
2014-08-26 14:14:21 +02:00
Steve Martinelli
6b836ac368 Update theme for docs
The current developer docs theme used is out of sync with the other
openstack projects. This patch will update the docs to provide a more
consistent look and feel when using developer docs

Change-Id: I2c66f60f6cfdd7b7b50a457c931f11851f668fa6
2014-07-24 20:59:45 -04:00
Christian Berendt
d08bd458be fixed several pep8 issues
* E111 indentation is not a multiple of four
  * E128 continuation line under-indented for visual indent
  * E265 block comment should start with '# '
  * E713 test for membership should be 'not in'

Tested with pep8 version 1.5.6 (2014-04-14).

Change-Id: I7f85c143d463c501a0df20724362ad5c0f2d4dde
2014-05-21 16:31:53 +00:00
Thomas Goirand
822274b637 swift.1 manpage fix for groff warnings
The current manual page contains hyphens where a minus sign
was intended. By default, "-" chars are interpreted as
hyphens (U+2010) by groff, not as minus signs (U+002D).
Since options to programs use minus signs (U+002D), this
means for example in UTF-8 locales that you cannot cut and
paste options, nor search for them easily.

This patch fixes this by escaping hyphens with backslashes,
and also fixes a typo: s/retreived/retrieved/.

Change-Id: If954c91eebe7b39bdac792f1f126998d2e3bcb8e
2014-02-18 11:42:18 +08:00
Fabien Boucher
533c9c5ba1 Add capabilities option
This patch adds a capabilities option on swiftclient.
This option uses the new /info endpoint to request the
remote capabilities and nicely display it.

Change-Id: Ie34b454511d5527e402e66e1fdb72120f427f2fd
2014-01-17 10:26:34 +01:00
Taurus Cheung
26ecec0f6d Add --object-name
Add parameter --object-name, which:
1) Sets target object name when upload single file
2) Sets object prefix when upload a directory

Change-Id: Idc4357c3355e66d31c100540b901e70db20b03c3
Closes-Bug: 1012979
2013-12-24 10:27:17 +08:00
Matthieu Huin
3cabda8c48 Allow custom headers when using swift download (CLI)
This fixes bug #1051046

A repeatable option, --header or -H, is added so a user can specify
custom headers such as Range or If-Modified-Since when downloading
an object with the swift CLI.

Change-Id: I1f7dcf64cf625f2e5a4488c210894cfe6e0d5974
2013-11-04 17:41:55 +01:00
Alex Gaynor
ff6ba367fa Replaced two references to Cloud Files with Swift
Change-Id: I721f2b25a255a829c625b34928b066df3cd3e632
2013-11-01 11:40:44 -07:00
Samuel Merritt
7d61c54399 Make pbr only a build-time dependency.
This lets you build python-swiftclient packages that don't require pbr
to be installed at all. You would need pbr on the machine running
rpmbuild / debuild, but not on the machines that install the packages.

Unfortunately, this does not make python-swiftclient able to be
installed via pip 0.3.1 on Lucid; you'll need to uninstall the system
python-pip package and install a new pip some other way. Given that
pip < 1.3 doesn't perform SSL certificate validation for pypi (trivial
MITM attack, anyone?), you'd probably want to get a new pip anyway.

Change-Id: I85d4d77aacf094e48d39e48e750594b95dbc7af0
2013-10-10 11:57:47 -07:00
Darrell Bishop
9198e95468 Move multi-threading code to a library.
This patch extracts the multi-threading code from bin/swift into
swiftclient/multithreading and adds tests.  In particular, this new way
of doing it (with context managers) will prevent non-daemonic threads
from wedging the process when unexpected exceptions happen.

I enabled reporting of which lines, specifically, are not covered by
unit tests (added -m option to "coverage report" in .unittests).

This patch includes a drive-by fix for uploading a segmented file with
--use-slo when that object already exists.  A key of "name" was used
instead of "path", raising KeyError.

There's also another drive-by fix for uploading segmented objects with
--use-slo.  Commit 874e0e4427b80e1b15b74a1557b73ba9d61443ca regressed
this by removing the capturing of thread-worker results in
QueueFunctionThread.run().  This patch restores that functionality and
the feature (uploading SLO objects).

Change-Id: I0b4f677e4a734e83d1a25088d9a74f7d46384e53
2013-07-28 22:08:17 -07:00
Darrell Bishop
1d4d51b218 Allow storage url override for both auth vers.
When --os-storage-url is specified on the command-line to bin/swift, it
will override the used storage URL regardless of authentication for both
authentication version 1 and version 2.  This can be used to bypass a
load-balancer to hit a specific proxy server for testing/debugging
purposes.

Within the client library, this feature is accessed by passing the
desired storage URL into swiftclient.client.Conection.__init__() via the
os_options keyword argument.  For example:

  conn = Connection(auth_url, user, key, os_options={
    'object_storage_url': 'http://overridden.storage.url/AUTH_foo'})

This patch also adds a dependency on mock>=0.8.0, which is the same as
openstack/swift.

Change-Id: Id2a36ed6abffd65e7762b6beea5bbfc6c036e848
2013-07-05 14:12:59 -05:00
Mark Seger
17bb3fa779 Add -l and --lh switches to swift 'list' command
Also updated man page and added an example in 'list'
command help message

Change-Id: Icf38de9bab6d387a9a1deed444a91f68b4389cfe
2013-06-10 16:49:44 +00:00
Pete Zaitcev
07311a0639 Update the man page
- Add -V option
- Use uniform and correct capitalization for OpenStack Swift
- Make the example of output of stat command up-to-date
- Generally prettify the document
- Remove all trailing whitespace

Change-Id: Id3da2035851847c4bff8cec8f927d3654824bf5b
2013-05-21 15:34:21 -06:00
Pete Zaitcev
d79c435bfe Add client man page swift.1
This is the byte-by-byte copy of swift.1 that was left behind
in the main Swift package when python-swiftclient was split away.
Apparently there is absolutely nothing to be changed in setup.py
and the distribution packagers are supposed to pick the page as-is
using their packaging systems.

Change-Id: I24f238501589db940574eac61b89a1422fe2fd77
2013-02-26 12:47:34 -07:00
Monty Taylor
8b80285da6 Update to latest oslo version/setup.
Change-Id: I7bd38b950ef9fea8b6eaa1df599085a1c64d8b61
2013-01-14 03:29:22 -08:00
Ray Chen
93b5997843 PEP8 issues fixed
1. Have a better indent in doc/source/conf.py
2. Fix an import issue

Change-Id: I5811c195157706d2a85c0fd47666e67f94b2c558
2012-08-29 13:43:15 +08:00
lrqrun
3207e36984 Fix PEP8 issues.
Fix some pep8 issues in doc/source/conf.py make the code looks pretty.

Change-Id: Icc5ce260aaae8a2c436f5146840ffde4e6ef2839
2012-08-28 20:00:49 +08:00