summaryrefslogtreecommitdiff
path: root/openstackclient/tests/unit/common
Commit message (Collapse)AuthorAgeFilesLines
* Merge "quota: Deprecate "force" behavior for network quotas"Zuul2022-11-051-3/+4
|\
| * quota: Deprecate "force" behavior for network quotasStephen Finucane2022-10-111-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | In change Idc1b99492d609eb699d0a6bef6cd760458a774f6, we added a '--check-limit' option to enable "no force" behavior for network quotas. This was already the default for compute quotas. Provide a path for harmonizing the behavior of the two options by instead using a '--no-force' option which will become the eventual default for the network quotas also. Change-Id: I25828a3d68e2e900f498e17a0d01fb70be77548e Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | Merge "quota: Fix issues with delete quota command"Zuul2022-11-051-13/+14
|\ \
| * | quota: Fix issues with delete quota commandStephen Finucane2022-10-111-13/+14
| | | | | | | | | | | | | | | | | | | | | | | | We were passing a project object rather than just the ID. Also correct a typo in the call to delete network quotas. Change-Id: I2292db7932ec01026f0e54014e3d02218792617a Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | | Merge "tests: Remove unnecessary nesting of volume resources"Zuul2022-11-055-28/+24
|\ \ \ | |/ /
| * | tests: Remove unnecessary nesting of volume resourcesStephen Finucane2022-09-305-28/+24
| |/ | | | | | | | | Change-Id: I210ce7534d161e89115e5cb96e42ab7f27170aa1 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | Merge "quota: Allow showing project-specific quotas"Zuul2022-11-051-0/+62
|\ \ | |/
| * quota: Allow showing project-specific quotasStephen Finucane2022-09-301-0/+62
| | | | | | | | | | | | | | | | | | Add '--compute', '--network' and '--volume' options to the 'quota show' command, along with a default '--all' option, allowing us to restrict quotas shown to an individual service. Change-Id: I122b765df01887b8d916ee6567ffb7768fcb4392 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | Merge "quota: Add 'quota show --usage' option"Zuul2022-10-121-14/+54
|\ \ | |/
| * quota: Add 'quota show --usage' optionStephen Finucane2022-09-301-14/+54
| | | | | | | | | | | | | | | | | | | | | | Provide an more sane way to get usage information for a particular project's quotas. This requires using the 'Lister' command type since the 'ShowOne' command type only allows for simple key-value pair output. We also add a note indicating that the '<project>' argument is optional. Change-Id: Ic7342cf08f024cc690049414c5eef5b9a7594677 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | Merge "quota: Simplify logic used to list, show quotas"Zuul2022-10-121-23/+0
|\ \ | |/
| * quota: Simplify logic used to list, show quotasStephen Finucane2022-09-301-23/+0
| | | | | | | | | | | | | | This is prep work for some changes we're introducing in a later change. Change-Id: I27a59bc1d57e6815fb166fb99ea2af88f08b68a9 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | Merge "quota: Add support for detailed volume quotas"Zuul2022-10-071-3/+34
|\ \ | |/
| * quota: Add support for detailed volume quotasStephen Finucane2022-09-301-3/+34
| | | | | | | | | | | | | | | | We were stating that this was not supported. That is not true. Correct the oversight. Change-Id: Ib9d9db641a18e142be0a1eccff783e7cccdf2db5 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | Merge "quota: Add 'quota delete' command"Zuul2022-10-071-0/+107
|\ \ | |/
| * quota: Add 'quota delete' commandStephen Finucane2022-09-301-0/+107
| | | | | | | | | | | | | | | | | | We had previously indicated that people use 'quota set' for unsetting a project's quotas, however, there was nothing that actually allowed us to do this. Correct that oversight. Change-Id: I04057e766b8ccf94bf219972249b68dc2bb796d4 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | config: Also mask non-prefix configryanKor2022-08-011-9/+48
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 'config show' command will show information about your current configuration. When using a 'cloud.yaml' file and the 'OS_CLOUD' environment variable, the output of this will look like so: $ openstack config show +---------------------------------------------+----------------------------------+ | Field | Value | +---------------------------------------------+----------------------------------+ | additional_user_agent | [('osc-lib', '2.6.0')] | | api_timeout | None | | auth.auth_url | https://example.com:13000 | | auth.password | <redacted> | | auth.project_domain_id | default | | auth.project_id | c73b7097d07c46f78eb4b4dcfbac5ca8 | | auth.project_name | test-project | | auth.user_domain_name | example.com | | auth.username | john-doe | ... All of the 'auth.'-prefixed values are extracted from the corresponding entry in the 'clouds.yaml' file. You'll note that the 'auth.password' value is not shown. Instead, it is masked and replaced with '<redacted>'. However, a 'clouds.yaml' file is not the only way to configure these tools. You can also use old school environment variables. By using an openrc file from Horizon (or the clouds2env tool [1]), we will set various 'OS_'-prefixed environment variables. When you use the 'config show' command with these environment variables set, we will see all of these values appear in the output *without* an 'auth.' prefix. Scanning down we will see the password value is not redacted. $ openstack config show +---------------------------------------------+----------------------------------+ | Field | Value | +---------------------------------------------+----------------------------------+ | additional_user_agent | [('osc-lib', '2.6.0')] | | api_timeout | None | ... | password | secret-password | ... This will also happen if using tokens. This is obviously incorrect. These should be masked also. Make it so. This involves enhancing our fake config generation code to generate config that looks like it came from environment variables. Change-Id: I560b928e5e6bcdcd89c409e0678dfc0d0b056c0e Story: 2008816 Task: 42260
* Merge "Refactor network fakes to sdk properties PART 1"Zuul2022-03-231-2/+1
|\
| * Refactor network fakes to sdk properties PART 1Nurmatov Mamatisa2022-03-151-2/+1
| | | | | | | | | | | | | | | | | | | | Included resources: address_group address_scope auto_allocated_topology availability_zone Change-Id: I943f988588efbe68dd3ab17a18441b25ac8c8d4d
* | Allow "--force" flag in quota network commandsRodolfo Alonso Hernandez2022-03-171-0/+1
|/ | | | | | | | | This flag allows to set a new Neutron quota resource limit without checking first the current resource usage. The new limit will be set anyway. This flag was used only by the compute engine. Related-Bug: #1953170 Change-Id: I7084f8208b804236ac99e6842db7a45854ce54d7
* Merge "image: Remove FakeImage test helper"Zuul2022-02-091-1/+1
|\
| * image: Remove FakeImage test helperStephen Finucane2021-11-171-1/+1
| | | | | | | | | | | | | | | | | | We're no longer creating fake versions of glanceclient's 'Resource' object but rather openstacksdk objects. As such, there's no point nesting things under a fake resource class. Change-Id: I39cd5302622f4542db9eebcccfad0cb90d077441 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | Merge "Add network update quota "limit_check" parameter"Zuul2022-02-031-0/+43
|\ \ | |/ |/|
| * Add network update quota "limit_check" parameterRodolfo Alonso Hernandez2021-12-071-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | This new parameter commands the Neutron server to first check the resource usage before setting the new quota limit. If the resource usage is below the new limit, the Neutron server will raise an exception. Depends-On: https://review.opendev.org/c/openstack/openstacksdk/+/806254 Depends-On: https://review.opendev.org/c/openstack/neutron/+/801470 Partial-Bug: #1936408 Change-Id: Idc1b99492d609eb699d0a6bef6cd760458a774f6
* | Remove remnants of 'six'Stephen Finucane2021-10-211-6/+5
|/ | | | | | | Just one entry left. Remove it. Change-Id: Ia12173ecb7f3fed4a1195a46ebf9b096d917b3b6 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* project cleanupArtem Goncharov2021-02-021-0/+183
| | | | | | | | | New implementation of the project cleanup based on the sdk.project_cleanup. It is implemented as an additional OSC operation and will ideally obsolete the `openstack project purge` giving flexibility to extend services support, parallelization, filters, etc. Change-Id: Ie08877f182379f73e5ec5ad4daaf84b3092c829c
* Add support '--progress' option for 'image create'youngho choi2021-01-041-0/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | openstack-client doesn’t support the upload progress bar. This patch shows progressbar when create image if you added '--progress' option like a python-glanceclient. like this. [=============================>] 100% +------------------+---------------------------+ | Field | Value | +------------------+---------------------------+ | container_format | bare | | created_at | 2020-09-06T20:44:40Z | ... How to use Add the'--progress' option on the 'openstack image create' command. Code was written by referring to 'python-glanceclient' project on stable/ussuri branch Change-Id: Ic3035b49da10b6555066eee607a14a5b73797c00 task: 40003 story: 2007777
* Remove None valued network quota entriesasarfaty2020-09-221-0/+23
| | | | | | | | | | Since the openstack SDK still has the neutron-lbaas entries in the network quota, but those are already deprecated [1], the 'opentack quota show' command shows those as None value. This fix removes those empty deprecated values from the output. [1] https://review.opendev.org/#/c/658494/ Change-Id: I8dbdba2a029ea8e6a268ddf29627e1466a7e3a8a
* Merge "Add '--force; parameter to 'openstack quota set'"Zuul2020-07-061-0/+50
|\
| * Add '--force; parameter to 'openstack quota set'hackertron2020-04-141-0/+50
| | | | | | | | | | | | | | | | | | The compute service allows us to to force set a quota, setting a quota value that is less than the amount of the resource currently consumed. Expose this feature by way of a '--force' boolean parameter. Change-Id: I1d1ac1ac46f49f64794ffc8631e166935537966c
* | Merge "Allow os quota list query to filter by project"Zuul2020-06-291-0/+69
|\ \
| * | Allow os quota list query to filter by projectJose Castro Leon2020-03-121-0/+69
| |/ | | | | | | | | | | | | | | | | | | In the os quota list command, project parameter is completely ignored ending up in a request to all projects and then all quotas. This patch enables back the parameter and does a single call to quotas if specified. Change-Id: Ie17c256e2bdc307dcd94ad5be7abdbffa776d369 Story: 2007422 Task: 39043
* | Replace assertItemsEqual with assertCountEqualAlfredo Moralejo2020-06-011-2/+2
|/ | | | | | | | | | | | | | | assertItemsEqual was removed from Python's unittest.TestCase in Python 3.3 [1][2]. We have been able to use them since then, because testtools required unittest2, which still included it. With testtools removing Python 2.7 support [3][4], we will lose support for assertItemsEqual, so we should switch to use assertCountEqual. [1] - https://bugs.python.org/issue17866 [2] - https://hg.python.org/cpython/rev/d9921cb6e3cd [3] - testing-cabal/testtools#286 [4] - testing-cabal/testtools#277 Change-Id: I1ad0da8deda3a8cbec384b5a9c88860a526eb48c
* Raise flake8-import-order version to latestSean McGinnis2020-01-108-9/+8
| | | | | | | | | | | We had this library capped at a release that is a few years old. Now that we have dropped py2 testing, we can pick up the latest version. This uncovered a few things to clean up. Mostly the fact that mock is now a part of the StdLib unittest since Python 3.3. Change-Id: I27484dd4c25378413ff16e97a35a1a46062357bc Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
* Replace six.iteritems() with .items()lihaijing2020-01-091-4/+2
| | | | | | | | | | | | | | | | 1. As mentioned in [1], we should avoid using six.iteritems to achieve iterators. We can use dict.items instead, as it will return iterators in PY3 as well. And dict.items/keys will more readable. 2. In py2, the performance about list should be negligible, see the link [2]. [1] https://wiki.openstack.org/wiki/Python3 [2] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html Co-Authored-By: Akihiro Motoki <amotoki@gmail.com> Change-Id: I4b9edb326444264c0f6c4ad281acaac356a07e85 Implements: blueprint replace-iteritems-with-items
* Use SDK to get compute API extensionsMatt Riedemann2019-10-311-13/+8
| | | | | | | | | | | | | | | | python-novaclient 16.0.0 removed the deprecated list_extensions module [1] so this changes the extensions command to use openstacksdk to get the compute API extensions. The functional test ExtensionTests.test_extension_list_compute ensures this works. [1] https://review.opendev.org/686516/ Change-Id: I9894bc395c0474aaa6494ac4534862efe4ea7984 Story: #2006769 Task: #37284
* Remove token_endpoint auth typeDean Troyer2019-08-271-4/+4
| | | | | | | | | | | The token_endpoint was a compatibility auth type to maintain support for the --url global option that dated back to the beginning of OpenStack CLI auth. The common keystoneauth library implements 'admin_token' which provides the same functionality using --endpoint rather than --url. Change-Id: I1b9fbb96e447889a41b705324725a2ffc8ecfd9f Signed-off-by: Dean Troyer <dtroyer@gmail.com>
* Remove code migrated to osc-lib long agoDean Troyer2019-05-161-107/+0
| | | | | | | | | * Remove openstackclient.api.utils and use osc_lib.api.utils * Remove openstackclient.common.clientmanager.ClientManager.auth_ref * Remove openstackclient.common.commandmanager Change-Id: I67e1dbc53cc0b37967c0011bcb2fc09bdef62d94 Signed-off-by: Dean Troyer <dtroyer@gmail.com>
* Merge "Delete the LB object quotas set command in openstackclient"Zuul2019-03-131-9/+0
|\
| * Delete the LB object quotas set command in openstackclientyanpuqing2018-06-201-9/+0
| | | | | | | | | | | | | | | | | | | | | | Setting octavia quotas should use "openstack loadbalancer quota set", not "openstack quota set". The vip parameter had be removed from octavia. The patch removes '--vips', '--health-monitors', '--l7policies' parameter in "openstack quota set" command. Change-Id: Id0046195aa93bae62264d9de7d123cf63bd0fb7e Task: 19657 Story: 2002016
* | Add support for get details of QuotaSławek Kapłoński2019-02-241-4/+83
| | | | | | | | | | | | | | | | | | | | With passing "--detail" argument to "openstack quota list", details about current usage should be returned. It is currently supported by Nova and Neutron so details of resources from those projects can be returned. Change-Id: I48fda15b34283bb7c66ea18ed28262f48b9229fe Related-Bug: #1716043
* | Fix 'project purge' deleting wrong project's servers and volumesJulie Pichon2018-09-141-12/+18
|/ | | | | | | | | | | | | | Project purge would delete the servers and volumes for the project the user is currently authenticated for, regardless of the --project flag. Note: This change means that no server at all will be deleted if the logged in user doesn't have the get_all_tenants permission set in the Nova policy (default: admin_api). This doesn't appear to be an issue with Cinder as the default rule appears to be admin_or_owner. Change-Id: If1c54e24e1482438b81c3c32fd5fc9fdd7a7be04 Story: 1747988 Task: 13854
* Fix limits show command without Nova and CinderJude Cross2018-04-031-0/+125
| | | | | | | | | This patch implements an endpoint lookup when showing limits. This addresses the issue when showing limits without both Nova and Cinder and will display limits if one is missing. Change-Id: I2214b281e0206f8fe117aae52de2bf4c4e2c6525 Closes-bug: #1707960
* Rehome test units libPierre Hanselmann2017-11-023-3/+5
| | | | | | Rehoming deprecated libs for the ones provided in osc-lib. Change-Id: Idb4a27f2c8edf48909ef010e3c7a1a5c0c16efc5
* Fix 'project purge' deletes ALL images problemlihaijing2017-09-261-12/+12
| | | | | Closes-Bug: #1717130 Change-Id: I33c6fc7897dfee85d1c197a1267bde4abfa5bbd9
* Use flake8-import-order pluginAkihiro Motoki2017-08-172-1/+2
| | | | | | | | | | | | | | | | In reviews we usually check import grouping but it is boring. By using flake8-import-order plugin, we can avoid this. It enforces loose checking so it sounds good to use it. This flake8 plugin is already used in tempest. Note that flake8-import-order version is pinned to avoid unexpected breakage of pep8 job. Setup for unit tests of hacking rules is tweaked to disable flake8-import-order checks. This extension assumes an actual file exists and causes hacking rule unit tests. Change-Id: I12b596820727aeeb379bee16c2bc993dee9eb637
* Add project purge command to oscSteve Martinelli2017-06-131-0/+314
| | | | | | | | | See the initial implementation: https://github.com/openstack/ospurge/blob/master/ospurge/client.py Partial-Bug: 1584596 Change-Id: I3aa86af7c85e7ca3b7f04b43e8e07125f7d956d1
* Refactor Extension show and list commandAnkur Gupta2017-05-181-16/+62
| | | | | | | | | | | | | | 1.keep the column display order consist in extension list with and without "--long" option. 2.rework for network extentsion list, openstacksdk return object, so the logic should be same with other service. 3.add some unit test cases, like: extension list --network --long, extension list --network --compute, to cover regular use cases. 4.raise exact exception when network extension don't exist, avoid internal TypeError in "extension show" commands. Change-Id: I2e23ced80d8da8aa1106b22472db850367b351ce Closes-Bug: #1689233
* Ignore more exceptions in quota listDean Troyer2017-05-111-1/+48
| | | | | | | | Additional exceptions can be thrown here, ignore additional project lookup exceptions, but still not all. Server failures are still interesting, for example. Change-Id: I9a750ae8e8efa29a36bbd1e34b50b6ace0658260
* Funcional tests: quota listDean Troyer2017-05-021-254/+428
| | | | | | | | | | | | The quota list tests have a race in them where occasionally a project is deleted in another test between the time that quota list gets a list of all projects and it gets the quota for the projects from the service; the get quota call fails on the non-existant project. The quota list functional tests have been substantially re-written to properly test the exception handling. Change-Id: I71e6bbb5d46fcea4718a5a870f9a66a2c20fff0f