70 Commits

Author SHA1 Message Date
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
Dean Troyer
110a62f277 Add importing file to import warnings
Add the Python file doing the import to the warnings emitted by
the modules moved to osc-lib. Users will at least have a hint as
to which package is out-of-date.

Change-Id: I633b440c30b2b15cfde7a9013e30dfa39ab200bc
2016-08-30 09:21:02 -05: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
ji-xuepeng
17f177bb71 remove unused LOG
This is to remove unused LOG to keep code clean.

Change-Id: Ic544157b19cefb4120381f3314334c60a9020baf
2016-07-09 23:23:38 +08:00
Dean Troyer
d324530532 osc-lib: api.auth
Move auth plugin checking to osc-lib.

Change-Id: I673d9c2d6e8bbf724c3000459a729e831d747814
2016-06-30 08:57:59 -05:00
Dean Troyer
ccbb2dd1e8 Remove OSCGenericPassword plugin
The need for this has passed plus with 3.0 we can take the breakage hit,
if any.

Change-Id: Ic019842f00033d2cd67b75f036e7e817e4b7c075
2016-06-22 13:54:32 -05:00
Dean Troyer
cefe715031 Fix token/endpoint auth plugin
[This is not quite reduced from the original proposed fix as some
changes have merged that complicate the switch to OSC_Config and
v2 auth broke anyway.]

Fix the --os-token --os-url breakage in the switch to ksa.

Closes-bug: 1593664
Change-Id: I3ac23234fbf647fb145c7bd151d53c5c105462bf
2016-06-21 14:54:31 -05:00
Alvaro Lopez Garcia
099a2c38b9 Refactor setting defaults for some scope parameters
The code is setting defaults for some scope parameters, cheking if the
name ends with some specific substring (namely ending in "password")
causing failures in some plugins that end with the same string, but do
not allow those parameters (like "user_domain_id" in "v3oidcpassword").

Closes-Bug: #1582774
Change-Id: Id7036db3b783b135353d035dc4c1df7c808d6474
2016-06-21 08:55:30 +02:00
Alvaro Lopez Garcia
78ae57112c Refactor check_valid_auth_options function
The functions check_valid_auth_options() function was relying on the name
for checking the set of required options, but this could cause errors
with external auth plugins. If somebody defines an auth plugin plugin
named "footoken" the check function would check for a "token" option,
even if the plugin has not defined that option. This change tries to
improve this situation, cheking for some options only if they have been
defined in the plugin.

Change-Id: I4255f2e7d4d23449c95be957ea7b6b60983f2608
2016-06-21 08:54:36 +02:00
Dolph Mathews
fe0c8e955b Do not prompt for scope options with default scoped tokens
This changes the scope validation to occur after a token has already
been created.

Previous flow:

1. Validate authentication options.
2. Validate authorization options if the command requires a scope.
3. Create a token (using authentication + authorization options)
4. Run command.

This means that scope was being checked, even if a default scope was
applied in step 3 by Keystone.

New flow:

1. Validate authentication options.
2. Create token (using authentication + authorization options)
3  Validate authorization options if the command requires a scope and
   the token is not scoped.
4. Run command.

Change-Id: Idae368a11249f425b14b891fc68b4176e2b3e981
Closes-Bug: 1592062
2016-06-17 12:37:15 -04:00
Huanxuan Ao
f25a3519c5 Fix missing i18n supports in api/ and shell.py
Change-Id: I28d79d7f44b27d2b600dedad2a3601180650ad83
Partial-bug: #1574965
2016-06-14 11:03:56 -05: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
Dean Troyer
d20c863ebc osc-lib: exceptions
Use osc-lib directly for exceptions.

Leave openstackclient.common.exceptions for deprecation period.

Change-Id: Iea3e862302372e1b31ccd27f69db59b4953ca828
2016-06-13 10:50:01 -05:00
Navid Pustchi
6ae0d2e8a5 Moving authentication from keystoneclient to keystoneauth
Currently OpenStackClient uses keystoneclient for authentication.
This change will update OpenStackClient to use keystoneauth for
authentication.

All dependant test have been updated.

Updating how auth_ref is set in the tests to use KSA fixtures had
some racy side-effects.  The user_role_list tests failed when they
picked up an auth_ref that was a fixture.  This exposed a weakness
in ListUserRole that needed to be fixed at the same time re
handling of unscoped tokens and options.

Change-Id: I4ddb2dbbb3bf2ab37494468eaf65cef9213a6e00
Closes-Bug: 1533369
2016-06-09 18:00:40 +02:00
Madhu Mohan Nelemane
a4d4e81c88 Avoid TypeError on message object additions
Change-Id: I634c1e158e93eeb55ab17fef8a0715b6678dffec
Closes-Bug: #1575787
2016-05-19 18:07:53 -07:00
Dao Cong Tien
67a8947ea2 Fix typos in docstrings and comments
Change-Id: Ic2dc057dca87212f715970f8325956c42f62ea9f
2016-04-06 10:30:39 +07:00
Jenkins
77f2e98466 Merge "Clean up unnecessary import of urlparse module" 2016-03-01 23:51:00 +00: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
Yang Hongyang
8b17a1fa5b Trivial: Update image_list v2 docs
This api doc is clearly copied from v1, we should update it to reflact v2 API.
Added 'shared' param description.

Change-Id: I73d36e3a2a0448c28edab788a9340fd46177f8ef
2016-03-01 18:48:09 +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
Brandon Palm
11a8f911af Use instanceof instead of type
Adjusted conditional statements to use instanceof when
comparing variables. Instanceof supports inheritance type
checking better than type.

Change-Id: I4ee0004934dc2322d43ef07e797a6811e39a812c
Closes-Bug: 1548530
2016-02-22 16:23:23 -06: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
Jenkins
867bcb0db8 Merge "Support unscoped token request" 2016-02-21 04:31:51 +00:00
ting.wang
5a978b9ec1 Replace string format arguments with function parameters
There are files containing string format arguments inside logging messages.
Using logging function parameters should be preferred.

Change-Id: I15b405bf4d4715263fe1e1262982467b3d4bc1f4
Closes-Bug: #1321274
2016-02-20 14:16:25 +08:00
guang-yee
41e1bd0be6 Support unscoped token request
Make scope check optional for the "token issue" command as unscoped token is
a valid Keystone V2/V3 API.

Change-Id: Ie1cded4dbfdafd3a78c0ebdf89e3f66762509930
Closes-Bug: #1543214
2016-02-19 16:07:13 -08:00
venkatamahesh
65007432dc Fix a spell typos
Change-Id: I422fc8086af83efa4c04fd1951b4738404c1a1b7
2016-02-03 15:47:25 +05:30
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
Terry Howe
7a42174c4b Remove old code after sdk integration
We won't need this anymore.

Change-Id: Ib10be1dedb8db81f0cba6e45b8a9b0aade2ab473
2015-12-09 11:45:59 -07:00
Dean Troyer
bf090c69c2 Switch to ksa Session
* Change session imports to keystoneauth1
* Change keystoneclient.exception imports to keystoneauth1
* Change exceptions raised from internal API from keystoneclient to openstack.common

Change-Id: I046d89f561d6fe04baae53726f9749d2e7fe2056
2015-12-02 01:55:14 +00: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
Joshua Harlow
d751a21d2c Fix 'auhentication' spelling error/mistake
Change-Id: Iba58c188d2ae44170539534eea1415cf8eb65ac4
2015-09-01 15:51:58 -07:00
Dave Chen
9f69b43f5a Improve the hint message
Currently, we can get scoped token (domain scoped, project scoped)
as well as unscoped token.

When we use OSC to get a domain scoped token without explicitly set
domain information, the hint message show us we need to set a scoped
domain or project, but it miss that the parameters to be set in order
to get project or domain scoped token is not the same.

Thus, the hint message could be improved to make it more clear to
end user.

Change-Id: I94768c619b30be18737fec189ae6d81e81ba090d
2015-06-14 13:31:02 +00:00
Jamie Lennox
3ae247fdce Set tenant options on parsed namespace
Because of the way OSC registers all plugins together we end up
with os-tenant-X parameters being saved to the project-X attribute after
parsing. If you are using the v2 plugins directly then they and os-client-config
expect the tenant_X values and will assuming no scoping information if
they are not present.

Validating options for scope will also fail in this situation, not just
because the resultant auth dictionary is missing the tenant-X
attributes, but because OSC validates that either project or domain
scope information is present.

Fix this by just always setting the v2 parameters if the v3 parameters
are present. This will have no effect on the generic or v3 case but fix
the v2 case.

Expand validation to include the tenant options so it knows that v2
plugins are scoped.

Change-Id: I8cab3e423663f801cbf2d83106c671bddc58d7e6
Closes-Bug: #1460369
2015-05-31 15:03:42 +10:00
Dean Troyer
5649695c65 Add --os-cloud support
This adds a new option --os-cloud that allows the configuration values
for multiple clouds to be stored in a local file and selected with
a single option.

Internal option names have had 'os_' removed to be comptible with
the options returned from OpenStackConfig().get_one_cloud().

The config file is ~/.config/openstack/clouds.yaml:

Sample
------
clouds:
  devstack:
    auth:
      auth_url: http://192.168.122.10:35357/
      project_name: demo
      username: demo
      password: 0penstack
    region_name: RegionOne
  devstack:
     auth:
       auth_url: http://192.168.122.10:35357/
       project_name: demo
       username: demo
       password: 0penstack
     region_name: RegionOne

Co-Authored-By: Monty Taylor <mordred@inaugust.com>
Change-Id: I4939acf8067e44ffe06a2e26fc28f1adf8985b7d
Depends-On: I45e2550af58aee616ca168d20a557077beeab007
2015-04-18 23:04:51 -05:00
Dean Troyer
f43c1f7655 Defer client imports
So we really weren't deferring the loading of client libs dadgummit,
do that for real where possible.  This shaves a couple of tenths off
the static import times.

Also defer as much import-time procesing as possible.  This is a little
ugly in api.auth but this also eliminates import of the auth plugins
until they are needed.

Change-Id: Ia11d4b9cf98231d37449103fc29101dc17afb009
2015-04-15 22:40:52 -05:00
Jamie Lennox
a9d1e3d219 Base TokenEndpoint plugin on keystoneclient's
Keystoneclient has always provided a TokenEndpoint plugin. Unfortunately
it uses a different option name for url, so subclass the original and
replace the options.

Change-Id: I7e16b31ceb9f75f1c1f6bfb224d8f8f353d06150
2015-03-11 19:16:18 +11:00
Jenkins
2f4cfb6cd5 Merge "Move OSC auth plugins so they can be found" 2015-03-10 05:37:41 +00:00
Dean Troyer
749920bc65 Move OSC auth plugins so they can be found
The plugin detection at the top of openstackclient.api.auth did not
detect the plugins at the bottom of that file because, surprise,
they had not been declared yet so the entry points were ignored.

Move both plugin subclasses into openstackclient.api.auth_plugin.

Fix a problem with the password callback that was otherwise made
worse with this change.

Closes-Bug: 1428912
Change-Id: Idc3b72534071e0013c8922884a8bc14137509a0f
2015-03-10 03:16:12 +00:00
Monty Taylor
59727ba2f9 Don't hack the image url
It's actually breaking usage against HP Public Cloud.

Change-Id: Ic172786c6d1272798b768078a0bcf246f8d64ca8
2015-03-05 20:58:23 -06:00
Jenkins
b972937c82 Merge "Fix auth-required for help command" 2015-03-02 16:19:20 +00:00
Dean Troyer
505fa14cd6 Fix auth-required for help command
When we got picky with the auth arguments we broke using help without
any auth config supplied.  This rearranges things a bit to do the argument
checking when the deferred auth request to Identity occurs so commands
that do not need auth have a chance to live short but useful lives.

Closes-Bug: #1399588
Change-Id: I8ceac491cf65e25eddb62ab2713f471fe686756d
2015-02-27 17:27:17 -06:00
Terry Howe
1186cb4c9f change oslo namespace to avoid warning
Change-Id: Ieff86f841623e1ce34b79c66bc5e8b1b239fa3e9
2015-02-25 17:38:34 +00:00
Jenkins
09357009c1 Merge "Begin low-level API for Network v2" 2015-02-07 00:16:28 +00:00