20 Commits

Author SHA1 Message Date
Honza Pokorny
ae35a29169 Allow objects to be streamed to stdout
Change-Id: Icd8de6b2122fe77926d93da9bda08f56c3672a7a
2017-07-05 20:08:18 -03:00
Jordan Pittier
1cdc1319d6 Make 'object save' fast again
'openstack object save' is critically slow to download big objects. While
we 'stream' (chunked download) the data, the default chunks_size
is 1 byte [1], which is terribly inefficient.

[1] : http://docs.python-requests.org/en/master/api/#requests.Response.iter_content

Closes-Bug: 1654645


Change-Id: I2223e5897346acd2f2c1fae638d1193cff833c19
2017-01-09 16:19:29 +00:00
Rajasi Kulkarni
78312ca9af Add option "--name" to command "openstack object create"
Option "--name" can be used to set as the object name of
the file to be uploaded in the container. Similar to option
"--object-name" in command "swift upload". Added unit test case
to ensure an exception is raised when using option "--name" for
uploading multiple objects.

Change-Id: Ied7827841f6ca1cf9d4b48e304cbe5d62eda38ab
Closes-Bug: #1607972
2016-09-26 22:42:10 -04:00
shizhihui
f996138a0d Standardize import format
According to the rule in
http://docs.openstack.org/developer/hacking/#imports
I modify some irregular import format.

Change-Id: Ibf29ccaf3ddec4a956334cc3368ebee7a66e282c
2016-07-22 19:24:02 +08:00
Dean Troyer
e5e29a8fef osc-lib: utils
Use osc-lib directly for utils.

Leave openstackclient.common.utils for deprecation period.

Change-Id: I5bd9579abc4e07f45219ccd0565626e6667472f7
2016-06-13 10:50:44 -05:00
Yang Hongyang
059f54eee4 Clean up unnecessary import of urlparse module
six.moves.urllib already covers the py2 and py3 compatibility issues
of urlparse module, use six.moves.urllib.parse.urlparse is enough.

Change-Id: I785f4f872850e5d770fdcf4c0d3392be3978cc4a
2016-03-01 22:06:53 +08:00
ting.wang
e47c83d47a Py3 replace dict.iteritems with six.iteritems
All dict.iteritems in osc are replaced with six.iteritems
except this one.
So fix it to add py3 compatibility.

Change-Id: I1aa51399a36e650d262d839ce2b4ec04d3f91db2
2016-02-24 10:14:56 +08:00
ting.wang
e2158b7ef4 Clean redundant argument to dict.get
`dict.get()` returns `None` by default, if a key wasn't found.
Removing `None` as second argument to avoid redundancy.

Change-Id: Ia82f7469cd019509bbeccbfe54b15eeedc7bb6ea
2016-02-21 13:21:31 +08:00
Steve Martinelli
74a6a81ae9 when fetching object store properties use lower()
sometimes properties within object store concepts are stored with
mixed case depending on the client used to store said properties.

when retrieving properties to 'show' the user, always call lower()
on the property in question when comparing it to the reserved
values of the swift API.

Change-Id: I97ffc715788ca3cd021413124b6945a399465c99
Closes-Bug: 1525805
2015-12-14 12:23:44 -05:00
Steve Martinelli
cfd2bf5882 validate non-ascii values for swift properties
skip properties that are non-ascii values, but proceed
with properties that work. log these failed values back
to the user.

Change-Id: Iaca8909f4465a01c8aebfd290b1a322823702359
Closes-Bug: 1503898
2015-11-12 11:07:57 -06:00
Steve Martinelli
1f8b814628 Fix up object-store show commands
1) Change metadata to appear under a common 'properties' key, and
use the utility to format them, this applied to object, account
and container.

2) Clean up container and object output, which were setting the
x-container-meta-owner property, but this is metadata only for
the container, so it's pointless to have, removed it.

3) Container show was showing read/write ACLs and sync stuff, but
these are not being returned by my swift by default, so I moved
these to be checks, so we don't clutter the output.

Change-Id: Ife7521fe9c2724035b06963c118bd6016ba2f5b5
2015-10-10 11:48:07 -04:00
lin-hua-cheng
985b2cdd2c Fix non-ascii issue with object commands
Escape the container and object name whenever it is used
as URL.

Change-Id: I2343c1e67843ab53773b3fca6e258dc329cd9573
Closes-Bug: #1503508
2015-10-06 23:26:08 -07:00
Steve Martinelli
e48c7afee4 add set/unset support for objects in object store
add docs and command support to set and unset metadata of objects
that are stored in an object store (swift).

Closes-Bug: #1501945

Change-Id: If838a4b3343b6ddb97cd4bd1cb63f0ba1c1a00a1
2015-10-06 00:52:24 -04:00
Steve Martinelli
abaf711e24 add support for set/unset of container properties
include docs and commands to set and unset container properties

Partial-Bug: #1501945

Change-Id: I8d7e8cf356a2321a37ed940c4e10cae411b94dfd
2015-10-06 00:18:59 -04:00
Steve Martinelli
faece91756 cleanup account ids from container commands
use a common function to determine account ID instead of different
ways - depending on the response and command

Change-Id: I95adc5dc7d5a82a2cffc570d1ded24d1fc754a11
2015-10-02 01:20:40 +00:00
Steve Martinelli
4733fd0d3c Add support for showing account details
add the command `openstack account show` that lists details
about the object store account that the user authenticated
against.

Partial-Bug: #1501943

Change-Id: I1246dafee812b63a41d43be4e3598224364a2c11
2015-10-02 01:20:06 +00:00
Steve Martinelli
a4483a0513 Add support for updating swift account properties
this patch adds support for creating/updating and removing
properties (nee: metadata) for object store accounts.

Partial-Bug: #1501943

Change-Id: I3ed70a5d8bd8920fedb79adc60cdc602261d5eef
2015-10-01 18:18:36 -07:00
Dean Troyer
bcf4b3caec Update use of open() in object API
* Switch to use io.open() for py3 compatibility and simpler testing.
* Open files in 'rb' mode to avoid translation on Windows

Previously tests simply relied on files that were present in the
repository to run tests using open().  Change the filenames to ensure
that no longer happens.

requests_mock doesn't have a way to match against the request body for
PUT/POST; an attempt to add a new Matcher to do that worked but it
needs to subclass the currently private adapter._Matcher class or
duplicate most of its functionality.

Change-Id: I8c30b41db20af8ecafe67e760e872fc08adec905
2014-10-13 10:34:11 -05:00
Steve Martinelli
388bbbac2c Fix issues with object related commands
1) Can't create instance of swiftclient. Since we now create
an API instance, creating a swiftclient instance won't work.
Trying to do any object related command fails.

2) Listing objects in a container fails, we depend on the
data returned in a specific way, during the API transition
this must have slipped through.

Needs regression/funcitonal tests to mame sure this doesn't
happen again.

Change-Id: I69079a0dc9f32b84e6f9307729d3dbbba549ac5e
2014-10-06 20:04:19 -04:00
Dean Troyer
31018bf7c2 Move object-store commands to low-level API
api.object_store.APIv1 now contains the formerly top-level functions
implementing the object-store REST client. This replaces the old-style
ObjectClientv1 that is no longer necessary.

Change-Id: I7d8fea326b214481e7d6b24119bd41777c6aa968
2014-10-01 13:50:13 -04:00