89 Commits

Author SHA1 Message Date
Jenkins
45be3e1b2c Merge "Calls to federated service providers using Keystone-to-Keystone" 2017-01-11 03:08:49 +00:00
OpenStack Proposal Bot
54e147cf3e To display image size in human friendly format
Include option '--human-readable' to 'image show' command.
This option displays image size in human readable format
(such as K, M, G, T,..)

(Re-submitted as the original https://review.openstack.org/#/c/399982/ had
a parent commit not present in Gerrit, was proposed by "OpenStack
Proposal Bot")

Change-Id: I0ef74c2ec978483fe49156c88acf5c369a8fa5c2
Closes-Bug: #1640086
Co-Authored-By: Badhmapriya Boopalan <Badhmapriya.Boopalan@cognizant.com>
2017-01-10 13:56:34 -06:00
Jenkins
8e1f3c2f9c Merge "Include OSC additions 2" 2017-01-09 21:21:18 +00:00
Jenkins
da9a69b45e Merge "Include OSC additions" 2017-01-09 19:13:26 +00:00
Roey Chen
f6c357d749 Don't call formatters on None value
Some object fields are allowed to be set to None, in such cases we
shouldn't call any formatters on the field.
For example, a subnet has a field 'service_types' which could be a list
of values but is also nullable.

Change-Id: I6574bdf742c0cd24cc824f08e8ba4c40d390cbe0
Closes-Bug: #1652025
2017-01-08 13:18:22 +00:00
Dean Troyer
52e7aa6fdd Include OSC additions 2
OSC has some additions to OSC_Config that we need to include:
* Updates to initialize_app() and prepare_to_run_command()

Change-Id: I1846f823fb57bb0b43c0f074a24d3de1a8e4a24f
2017-01-04 16:14:16 -06:00
Dean Troyer
3fdc5b16e4 Include OSC additions
OSC has some additions to OSC_Config that we need to include:
* A fix for bug 1642301 in _auth_default_domain()
* The addition of _validate_auth_ksc() and _validate_auth() that
  include current OSC needs.  These need to be migrated into os-client-config
  in a compatible manner...

Change-Id: I21a6ba3682ef97146db977270315c74c12d7b3b5
2017-01-04 11:54:23 -06:00
Dean Troyer
f999ba25d1 Add deprecated_option_warning() method to Command
This method factors out a common pattern for handling deprecated
command options.

Change-Id: I8ca8ec76365833cc8a71388e478680f7f8444be0
2017-01-04 11:11:11 -06:00
Kristi Nikolla
572eddc142 Calls to federated service providers using Keystone-to-Keystone
Allow users to direct calls using the OpenStackClient to a remote
federated service provider using Keystone 2 Keystone federation.

Change-Id: Icbdb286f840ecd3a57c64ef69b9e55925439b2f1
2016-12-21 11:43:17 -05:00
Jenkins
5482f52612 Merge "Remove os-client-config hacks for 1.19.x and 1.20.x" 2016-10-27 16:50:38 +00:00
Jenkins
9327e81262 Merge "Allow passing app_name and app_version for useragent" 2016-10-25 10:15:16 +00:00
Dean Troyer
e9a620a087 Remove os-client-config hacks for 1.19.x and 1.20.x
os-client-config is fixing the _validate_auth() issues, we don't
need to anymore.  No back-compat is required, only OSC ever expected
this and that version was never released.

Change-Id: Ic0f2887a4aa18c313692850cf624101f9f7cdefb
2016-10-25 04:42:39 -05:00
Jamie Lennox
5b0f4d27de Allow passing app_name and app_version for useragent
Keystoneauth now supports passing app_name and app_version when creating
the session to build a sensible user agent string including client
versions. osc-lib and OpenStack Client should be amongst the first to
support this.

Change-Id: Ia46c1eea29678824a5934d846a08dbe52f5058d0
2016-10-20 10:13:03 +11:00
Jesse Keating
fe8b2a798d Avoid string actions on non-string objects
When config is coming from a clouds.yaml file, Python's yaml parser may
turn the version into an int if it is not quoted in the yaml. Ensure
that we set the value to a string before interacting with it.

Also fix a possible string action on a None object.

Change-Id: Ibf02a85d89c95ba76688b3f5c417f861173008d5
Closes-Bug: #1634986
2016-10-19 11:10:39 -07:00
Jenkins
5099a55fa6 Merge "Improve output of supported client versions" 2016-10-07 17:52:20 +00:00
Jenkins
01df208a81 Merge "TrivilalFix: Using assertIsNone() instead of assertEqual(None)" 2016-10-07 17:39:31 +00:00
Kyrylo Romanenko
a9e8aaec12 Improve output of supported client versions
Sort supported client versions.

Change-Id: I85637883e0fa5eb08e029d55cb499f7b2e64df70
Partial-Bug: #1630962
2016-10-07 14:05:30 +03:00
Matt Riedemann
0a82bd7294 Mask passwords in debug logs for auth_config_hook
The auth config hook can have credentials in it so
we have to mask the config before logging it. To
avoid doing the work of masking the password if we
aren't going to log it, there is a conditional put
around the actual debug statement.

Change-Id: I8e626672ec94fc837610216bccb4354dbdedca17
Closes-Bug: #1630822
2016-10-05 21:17:39 -04:00
Nam Nguyen Hoai
647ed96f54 TrivilalFix: Using assertIsNone() instead of assertEqual(None)
Following OpenStack Style Guidelines[1]: http://docs.openstack.org/developer/hacking/#unit-tests-and-assertraises
[H203] Unit test assertions tend to give better messages for more
specific assertions. As a result, assertIsNone(...) is preferred
over assertEqual(None, ...) and assertIs(..., None)

Change-Id: If09f921565a2252f30fd77324c343272293c3a92
2016-09-27 16:26:04 +07:00
Jenkins
10f4b6d448 Merge "Incorrect usage message when no auth param passed" 2016-09-22 15:13:37 +00:00
Kristi Nikolla
944a668cb7 Update docstring to match params
Docstring referenced to a non-existing method parameter for the
setup_auth() method.

Change-Id: I0eba9f4581c3699e99ca0b34d585d8eaf19746f0
2016-09-16 11:40:12 -04:00
Ukesh Kumar Vasudevan
e65d4f7120 Incorrect usage message when no auth param passed
When no auth params passed, user is advised to use os-cloud

Change-Id: I1365487668c7d7c3c31db9b8b311c4e06eb6e16a
Closes-bug: #1615110
2016-09-13 13:39:19 +00:00
Jenkins
d7c8789933 Merge "Prompt for auth options" 2016-08-30 17:14:13 +00:00
Dean Troyer
7ca698a7a4 Prompt for auth options
This is tolerant of os-client-config releases above 1.18.0 and will
start prompting for passwords when 1.21.0 or newer is present.

Once o-c-c 1.21.0 reaches the minimum in global requirements.txt
all of this hackery can go away.

Change-Id: I8054cc2372299592c4ecf9e7eb0e7971be51682b
2016-08-29 19:30:30 -05:00
Jenkins
f80fa43eeb Merge "Clean imports in code" 2016-08-26 12:47:38 +00:00
Jenkins
ebdded376c Merge "Fix default handling for verify option in ClientManager" 2016-08-25 22:03:58 +00:00
Dean Troyer
9bf62fde0c Fix default handling for verify option in ClientManager
The default for self.verify should be self._cli_options.verify,
this was missing.  This also simplified setting the default for
self.cacert.

Closes-bug: #1616891
Change-Id: I53f0e18fe8fdd07c58c1b687146522ffba9e0044
2016-08-25 13:46:32 -05:00
Cao Xuan Hoang
c1a81af182 Clean imports in code
In some part in the code we import objects.
In the Openstack style guidelines they recommend to import only modules.

http://docs.openstack.org/developer/hacking/#imports

Change-Id: I9c1ebe645b7dc8379f60e13ef6ea43bbe6ab1bcb
2016-08-25 13:36:44 +07:00
Cao Xuan Hoang
00a50bf5c0 TrivialFix: Remove logging import unused
This patch removes logging import unused in osc_lib/api/auth.py

Change-Id: Ib566014cc0852eb9a454e49fcc65e926f192b31d
2016-08-25 11:19:47 +07:00
Dean Troyer
1a3ff9697d Another precedence fix
This time for sure!

Change-Id: Id027fc85cd926cb726f5b4db5ddb6173ec31b62d
2016-08-16 09:39:00 -05:00
Dean Troyer
ea65b90d63 More hacks to fix broken o-c-c precedence
We needed a bit more to work around os-client-config 1.18.0's broken
precedence; this can't all be fixed in OSC.

Change-Id: Ibe1c36e72c96eb2b3746645f7e6b433307ce8021
2016-08-12 12:36:40 -05:00
Jenkins
e0e2deaee0 Merge "Fix arguemnt precedence issues with os-client-config" 2016-08-10 13:47:09 +00:00
Dean Troyer
da73792b70 Fix arguemnt precedence issues with os-client-config
os-client-config 1.19.1 contains a critical fix for OSC 3, however
other clients have problems that prevent that version from being used
so let's bring the critical fized here so we can move forward.

Change-Id: Id0af268ae397b66d0212a07b910ebd30ddc65878
2016-08-09 10:21:46 -05:00
Alvaro Lopez Garcia
a4d952cd4c Do not add user domain options if not needed
user_domain_id or user_domain_name are only needed in some plugins
(namely v3password and v3totp). Adding defaults for them cause
failures in auth plugins that do not accept these keyword arguments.

Closes-bug: #1610911
Change-Id: Ic43b4a0d807697cd93e50b9f15c94471e2aea8f9
2016-08-09 00:09:23 +02:00
Dean Troyer
ed9663237c Decode argv to Unicode on py2
Decode default argv into Unicode on Python 2 (Python 3 does this
under the covers).

Backport of OSC change https://review.openstack.org/#/c/343035/

Co-Authored-By: John Dennis <jdennis@redhat.com>
Related-Bug: 1603494
Change-Id: I192f17962bb5e21c20c3743b8f3e88c2450432c7
2016-08-05 14:43:08 -05:00
qtang
7dbc92b521 Prevent null key setting for property
null key is the invalid input when setting property
in the openstack components.

Prevent null key setting for property in
openstackclient.

Change-Id: I8ec72664b5393ffef71fffa4bd1cd3c303e86a52
Related-Bug: #1558690
2016-08-04 21:59:34 +00:00
Jenkins
7a8b05152a Merge "Allow shell class to be overridden in test subclass" 2016-07-26 12:45:07 +00:00
Jenkins
5b2a7cf9f9 Merge "Use assertEqual() instead of assertDictEqual()" 2016-07-26 11:37:36 +00:00
Dean Troyer
f535ace7cf Allow shell class to be overridden in test subclass
osc_lib.utils.TestShell may be subclassed in other modules to test
osc_lib.shell.OpenStackShell subclasses.  Set the shell class to be
tested by setting TestShell.shell_class_path to the full class path.

Change-Id: I0ab187d370ebb28760d90a8aca4b64eea19c8d9e
2016-07-25 14:19:51 -05:00
Dean Troyer
02a89049a2 Remove option handling unused code
OSC_Config now handles all of the monkey-business we do with auth-related
arguments during the os-client-config portion of our program.  ClientManager
is one more step closer to totally not caring about what the CLI options
look like.

Change-Id: Ifcf2d0c22901d37c790267dcf33d21c71556de47
2016-07-25 10:11:11 -05:00
Tang Chen
85c977ac7a Use assertEqual() instead of assertDictEqual()
In unittest2, assertDictEqual() is implemented by
using != operator to compare two dicts. So is
assertEqual() in testtools. assertEqual() in
testtools is able to handle dict, list, set and so
on. So we just call assertEqual() to make the unit
tests simpler.

Change-Id: I5eeeebced716f2065e81d72a9972392ae3a45d89
2016-07-25 15:40:54 +08:00
Jenkins
dad1baf174 Merge "Fix v2 auth with v3 args present" 2016-07-16 16:11:04 +00:00
Jenkins
a1c175803f Merge "Remove setting project name on clientmanager" 2016-07-15 17:44:13 +00:00
Dean Troyer
b1022ac336 Fix v2 auth with v3 args present
The translation of the auth arg handling workarounds from OSC missed
a detail in the differences between OSC's option Namespace and
os-client-config's config dict: the auth args are in a 'auth' sub-dict.

Also expanded some of the testing to catch more edge cases.

Closes-Bug: 1603479
Change-Id: I80bb42992a1a93857be4c6367405df645780a33d
2016-07-15 11:04:11 -05:00
Jenkins
9667f426d0 Merge "Generate auth plugin options based on the name" 2016-07-11 13:35:12 +00:00
Dean Troyer
abc824010a Generate auth plugin options based on the name
When loading the auth plugin options, the conversion from "-" into "_"
is done based on the "dest" attribute of the option, instead of using
its name. This makes that if a plugin defines an option with a different
destination the wrong option will be created in osc, therefore the
option won't be passed properly to the plugin class.

Backported from OSC Iac7346dd57f8ea4f5b956b9bdf9f70d9494b63f8
(https://review.openstack.org/#/c/335003/)

Co-Authored-By: Alvaro Lopez Garcia <aloga@ifca.unican.es>
Closes-Bug: #1596937
Change-Id: Iab84c918f82d0313d2562ebc0655bf11d24175c9
2016-07-07 16:26:50 -05:00
Jamie Lennox
505c4279a2 Don't create a requests.Session for session
This is the default in the keystoneauth session. There's no reason that
OSC needs to do it.

With this there is no additional reason for there to be a direct
requirement on requests.

Change-Id: Ia02c09e26a5a89002185e82baf16617103cf1cab
2016-07-06 16:00:04 +10:00
Jamie Lennox
7e21c0c6f2 Remove old fakes
There are a number of fakes in the testing directory that are no longer
used and can be removed.

Change-Id: Ie7ea157cfe597d614eee172e2ec97557289ac12f
2016-07-06 16:00:04 +10:00
Jamie Lennox
f56575fcef Remove setting project name on clientmanager
Best I can see this was copied across from OSC and are not used anywhere
in osc-lib. We can remove them.

Change-Id: Ie72eedc034c87e1e94a90465f0919074c9b27774
2016-07-06 13:02:44 +10:00
Jenkins
6dafb78290 Merge "Make OSC_Config the default" 2016-07-02 18:50:47 +00:00