openstackclientclibase(1)
| OPENSTACKCLIENTCLIBASE(1) | OpenStackClient CLI Base | OPENSTACKCLIENTCLIBASE(1) |
NAME
openstackclientclibase - OpenStackClient CLI Base 2.7.0
OpenStackClient (aka OSC) is a command-line client for OpenStack. osc-lib is a package of common support modules for writing OSC plugins.
Contents:
USING OSC-LIB
Transition from OpenStackClient
osc-lib was extracted from the main OpenStackClient repo after the OSC 2.4.0 release. During the migration all module names have changed from openstackclient.* to osc_lib.*. In addition, some re-arranging has been done internally to better align modules.
The complete list of public module name changes:
- openstackclient.api.api -> osc_lib.api.api
- openstackclient.api.auth -> osc_lib.api.auth
- openstackclient.api.utils -> osc_lib.api.utils
- openstackclient.common.command -> osc_lib.command.command
- openstackclient.common.commandmanager -> osc_lib.command.commandmanager
- openstackclient.common.exceptions -> osc_lib.exceptions
- openstackclient.common.logs -> osc_lib.logs
- openstackclient.common.parseractions -> osc_lib.cli.parseractions
- openstackclient.common.session -> osc_lib.session
- openstackclient.common.utils -> osc_lib.utils
- openstackclient.tests.fakes -> osc_lib.tests.fakes
- openstackclient.tests.utils -> osc_lib.tests.utils
Additional Changes
In addition to the existing public modules, other parts of OSC have been extracted, including the base Command, CommandManager, ClientManager and Session classes.
ClientManager
The OSC ClientManager is responsible for managing all of the handles to the individual API client objects as well as coordinating session and authentication objects.
Plugins are encouraged to use the ClientManager interface for obtaining information about global configuration.
- openstackclient.common.clientmanager -> osc_lib.clientmanager
- All of the handling of the verify/insecure/cacert configuration options has been consolidated into ClientManager. This converts the --verify, --insecure and --os-cacert options into a Requests-compatible verify attribute and a cacert attribute for the legacy client libraries. both are now public; the _insecure attribute has been removed.
Verify/Insecure/CACert
| --verify | --insecure | --cacert | Result |
| None | None | verify=True, cacert=None | |
| True | None | None | verify=True, cacert=None |
| None | True | None | verify=False, cacert=None |
| None | None | <filename> | verify=cacert, cacert=<filename> |
| True | None | <filename> | verify=cacert, cacert=<filename> |
| None | True | <filename> | verify=False, cacert=None |
- •
- A number of other ClientManager attributes have also been made public to encourage their direct use rather than reaching in to the global options passed in the ClientManager constructor:
- _verify -> verify
- _cacert -> cacert
- _cert -> cert
- _insecure -> removed, use 'not verify'
- _interface -> interface
- _region_name -> region_name
Shell
- openstackclient.shell -> osc_lib.shell
- Break up OpenStackShell.initialize_app() * leave all plugin initialization in OSC in _load_plugins() * leave all command loading in OSC in _load_commands()
API
The API base layer is the common point for all API subclasses. It is a wrapper around keystoneauth1.session.Session that fixes the request() interface and provides simple endpoint handling that is useful when a Service Catalog is either not available or is insufficient. It also adds simple implementations of the common API CRUD operations: create(), delete(), etc.
- •
- KeystoneSession -> merged into BaseAPI
CHANGES
2.7.0
- Remove Python 3 guide in HACKING
- Add Python3 antelope unit tests
- Update master for stable/zed
- remove unicode prefix from code
2.6.2
- •
- doc: Comment out language option
2.6.1
- •
- Do not output log on bash autocomplete generation
2.6.0
- Add Python3 zed unit tests
- Update master for stable/yoga
- Don't fail on extlinks warnings for reno build
- Fixed test for interface key
2.5.0
- Respect 'interface' key from clouds.yaml
- Replace allow_get check with allow_fetch
- Fix TestTagHelps for python3.10
- tox: Ignore .venv files for flake8
- Add Python3 yoga unit tests
- Update master for stable/xena
2.4.2
- •
- Moving IRC network reference to OFTC
2.4.1
- Close session at clean_up if available
- Correct the tox option for skipping sdist generation
- Add check for sdk_connection
2.4.0
- Add Python3 xena unit tests
- Update master for stable/wallaby
- parseractions: Make key validation reusable
2.3.1
- Fix lower-constraints job
- Add support for SDK auth caching
- Replace 'assertFalse(a in b)' with 'assertNotIn(a, b)'
- Add Python3 wallaby unit tests
2.3.0
- tox: Set 'ignore_basepython_conflict'
- formatters: Cast columns before outputting
- zuul: Stop testing against Tempest
- Fix hacking min version to 3.0.1
- bump py37 to py38 in tox.ini
- Remove install unnecessary packages
- bump py37 to py38 in tox.ini
- Fix l-c testing for ubuntu focal
- Update master for stable/victoria
- requirements: Drop os-testr
2.2.1
2.2.0
- Fix the misspelling of "argument"
- Remove commandmanager subclass
- Stop configuring install_command in tox and stop use pip
- Add get_osc_show_columns_for_sdk_resource function
- Switch to newer openstackdocstheme and reno versions
2.1.0
- Add a couple of release notes
- Remove .testr.conf
- Remove six library from dependencies
- Save the results from the early authentication
- Add pep8 import order check
- Use mock from unittest
- Remove Babel from requirements
- Add Python3 victoria unit tests
- Update master for stable/ussuri
- Cleanup py27 support
- Fix the requirement of keystoneauth1
- Update to hacking 3.0
- Update hacking for Python3
- Revert "Add error message when occurrence Forbidden error"
- Replace assertItemsEqual with assertCountEqual
- Stop using lib-forward-testing
2.0.0
- Add a release note for dropping py2
- Drop python 2.7 support and testing
- Add enhance_help kwarg to tags option generators
- Switch to Ussuri jobs
- Add KeyValueAppendAction to osc-lib
- Update the constraints url
1.15.0
- •
- Update master for stable/train
1.14.1
- format_dict() returns no value for None
- Handle nested dicts in format_dict()
1.14.0
- Cleanups to prepare for OSC 4 release
- Fix usage of NotFound exception
- Add error message when occurrence Forbidden error
- Add Python 3 Train unit tests
1.13.0
- Corrent using auth_type=none in clouds.yaml
- Add FakeModule from OSC
- Move the _tag module from OSC to osc-lib
- Final switch to stestr
- Dropping the py35 testing
- Updates for OpenDev transition
- OpenDev Migration Patch
- Update master for stable/stein
1.12.1
- Add release note for --os-user-id fix
- add python 3.7 unit test job
- Allow use of user-id as well as username for authentication
1.12.0
- Use template for lower-constraints
- Change openstack-dev to openstack-discuss
- Default to using public interface for all clients
- Fix formatter handling for python 3.7
- Remove pypy job
- Mask password when specified as an argument with a space
- add lib-forward-testing-python3 test job
- switch documentation job to new PTI
- add python 3.6 unit test job
- import zuul job settings from project-config
- Revert "Fixes a bug with issubclass() being called on an instance"
- Remove PyPI downloads
- Replaced a few references to LP bugs with storyboard
- Update reno for stable/rocky
1.11.0
- Fixes a bug with issubclass() being called on an instance
- Stop processing requests verify args
- Replace autodoc with sphinxcontrib-apidoc
- Run OSC unit test tips jobs
- Pass prompt_for_password to OSC_Config constructor
- Fix exception in log warning when no cloud config exists
- Use openstack.config for config and Session objects
- Update sphinx lower-constraint to match test-requirements
- Adding api_version to FakeAPP
- Add release note link in README
- Add cloud to warning about domain related config
- Delete the output in "find_bulk" api
- fix tox python3 overrides
- Add OpenTracing based driver id
- Trivial: Update pypi url to new url
- Rename python-openstacksdk to openstacksdk
- add lower-constraints job
1.10.0
- Allow to use the none auth plugin
- Set defaults in ClientManager tests
- Updated from global requirements
- Zuul: Remove project name
- Zuul: Remove project name
- Update reno for stable/queens
- Updated from global requirements
- Updated from global requirements
- Suppress subTest() expected errors
1.9.0
- Fix find() interface when attr is not specified
- Relocate utils tests to match the main code
- Add project lookup utils
- Updated from global requirements
- Fix sorting in Python 3
1.8.0
- Add utils for better column handling
- Updated from global requirements
- Use converged SDK insead of os-client-config
- Remove -U from pip install
- Avoid tox_install.sh for constraints support
- Util to calculate header and attr names based on parsed_args.columns
- Make -tips job non-voting
- Remove setting of version/release from releasenotes
- Updated from global requirements
- Updated from global requirements
- Consume the devstack functional jobs from OSC
- Migrade legacy jobs into the repo
- Add CLI/ENV options and documentation for keystone-to-keystone
- Updated from global requirements
- --os-profile option suddenly causes trouble in unit tests
- Updates for stestr
- Updated from global requirements
- Updated from global requirements
- Updated from global requirements
- Updated from global requirements
- Update reno for stable/pike
- Updated from global requirements
- Update the documentation link for doc migration
- Updated from global requirements
- Updated from global requirements
- Emit warnings to encourage cliff FormattableColumn
1.7.0
- Add test methods to compare formattable column values
- Updated from global requirements
- use openstackdocstheme html context
- update links to docs in readme
- switch from oslosphinx to openstackdocstheme
- turn on warning-is-error for sphinx
- rearrange existing documentation to fit the new standard layout
- Optimize find_resource: do not run the same query twice
- Make --os-profile load from environment variables
- Deprecate --profile and remove after Apr 2017
- Updated from global requirements
1.6.0
- Fix shell saving OpenStackConfig object
- Follow-up to headers handler to fix find_bulk()
- Updated from global requirements
- Updated from global requirements
1.5.1
- Tell ClientManager when auth is required
- Add endpoint hook to BaseAPI
1.5.0
- Add token auth test
- Revert "Avoid to authenticate twice"
1.4.0
- Add MultiKeyValueCommaAction to osc-lib
- Add more API support
- Add formattable column base classes
- Updated from global requirements
- Updated from global requirements
- Avoid to authenticate twice
- Change noauth strategy for plugin loading
- Nit: Reorder some util methods in alphabetic order
- Using assertIsNone() instead of assertEqual(None)
- Remove log translations
- Fix find_resource exception handling on numeric names with kwargs
- Util methods for column name backward compatibility
- The python 3.5 is added
- Updated from global requirements
- Updated from global requirements
- Pass ssl values through to OCC
- Avoid 'NoneType' error when format conversion
- Updated from global requirements
- Update reno for stable/ocata
- Updated from global requirements
- Updated from global requirements
1.3.0
- To display image size in human friendly format
- Don't call formatters on None value
- Include OSC additions 2
- Include OSC additions
- Add deprecated_option_warning() method to Command
- Calls to federated service providers using Keystone-to-Keystone
- Add Constraints support
- Updated from global requirements
- Updated from global requirements
- Updated from global requirements
- Don't include openstack/common in flake8 exclude list
- Fix version import in releasenotes
- Remove os-client-config hacks for 1.19.x and 1.20.x
- Updated from global requirements
- Updated from global requirements
- Allow passing app_name and app_version for useragent
- Avoid string actions on non-string objects
- Updated from global requirements
- Updated from global requirements
- Updated from global requirements
1.2.0
- Add release note for security bug 1630822
- Improve output of supported client versions
- Enable release notes translation
- Updated from global requirements
- Mask passwords in debug logs for auth_config_hook
- Updated from global requirements
- Fix a tiny typo in documentation
- Updated from global requirements
- Updated from global requirements
- TrivilalFix: Using assertIsNone() instead of assertEqual(None)
- Updated from global requirements
- Update docstring to match params
- Incorrect usage message when no auth param passed
- standardize release note page ordering
- Update reno for stable/newton
- Updated from global requirements
- Prompt for auth options
1.1.0
- Fix default handling for verify option in ClientManager
- Clean imports in code
- TrivialFix: Remove logging import unused
- Updated from global requirements
- Updated from global requirements
- Updated from global requirements
1.0.2
- •
- Another precedence fix
1.0.1
- •
- More hacks to fix broken o-c-c precedence
1.0.0
- Fix arguemnt precedence issues with os-client-config
- Do not add user domain options if not needed
- Updated from global requirements
- Decode argv to Unicode on py2
- Prevent null key setting for property
- Add release notes for 1.0 release
- Updated from global requirements
- Updated from global requirements
- Add reno for osc-lib release notes management
- Updated from global requirements
0.4.1
- Allow shell class to be overridden in test subclass
- Remove option handling unused code
- Use assertEqual() instead of assertDictEqual()
0.4.0
- Add Python 3.5 classifier and venv
- Updated from global requirements
- Fix v2 auth with v3 args present
- trivial whitespace change to kick off docs publishing
- Remove discover from test-requirements
- Remove unused releasenotes infrastructure
- Remove discover from test-reqs
0.3.0
- Updated from global requirements
- Generate auth plugin options based on the name
- Remove tempest from test-requirements.txt
- Don't create a requests.Session for session
- Remove old fakes
- Remove setting project name on clientmanager
- Updated from global requirements
0.2.1
- Get VersionInfo of "osc-lib"
- Attempt to find resource by ID, without kwargs
- Make OSC_Config the default
0.2.0
- Updated from global requirements
- update the transition docs
- Add OSC_Config os-client-config subclass
- Updated from global requirements
- Backport scope defaults fix (bug 1582774)
- Backport check_valid_auth_options() fix
- Change default auth plugin to 'password'
- Backport scoped token fixes (bug 1592062)
- Backport i18n fixes (bug 1574965)
- Backport TypeError fix (bug 1575787)
- Move api/auth.py into osc_lib
- Updated from global requirements
- Modify find_resource to support glanceclient HTTPNotFound exception
- Update untils_find_resource to support no unique matches error
- Updated from global requirements
- Update is_ascii to work with py3
- Clean up foundation copyrights
- Add find_min_match()
- Sort utils.py and test_utils.py
- Fix interface arg to url_for()
- Fix missing i18n supports in osc-lib
0.1.0
- Backport i18n fixes
- Backport log fix
- Backport --os-beta-command
- Error handling for KeyValueAction class
- Updated from global requirements
- Updated from global requirements
- Updated from global requirements
- Updated from global requirements
- Updated from global requirements
- Change is_network_endpoint_enabled() to is_service_available()
- Clean up API
- Move api.api and api.utils to osc_lib
- Move shell to osc_lib and begin rework
- Add transition doc
- Rework TLS option handling
- Remove keystoneclient dependency
- Move clientmanager to osc_lib
- Updated from global requirements
- Updated from global requirements
- fix the docs build
- Fix imports in remaining openstackclient modules for testing
- Begin moving bits to osc_lib
- Make remaining tests pass
- Trim requirements.txt and test-requirements.txt
- Rename to osc-lib
- Implement "address scope set" command
- Implement "address scope show" command
- Implement "address scope list" command
- Implement "address scope delete" command
- Implement "address scope create" command
- Updated from global requirements
- Ignore domain related config when using with keystone v2
- Updated from global requirements
- Ignore domain related config when using with keystone v2
- remove assert in favor an if/else
- Replace tempest-lib with tempest.lib
- add a bandit environment to tox
- Support for volume service list
- Updated from global requirements
- Add "server group show" command
- Add "server group list" command
- Add "server group delete" command
- Add "server group create" command
- Fix mutable default arguments in tests
- Rename --profile to --os-profile
- Updated from global requirements
- Updated from global requirements
- Propagate AttributeErrors when lazily loading plugins
- Updated from global requirements
- Move keys() methods in each resource class to FakeResource
- Updated from global requirements
- Updated from global requirements
- Support client certificate/key
- Fix typos in docstrings and comments
- Use fixtures and addCleanup instead of tearDown
- Don't mask authorization errors
- Remove unused method 'from_response'
- Refactor security group rule list to use SDK
- Add "aggregate unset" to osc
- Subnet: Add "subnet set" command using SDK
- [Floating IP] Neutron support for "ip floating create" command
- Refactor security group rule create to use SDK
- Add Subnet add/remove support to router
- Add "router remove port" to osc
- Add "router add port" to osc
- Updated from global requirements
- update docs with status of plugins
- Updated from global requirements
- Use assertItemsEqual() instead of assertListEqual()
- Fix dict.keys() compatibility for python 3
- Add "os subnet create" command using SDK
- Refactor security group create to use SDK
- Refactor security group show to use SDK
- Add 'port set' command
- [Subnet pool] Add 'subnet pool create' command support
- [Subnet pool] Add 'subnet pool set' command support
- remove py26 workaround in osc
- Add port list command
- Trivial: Remove useless return
- Updated from global requirements
- Add 'port create' command
- Updated from global requirements
- Updated from global requirements
- Refactor security group set to use SDK
- Updated from global requirements
- Fix regression in interactive client mode
- Subnet: Add "subnet delete" command using SDK
- fix: Exception message includes unnecessary class args
- Refactor security group list to use SDK
- Add MultiKeyValueAction to custom parser action
- Updated from global requirements
- [compute] Add set host command
- Add shell --profile option to trigger osprofiler from CLI
- Floating IP: Neutron support for "ip floating show" command
- Improve tox to show coverage report on same window
- Updated from global requirements
- Defaults are ignored with flake8
- Fixed a bunch of spacing
- Add "security group rule show" command
- [compute] Support restore server
- Use instanceof instead of type
- Add "os subnet show" command using SDK
- Clean redundant argument to dict.get
- Updated from global requirements
- Fix Mutable default argument
- gitignore .idea
- Replace string format arguments with function parameters
- Support unscoped token request
- Don't use Mock.called_once_with that does not exist
- Subnet Pool: Add "subnet pool show" command
- Subnet Pool: Add "subnet pool list" command
- Remove unused test-requirments
- Subnet Pool: Add "subnet pool delete" command
- Fix 'openstack --help' fails if clouds.yaml cannot be read
- Floating IP: Neutron support for "ip floating list" command
- Floating IP: Neutron support for "ip floating delete" command
- Updated from global requirements
- Updated from global requirements
- Refactor security group rule delete to use SDK
- Add "token revoke" for identity v3
- Fix DisplayCommandBase comments for cliff Lister subclass tests
- Updated from global requirements
- Add support for triggering an crash dump
- Allow custom log levels for other loggers
- Use assert_not_called() in common tests
- Fix a spell typos
- Refactor security group delete to use SDK
- Add "os port show" command
- Drop log_method decorator
- Updated from global requirements
- log take_action parameters in a single place
- Update translation setup
- Allow wait_for_delete to work for all clients
- Updated from global requirements
- Remove the Tuskar client
- Updated from global requirements
- Subnet List
- Updated from global requirements
- Updated from global requirements
- log_method: get logger from decorated method if unspecified
- Set up logger of each command by metaclass
- Add support to delete the ports
- Updated from global requirements
- Refactor "os availability zone list"
- Changed the abstract columns and datalists from test cases of common and Identity
- Updated from global requirements
- Use assertTrue/False instead of assertEqual(T/F)
- Updated from global requirements
- Delete the unused LOG configure code
- Refactor network endpoint enablement checking
- Implementation for project unset cmd for python-openstackclient
- Trivial: Remove useless string_to_bool()
- Refactor: Initialize parser in setUp() in TestNonNegativeAction
- Refactor: Initialize parser in setUp() in TestKeyValueAction
- Replace assertEqual(None, *) with assertIsNone(*)
- Improve output for "os security group show"
- Add all regions to cloud configuration
- Updated from global requirements
- Router: Add "router show" command using SDK
- Router: Add "router set" command using SDK
- Updated from global requirements
- Router: Add "router delete" command using SDK
- Router: Add "router create" command using SDK
- Updated from global requirements
- Deprecated tox -downloadcache option removed
- Router: Add "router list" command using SDK
- Remove python-neutronclient requirement
- The format_exc method does not take an exception
- Updated from global requirements
- SDK integration: Add a temporary method to create network client using sdk
- Updated from global requirements
- Add reno for release notes management
- Switch to ksa Session
- autodocument commands from plugins using stevedore.sphinxext
- Updated from global requirements
- Change the home-page value in setup.cfg
- Add "openstack server unshelve" into OSC
- Trivial: Fix a typo
- Move FakeServer to tests.common.v2.compute.fakes
- Trivial: Add missing doc for parameter in wait_for_delete()
- Remove py26 support
- Add "openstack server shelve" into OSC
- Trivial: Fix wrong doc for wait_for_status()
- Updated from global requirements
- Trivial: Remove doc for non-existing param in format_dict()
- Introduce random server faking mechanism
- Enable FakeResource to fake methods
- Allow error status to be specified
- Remove deprecated 'project usage list' command
- Remove LICENSE APPENDIX
- validate non-ascii values for swift properties
- Fix the bug of "openstack console log show"
- Add "server stop" command to osc
- Add "server start" command to osc
- Allow int version numbers in the clouds.yaml
- Rename context.py to logs.py
- Allow debug to be set in configuration file
- Updated from global requirements
- Fix issue when displaying image_member
- Updated from global requirements
- Add compute service delete
- Updated from global requirements
- Move session and fixtures to keystoneauth1
- Remove cliff-tablib from requirements.txt
- Updated from global requirements
- Updated from global requirements
- Mask the sensitive values in debug log
- Updated from global requirements
- add set/unset support for objects in object store
- add support for set/unset of container properties
- Updated from global requirements
- Rename swift account commands
- Add support for showing account details
- Add support for updating swift account properties
- Add tests for find_resource()
- attempt to find resource by listing
- Additional exception handling for find_resource
- Add image create support for image v2
- Change ignore-errors to ignore_errors
- Move option logging back to start if initialize_app()
- Set default auth plugin back to 'password'
- Updated from global requirements
- Updated from global requirements
- Fix compute API version snafu
- Use a common decorator to log 'take_action' activation
- Fix 'auhentication' spelling error/mistake
- Create log configuration class
- Override the debug default and help text
- Move options to log level out of shell.py
- Move set warnings filters to logging module
- Updated from global requirements
- Updated from global requirements
- Updated from global requirements
- Updated from global requirements
- Updated from global requirements
- Remove non-existing hacking deviations from doc
- Set up every time record log in file
- Alphabetize setup.cfg
- Add set feature to volume type v2
- Add list feature to volume v2
- Updated from global requirements
- Minor Documentation changes for code samples
- Updated from global requirements
- Add support for volume v2 commands
- Add configuration show command
- Add plugin interface version
- Updated from global requirements
- Add create and list for volume type v2
- add image member commands for image API
- Fix the way auth_type default value is overriden
- Rename type.py to volume_type.py
- Add volume type show for volume v1
- More minor docs fixes
- Do not set default versions in parsed args
- Updated from global requirements
- Remove requirements.txt from tox.ini
- Rename endpoint type to interface
- Updated from global requirements
- temporarily skip help tests
- Drop py33 support for Liberty
- Fix interactive password prompt
- Updated from global requirements
- Fix wrong mock method call
- add functional tests for identity v3
- Add --os-endpoint-type cli optional argument
- Updated from global requirements
- Add support for volume API v2 QoS commands
- Alphabetize QoS specs
- Add support for volume API v1 QoS commands
- Updated from global requirements
- Updated from global requirements
- Updated from global requirements
- Updated from global requirements
- Updated from global requirements
- Improve the hint message
- Fix the typo in `openstackclient/shell.py`
- Skip trying to set project_domain_id if not using password
- Updated from global requirements
- Updated from global requirements
- Enables retrieval of project's parents and subtree
- Add support for volume backup v2 command
- Updated from global requirements
- Add support for volume snapshot v2 command
- Allow --insecure to override --os-cacert
- Add EC2 support for identity v3 API
- Get rid of oslo_i18n deprecation notice
- Rework shell tests
- Ignore cover directory from git
- Set tenant options on parsed namespace
- Add support for volume v2 API
- Add --wait to server delete
- Use ostestr for test runs
- Add cli tests for --verify and friends
- Fix shell tests
- Add support for v2 image set command
- Remove oslo serialization requirement
- Fix insecure/verify options
- Use format options for functional tests
- Fix functional test gate
- Updated from global requirements
- Send the correct user-agent to Keystone
- Updated from global requirements
- Updated from global requirements
- Updated from global requirements
- Add os-client-config cli tests
- minor syntax error in tox.ini
- Minor logging/debug cleanups
- Raise exception if no session is created
- Functional tests run in many environments
- Remove references to venv
- Add --os-cloud support
- Print warning on authentication error
- Uncap library requirements for liberty
- Defer client imports
- Federation Service Providers CRUD operations
- Add warning message if unknown version supplied
- Fix session timing
- Suppress warnings user can't fix
- Updated from global requirements
- Add the ability to set and unset flavor properties
- Use cliff deferred help instead of homemade one
- Move OSC auth plugins so they can be found
- Add identity v3 catalog show
- Add identity v3 catalog list
- Add ability for diplaying hypervisor statistics
- Raise AttributeError for unknown attributes
- Updated from global requirements
- Fix auth-required for help command
- change oslo namespace to avoid warning
- Updated from global requirements
- Fix error msg in sort_items
- Implement trust in identity v3 api
- Check volume status before extending size
- Adding default user_domain_id parameter only when using password auth
- Add sort support to image list
- Updated from global requirements
- Change test order to avoid incompatibliity
- Add filter to image list
- fix the wrong order of assertEqual args
- Remove ignore portion of tox.ini
- Begin low-level API for Image v1 and v2
- Add missing oslo-config to requirements
- Default user domain id and project domain id
- Add helpful messages when authN'ing with password
- Add version url config workaround
- Deprecate project usage list command
- Updated from global requirements
- Upgrade hacking to 0.10
- Updated from global requirements
- Fix up snapshot command
- Rename `os project usage list` to `os usage list`
- Add usage show command
- Don't import form keystoneclient.openstack.common
- list availability zones for compute
- Updated from global requirements
- Updated from global requirements
- Enhance the theming for modules page
- add keystone v3 region object
- Updated from global requirements
- Add environment variable in the os-auth-type help
- Liberalize version matching a bit
- Tests work fine with random PYTHONHASHSEED
- Updated from global requirements
- Add --or-show option to user create
- Add cliff-tablib to requirements
- Use fixtures from keystoneclient for static data
- Unscoped federated user-specific commands
- Adjust some logging levels
- Change --os-auth-plugin to --os-auth-type
- Include support for using oslo debugger in tests
- Clean up shell authentication
- only generate one clientmanager instance in interactive mode
- Remove ClientManager._service_catalog
- Remove now-unnecessary client creation hacks
- use jsonutils in oslo.serialization instead of keystoneclient
- Close files on server create, add tests
- Move plugin stuff to clientmanager
- Put pbr and six first in requirements list
- Add plugin to support token-endpoint auth
- Updated from global requirements
- Fix operation on clouds with availability-zones
- Add translation markers for user v2 actions
- Add domain parameters to user show for Identity V3
- Support for keystone auth plugins
- Add 'command list' command
- CRUD operations for federated protocols
- Update for cliff commandmanager >=1.6.1
- Implement CRUD operations for Mapping objects
- Update gitignore
- Place the command to generate docs on one line
- Remove duplicate env function in shell.py
- Add functional tests to osc
- Add low-level API base class
- Test top-to-bottom: object-store containers
- Updated from global requirements
- utils.find_resource does not catch right exception
- Remove unused reference to keyring
- Use oslo.utils
- Updated from global requirements
- Add service catalog commands
- Add preliminary save container support
- Add preliminary support for downloading objects
- Updated from global requirements
- Use Keystone client session.Session
- Add action 'user password set' for identiy v3
- Unordered dicts and lists causes variable results
- Leverage openstack.common.importutils for import_class
- Work toward Python 3.4 support and testing
- Make Identity client load like the others
- Change app.restapi to app.client_manager.session
- Add i18n module to openstackclient
- Add oslo.i18n as a dependency
- Updated from global requirements
- Add commands for object upload and delete
- Use oslosphinx to generate documentation
- Updated from global requirements
- Add container create and delete support
- Fix PEP8 E302 errors
- Add Python 3 support
- Fix server resize
- Add basic timing support
- Move network stuff to v2 instead of v2_0
- Catch SystemExit for parse args
- Python 3: remove a useless code to safe_encode()
- Remove keyring support from openstackclient
- trust authentication
- Updated from global requirements
- Sort/clean setup.cfg
- Rename token classes to match command
- Fix PEP8 E126 and E202 errors
- Fix PEP8 E265 errors
- Fix PEP8 H405 errors
- Network CRUD
- Updated from global requirements
- Updated from global requirements
- Change the token verb to issue/revoke
- Add a docs job to tox.ini
- Fix find_resource for keystone and cinder
- Refactor oauth1 code for updates
- Updated from global requirements
- Clean up logging levels
- Ignore most of the new hacking 0.9.2 rules
- Add support for extension list
- Add role assignments list support to identity v3
- Add token delete command for identity v2
- Fixed several typos throughout the codebase
- replace string format arguments with function parameters
- Updated from global requirements
- Implement CRUD operations for Identity Providers
- Updated from global requirements
- move read_blob_file_contents to utils
- Produce a useful error message for NoUniqueMatch
- Updated from global requirements
- Make bash comple command best effort to authorize
- Updated from global requirements
- In anticipation of network agents, rename compute
- Updated from global requirements
- Add ability to prompt for passwords for user create and set
- Fix some help strings
- Use six.iteritems() rather than dict.iteritems()
- Remove tox locale overrides
- Add token create subcommand for identity v3 api
- Updated from global requirements
- Remove copyright from empty files
- Add token create subcommand for identity v2 api
- Sync with global requirements
- Add support for specifying custom domains
- Displaying curl commands for nova and cinder calls
- Remove mox3 requirement
- Updated from global requirements
- Add missing requests and six requirements
- Add module list command
- Update OSC's CommandManager subclass
- Bring RESTApi closer to ithe imminent keystoneclient.Session
- Add return Closes-Bug: 1246356
- Restore Object API name 'object-store'
- Expand support for command extensions
- Fix typo
- Support building wheels (PEP-427)
- Add server image create command
- Complete basic test infrastructure
- change execute to run
- Update URL for global hacking doc and fix typos
- Remove httpretty from test requirements
- Updated from global requirements
- Updated from global requirements
- Add options to support TLS certificate verification
- Updated from global requirements
- Add object-store show commands
- Sort entrypoints in setup.cfg
- Fix security group entrypoints
- Delay authentication to handle commands that do not require it
- Prepare for Identity v3 tests
- Add to clientmanager tests
- Add Identity v2 role and service tests
- Refactor fake data for projects and users
- Update tox.ini for new tox 1.6 config
- Update requirements.txt and test-requirements.txt
- Object API commands using our REST API layer
- Create a new base REST API interface
- Re-order oauth commands and sync with keystoneclient
- Add Identity v2 project tests
- Updated from global requirements
- Sync with global requirements
- Change version reporting to use pbr
- Prep for 0.2 release (0.2.rc1)
- Remove 'oauth authorization show' function from identity v3
- Remove tenant round 3 - other commands
- Remove tenant round 2 - Identity API
- Remove tenant round 1 - global options
- Add server ssh command
- Add security group commands
- Add server resize command
- Add server migrate command
- Add server commands: (un)lock, (un)rescue, (un)set, add/remove volume
- Add usage command for compute api
- Clean up properties (metadata) formatting
- Add aggregate commands
- Complete Image v1
- Add quota commands
- Add list and delete authorizations for oauth commands
- Add show limits command
- Remove api = apiName calls from each method
- Add authenticate method to oauth code
- Add EC2 credentials CRUD
- Finish up v3 role commands
- Add methods for user and group interactions
- Move tests into project package
- Add OAuth support for Identity V3
- Remove explicit distribute depend
- Add volume backup commands
- python3: Introduce py33 to tox.ini
- Rename requires files to standard names
- Fix identity v2.0 entry point
- Tweak volume commands and add k=v argparse action
- Migrate to pbr
- Migrate to flake8
- Fix flake8 errors in anticipation of flake8 patch
- Switch to noun-verb command forms
- Add console commands
- Adds image `create` and `delete` functionality
- Add fixed-ip and floating-ip commands
- Add compute keypair commands
- Add policy to identity v3
- Add metadata support for volume
- Make entry point strings readable
- Add extra-specs support for volume-type
- Add endpoint v3 functionality
- Add service v3 support for identity
- Add functionality for add-role commands
- Add a simple extension hook
- Add role v3 support to identity in openstack client
- Added compute hypervisor support
- Turn down requests logging level
- Add snapshot support for v1 volume
- add domain, credential to identity v3 api
- Add volume support for openstack client
- Add compute hosts support
- Add metadata support for volume type
- Added compute service support
- Add quota v1 support for volume
- Added compute flavor support
- Added compute agent support
- Correct the version mapping to image service
- Add Cinder API V1 Support
- Multiple API version support
- Update .coveragerc
- Upgraded to PEP8 1.3.3 to stay aligned with Nova, etc
- Clean up test_shell so that the tests are captured though the test framework
- Use install_venv_common.py from oslo
- v3 identity - group and project api
- Sync latest openstack-common updates
- Standardize on a copyright header and ensure all files have them
- Migrate from nose to testr
- Clean up test environment and remove unused imports
- Updated gitignore and manifest
- Adds Glance API v2 support
- Fixes setup compatibility issue on Windows
- Add OpenStack trove classifier for PyPI
- Update compute client bits
- Keyring support for openstackclient
- If no password in env or command line, try prompting
- Add read_versioninfo method
- Add post-tag versioning
- Fix pep8 issues
- Move docs to doc
- minor fixes
- Add role CRUD commands
- Add endpoint CRUD commands
- Clean up tenant and server
- Update service commands
- Add user CRUD commands
- fix authentication setup in interactive mode and improve error handling so tracebacks are not printed twice
- Revise command boolean flags
- Move get_client_class() to common.utils
- Add tenant CRUD commands
- Add API versioning support
- look at the command the user is going to run before trying to authenticate them
- Add copyright notices and update dates
- Add tenant commands, work on service
- More identity client config
- Remove printt
- Add Identity to ClientManager
- Fix "help" command and implement "list server" and "show server"
- Change binary name to 'openstack'
- Auto generate AUTHORS for python-openstackclient
- Shell init & logging
- Reset project version to 0.1
- Add openstack-common and test infrastructure
- Cleanup auth client path
- Add 'list service' command and common modules
- Add token auth to shell and README
- Begin to add Keystone auth
- Change to argparse to match cliff 0.2
- Use cliff
- Set up common utils
- Add openstackclient bits
- First commit
LIBRARY API REFERENCE
osc_lib
osc_lib package
Subpackages
osc_lib.api package
Submodules
osc_lib.api.api module
Base API Library
- class osc_lib.api.api.BaseAPI(session=None, service_type=None, endpoint=None, **kwargs)
- Bases: object
Base API wrapper for keystoneauth1.session.Session
Encapsulate the translation between keystoneauth1.session.Session and requests.Session in a single layer:
- Restore some requests.session.Session compatibility; keystoneauth1.session.Session.request() has the method and url arguments swapped from the rest of the requests-using world.
- Provide basic endpoint handling when a Service Catalog is not available.
- HEADER_NAME = 'OpenStack-API-Version'
- SERVICE_TYPE = ''
- create(url, session=None, method=None, **params)
- Create a new resource
- Parameters
- url (string) -- The API-specific portion of the URL path
- session (Session) -- HTTP client session
- method (string) -- HTTP method (default POST)
- delete(url, session=None, **params)
- Delete a resource
- Parameters
- url (string) -- The API-specific portion of the URL path
- session (Session) -- HTTP client session
- find(path, value=None, attr=None, headers=None)
- Find a single resource by name or ID
- Parameters
- path (string) -- The API-specific portion of the URL path
- value (string) -- search expression (required, really)
- attr (string) -- name of attribute for secondary search
- headers (dict) -- Headers dictionary to pass to requests
- find_attr(path, value=None, attr=None, resource=None)
- Find a resource via attribute or ID
Most APIs return a list wrapped by a dict with the resource name as key. Some APIs (Identity) return a dict when a query string is present and there is one return value. Take steps to unwrap these bodies and return a single dict without any resource wrappers.
- Parameters
- path (string) -- The API-specific portion of the URL path
- value (string) -- value to search for
- attr (string) -- attribute to use for resource search
- resource (string) -- plural of the object resource name; defaults to path
- For example:
- n = find(netclient, 'network', 'networks', 'matrix')
- find_bulk(path, headers=None, **kwargs)
- Bulk load and filter locally
- Parameters
- path (string) -- The API-specific portion of the URL path
- kwargs -- A dict of AVPs to match - logical AND
- headers (dict) -- Headers dictionary to pass to requests
- Returns
- list of resource dicts
- find_one(path, **kwargs)
- Find a resource by name or ID
- Parameters
- path (string) -- The API-specific portion of the URL path
- Returns
- resource dict
- list(path, session=None, body=None, detailed=False, headers=None, **params)
- Return a list of resources
GET ${ENDPOINT}/${PATH}?${PARAMS}
path is often the object's plural resource type
- Parameters
- path (string) -- The API-specific portion of the URL path
- session (Session) -- HTTP client session
- body -- data that will be encoded as JSON and passed in POST request (GET will be sent by default)
- detailed (bool) -- Adds '/details' to path for some APIs to return extended attributes
- headers (dict) -- Headers dictionary to pass to requests
- Returns
- JSON-decoded response, could be a list or a dict-wrapped-list
osc_lib.api.auth module
Authentication Library
- osc_lib.api.auth.build_auth_plugins_option_parser(parser)
- Auth plugins options builder
Builds dynamically the list of options expected by each available authentication plugin.
- osc_lib.api.auth.check_valid_authentication_options(options, auth_plugin_name)
- Validate authentication options, and provide helpful error messages
- Parameters
- required_scope -- indicate whether a scoped token is required
- Validate authorization options, and provide helpful error messages.
- osc_lib.api.auth.get_keystone2keystone_auth(local_auth, service_provider, project_id=None, project_name=None, project_domain_id=None, project_domain_name=None)
- Return Keystone 2 Keystone authentication for service provider.
- Parameters
- local_auth -- authentication to use with the local Keystone
- service_provider -- service provider id as registered in Keystone
- project_id -- project id to scope to in the service provider
- project_name -- project name to scope to in the service provider
- project_domain_id -- id of domain in the service provider
- project_domain_name -- name of domain to in the service provider
- Returns
- Keystone2Keystone auth object for service provider
- osc_lib.api.auth.get_options_list()
- Gather plugin options so the help action has them available
- osc_lib.api.auth.get_plugin_list()
- Gather plugin list and cache it
osc_lib.api.utils module
API Utilities Library
- osc_lib.api.utils.simple_filter(data=None, attr=None, value=None, property_field=None)
- Filter a list of dicts
- Parameters
- data (list) -- The list to be filtered. The list is modified in-place and will be changed if any filtering occurs.
- attr (string) -- The name of the attribute to filter. If attr does not exist no match will succeed and no rows will be returned. If attr is None no filtering will be performed and all rows will be returned.
- value (string) -- The value to filter. None is considered to be a 'no filter' value. '' matches against a Python empty string.
- property_field (string) -- The name of the data field containing a property dict to filter. If property_field is None, attr is a field name. If property_field is not None, attr is a property key name inside the named property field.
- Returns
- Returns the filtered list
- Rtype list
This simple filter (one attribute, one exact-match value) searches a list of dicts to select items. It first searches the item dict for a matching attr then does an exact-match on the value. If property_field is given, it will look inside that field (if it exists and is a dict) for a matching value.
Module contents
osc_lib.cli package
Submodules
osc_lib.cli.client_config module
OpenStackConfig subclass for argument compatibility
- class osc_lib.cli.client_config.OSC_Config(config_files=None, vendor_files=None, override_defaults=None, force_ipv4=None, envvar_prefix=None, secure_files=None, pw_func=None, session_constructor=None, app_name=None, app_version=None, load_yaml_config=True, load_envvars=True, statsd_host=None, statsd_port=None, statsd_prefix=None, influxdb_config=None)
- Bases: openstack.config.loader.OpenStackConfig
- auth_config_hook(config)
- Allow examination of config values before loading auth plugin
OpenStackClient will override this to perform additional chacks on auth_type.
- load_auth_plugin(config)
- Get auth plugin and validate args
osc_lib.cli.format_columns module
Formattable column for specify content type
- class osc_lib.cli.format_columns.DictColumn(value)
- Bases: cliff.columns.FormattableColumn
Format column for dict content
- human_readable()
- Return a basic human readable version of the data.
- machine_readable()
- Return a raw data structure using only Python built-in types.
It must be possible to serialize the return value directly using a formatter like JSON, and it will be up to the formatter plugin to decide how to make that transformation.
- class osc_lib.cli.format_columns.DictListColumn(value)
- Bases: cliff.columns.FormattableColumn
Format column for dict, key is string, value is list
- human_readable()
- Return a basic human readable version of the data.
- machine_readable()
- Return a raw data structure using only Python built-in types.
It must be possible to serialize the return value directly using a formatter like JSON, and it will be up to the formatter plugin to decide how to make that transformation.
- class osc_lib.cli.format_columns.ListColumn(value)
- Bases: cliff.columns.FormattableColumn
Format column for list content
- human_readable()
- Return a basic human readable version of the data.
- class osc_lib.cli.format_columns.ListDictColumn(value)
- Bases: cliff.columns.FormattableColumn
Format column for list of dict content
- human_readable()
- Return a basic human readable version of the data.
osc_lib.cli.identity module
- osc_lib.cli.identity.add_project_owner_option_to_parser(parser)
- Register project and project domain options.
- Parameters
- parser -- argparse.Argument parser object.
- osc_lib.cli.identity.find_project(sdk_connection, name_or_id, domain_name_or_id=None)
- Find a project by its name name or ID.
If Forbidden to find the resource (a common case if the user does not have permission), then return the resource by creating a local instance of openstack.identity.v3.Project resource.
- Parameters
- sdk_connection (openstack.connection.Connection) -- Connection object of OpenStack SDK.
- name_or_id (string) -- Name or ID of the project
- domain_name_or_id -- Domain name or ID of the project. This can be used when there are multiple projects with a same name.
- Returns
- the project object found
- Return type
- openstack.identity.v3.project.Project
osc_lib.cli.parseractions module
argparse Custom Actions
- class osc_lib.cli.parseractions.KeyValueAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)
- Bases: argparse.Action
A custom action to parse arguments as key=value pairs
Ensures that dest is a dict and values are strings.
- class osc_lib.cli.parseractions.KeyValueAppendAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)
- Bases: argparse.Action
A custom action to parse arguments as key=value pairs
Ensures that dest is a dict and values are lists of strings.
- class osc_lib.cli.parseractions.MultiKeyValueAction(option_strings, dest, nargs=None, required_keys=None, optional_keys=None, **kwargs)
- Bases: argparse.Action
A custom action to parse arguments as key1=value1,key2=value2 pairs
Ensure that dest is a list. The list will finally contain multiple dicts, with key=value pairs in them.
NOTE: The arguments string should be a comma separated key-value pairs. And comma(',') and equal('=') may not be used in the key or value.
- validate_keys(keys)
- Validate the provided keys.
- Parameters
- keys -- A list of keys to validate.
- class osc_lib.cli.parseractions.MultiKeyValueCommaAction(option_strings, dest, nargs=None, required_keys=None, optional_keys=None, **kwargs)
- Bases: osc_lib.cli.parseractions.MultiKeyValueAction
Custom action to parse arguments from a set of key=value pair
Ensures that dest is a dict. Parses dict by separating comma separated string into individual values Ex. key1=val1,val2,key2=val3 => {"key1": "val1,val2", "key2": "val3"}
- class osc_lib.cli.parseractions.NonNegativeAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)
- Bases: argparse.Action
A custom action to check whether the value is non-negative or not
Ensures the value is >= 0.
- class osc_lib.cli.parseractions.RangeAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)
- Bases: argparse.Action
A custom action to parse a single value or a range of values
Parses single integer values or a range of integer values delimited by a colon and returns a tuple of integers: '4' sets dest to (4, 4) '6:9' sets dest to (6, 9)
Module contents
osc_lib.command package
Submodules
osc_lib.command.command module
- class osc_lib.command.command.Command(app, app_args, cmd_name=None)
- Bases: cliff.command.Command
- deprecated_option_warning(old_option, new_option)
- Emit a warning for use of a deprecated option
- log = <Logger osc_lib.command.command.Command (WARNING)>
- run(parsed_args)
- Invoked by the application when the command is run.
Developers implementing commands should override take_action().
Developers creating new command base classes (such as Lister and ShowOne) should override this method to wrap take_action().
Return the value returned by take_action() or 0.
- validate_os_beta_command_enabled()
- class osc_lib.command.command.CommandMeta(name, bases, cls_dict)
- Bases: abc.ABCMeta
- class osc_lib.command.command.Lister(app, app_args, cmd_name=None)
- Bases: osc_lib.command.command.Command, cliff.lister.Lister
- log = <Logger osc_lib.command.command.Lister (WARNING)>
- class osc_lib.command.command.ShowOne(app, app_args, cmd_name=None)
- Bases: osc_lib.command.command.Command, cliff.show.ShowOne
- log = <Logger osc_lib.command.command.ShowOne (WARNING)>
osc_lib.command.commandmanager module
- class osc_lib.command.commandmanager.CommandManager(namespace, convert_underscores=True)
- Bases: cliff.commandmanager.CommandManager
Noop subclass for transition purposes.
osc_lib.command.timing module
Timing Implementation
- class osc_lib.command.timing.Timing(app, app_args, cmd_name=None)
- Bases: osc_lib.command.command.Lister
Show timing data
- log = <Logger osc_lib.command.timing.Timing (WARNING)>
- take_action(parsed_args)
- Run command.
Return a tuple containing the column names and an iterable containing the data to be listed.
Module contents
osc_lib.utils package
Submodules
osc_lib.utils.columns module
- osc_lib.utils.columns.get_column_definitions(attr_map, long_listing)
- Return table headers and column names for a listing table.
An attribute map (attr_map) is a list of table entry definitions and the format of the map is as follows:
- Parameters
- •
- attr_map --
a list of table entry definitions. Each entry should be a tuple consisting of (API attribute name, header name, listing mode). For example:
(('id', 'ID', LIST_BOTH),
('name', 'Name', LIST_BOTH),
('tenant_id', 'Project', LIST_LONG_ONLY))
The third field of each tuple must be one of LIST_BOTH, LIST_LONG_ONLY (a corresponding column is shown only in a long mode), or LIST_SHORT_ONLY (a corresponding column is shown only in a short mode).
- •
- long_listing -- A boolean value which indicates a long listing or not. In most cases, parsed_args.long is passed to this argument.
- Returns
- A tuple of a list of table headers and a list of column names.
- osc_lib.utils.columns.get_columns(item, attr_map=None)
- Return pair of resource attributes and corresponding display names.
- Parameters
- •
- item --
a dictionary which represents a resource. Keys of the dictionary are expected to be attributes of the resource. Values are not referred to by this method.
{'id': 'myid', 'name': 'myname',
'foo': 'bar', 'tenant_id': 'mytenan'}
- •
- attr_map --
a list of mapping from attribute to display name. The same format is used as for get_column_definitions attr_map.
(('id', 'ID', LIST_BOTH),
('name', 'Name', LIST_BOTH),
('tenant_id', 'Project', LIST_LONG_ONLY))
- Returns
- A pair of tuple of attributes and tuple of display names.
(('id', 'name', 'tenant_id', 'foo'), # attributes
('ID', 'Name', 'Project', 'foo') # display names
Both tuples of attributes and display names are sorted by display names in the alphabetical order. Attributes not found in a given attr_map are kept as-is.
osc_lib.utils.tags module
- Add tag filtering options to a parser.
- Parameters
- parser -- argparse.Argument parser object.
- resource_name -- Description of the object being filtered.
- enhance_help -- A callable accepting a single parameter, the (translated) help string, and returning a (translated) help string. May be used by a caller wishing to add qualifying text, such as "Applies to version XYZ only", to the help strings for all options produced by this method.
- Add tag options to a parser for create commands.
- Parameters
- parser -- argparse.Argument parser object.
- resource_name -- Description of the object being filtered.
- enhance_help -- A callable accepting a single parameter, the (translated) help string, and returning a (translated) help string. May be used by a caller wishing to add qualifying text, such as "Applies to version XYZ only", to the help strings for all options produced by this method.
- Add tag options to a parser for set commands.
- Parameters
- parser -- argparse.Argument parser object.
- resource_name -- Description of the object being filtered.
- enhance_help -- A callable accepting a single parameter, the (translated) help string, and returning a (translated) help string. May be used by a caller wishing to add qualifying text, such as "Applies to version XYZ only", to the help strings for all options produced by this method.
- Add tag options to a parser for set commands.
- Parameters
- parser -- argparse.Argument parser object.
- resource_name -- Description of the object being filtered.
- enhance_help -- A callable accepting a single parameter, the (translated) help string, and returning a (translated) help string. May be used by a caller wishing to add qualifying text, such as "Applies to version XYZ only", to the help strings for all options produced by this method.
- Adds the tag arguments to an args list.
Intended to be used to append the tags to an argument list that will be used for service client.
- Parameters
- parsed_args -- Parsed argument object returned by argparse parse_args.
- args -- The argument list to add tags to.
- Set the tags on an object.
- Parameters
- client -- The service client to use setting the tags.
- obj -- The object (Resource) to set the tags on.
- parsed_args -- Parsed argument object returned by argparse parse_args.
- Unset the tags on an object.
- Parameters
- client -- The service client to use unsetting the tags.
- obj -- The object (Resource) to unset the tags on.
- parsed_args -- Parsed argument object returned by argparse parse_args.
Module contents
Common client utilities
- osc_lib.utils.backward_compat_col_lister(column_headers, columns, column_map)
- Convert the column headers to keep column backward compatibility.
Replace the new column name of column headers by old name, so that the column headers can continue to support to show the old column name by --column/-c option with old name, like: volume list -c 'Display Name'
- Parameters
- column_headers -- The column headers to be output in list command.
- columns -- The columns to be output.
- column_map -- The key of map is old column name, the value is new column name, like: {'old_col': 'new_col'}
- osc_lib.utils.backward_compat_col_showone(show_object, columns, column_map)
- Convert the output object to keep column backward compatibility.
Replace the new column name of output object by old name, so that the object can continue to support to show the old column name by --column/-c option with old name, like: volume show -c 'display_name'
- Parameters
- show_object -- The object to be output in create/show commands.
- columns -- The columns to be output.
- column_map -- The key of map is old column name, the value is new column name, like: {'old_col': 'new_col'}
- osc_lib.utils.build_kwargs_dict(arg_name, value)
- Return a dictionary containing arg_name if value is set.
- osc_lib.utils.calculate_header_and_attrs(column_headers, attrs, parsed_args)
- Calculate headers and attribute names based on parsed_args.column.
When --column (-c) option is specified, this function calculates column headers and expected API attribute names according to the OSC header/column definitions.
This function also adjusts the content of parsed_args.columns if API attribute names are used in parsed_args.columns. This allows users to specify API attribute names in -c option.
- Parameters
- column_headers -- A tuple/list of column headers to display
- attrs -- a tuple/list of API attribute names. The order of corresponding column header and API attribute name must match.
- parsed_args -- Parsed argument object returned by argparse parse_args
- Returns
- A tuple of calculated headers and API attribute names.
- osc_lib.utils.env(*vars, **kwargs)
- Search for the first defined of possibly many env vars
Returns the first environment variable defined in vars, or returns the default defined in kwargs.
- osc_lib.utils.find_min_match(items, sort_attr, **kwargs)
- Find all resources meeting the given minimum constraints
- Parameters
- items -- A List of objects to consider
- sort_attr -- Attribute to sort the resulting list
- kwargs -- A dict of attributes and their minimum values
- Return type
- A list of resources osrted by sort_attr that meet the minimums
- osc_lib.utils.find_resource(manager, name_or_id, **kwargs)
- Helper for the _find_* methods.
- Parameters
- manager -- A client manager class
- name_or_id -- The resource we are trying to find
- kwargs -- To be used in calling .find()
- Return type
- The found resource
This method will attempt to find a resource in a variety of ways. Primarily .get() methods will be called with name_or_id as an integer value, and tried again as a string value.
If both fail, then a .find() is attempted, which is essentially calling a .list() function with a 'name' query parameter that is set to name_or_id.
Lastly, if any kwargs are passed in, they will be treated as additional query parameters. This is particularly handy in the case of finding resources in a domain.
- osc_lib.utils.format_dict(data, prefix=None)
- Return a formatted string of key value pairs
- Parameters
- data -- a dict
- prefix -- the current parent keys in a recursive call
- Return type
- a string formatted to key='value'
- osc_lib.utils.format_dict_of_list(data, separator='; ')
- Return a formatted string of key value pair
- Parameters
- data -- a dict, key is string, value is a list of string, for example: {u'public': [u'2001:db8::8', u'172.24.4.6']}
- separator -- the separator to use between key/value pair (default: '; ')
- Returns
- a string formatted to {'key1'=['value1', 'value2']} with separated by separator
- osc_lib.utils.format_list(data, separator=', ')
- Return a formatted strings
- Parameters
- data -- a list of strings
- separator -- the separator to use between strings (default: ', ')
- Return type
- a string formatted based on separator
- osc_lib.utils.format_list_of_dicts(data)
- Return a formatted string of key value pairs for each dict
- Parameters
- data -- a list of dicts
- Return type
- a string formatted to key='value' with dicts separated by new line
- osc_lib.utils.format_size(size)
- Display size of a resource in a human readable format
- Parameters
- size (string) -- The size of the resource in bytes.
- Returns
- Returns the size in human-friendly format
- Rtype string
This function converts the size (provided in bytes) of a resource into a human-friendly format such as K, M, G, T, P, E, Z
- osc_lib.utils.get_client_class(api_name, version, version_map)
- Returns the client class for the requested API version
- Parameters
- api_name -- the name of the API, e.g. 'compute', 'image', etc
- version -- the requested API version
- version_map -- a dict of client classes keyed by version
- Return type
- a client class for the requested API version
- osc_lib.utils.get_dict_properties(item, fields, mixed_case_fields=None, formatters=None)
- Return a tuple containing the item properties.
- Parameters
- item -- a single dict resource
- fields -- tuple of strings with the desired field names
- mixed_case_fields -- tuple of field names to preserve case
- formatters -- dictionary mapping field names to callables to format the values
- osc_lib.utils.get_effective_log_level()
- Returns the lowest logging level considered by logging handlers
Retrieve and return the smallest log level set among the root logger's handlers (in case of multiple handlers).
- osc_lib.utils.get_field(item, field)
- osc_lib.utils.get_item_properties(item, fields, mixed_case_fields=None, formatters=None)
- Return a tuple containing the item properties.
- Parameters
- item -- a single item resource (e.g. Server, Project, etc)
- fields -- tuple of strings with the desired field names
- mixed_case_fields -- tuple of field names to preserve case
- formatters -- dictionary mapping field names to callables to format the values
- osc_lib.utils.get_osc_show_columns_for_sdk_resource(sdk_resource, osc_column_map, invisible_columns=None)
- Get and filter the display and attribute columns for an SDK resource.
Common utility function for preparing the output of an OSC show command. Some of the columns may need to get renamed, others made invisible.
- Parameters
- sdk_resource -- An SDK resource
- osc_column_map -- A hash of mappings for display column names
- invisible_columns -- A list of invisible column names
- Returns
- Two tuples containing the names of the display and attribute columns
- osc_lib.utils.get_password(stdin, prompt=None, confirm=True)
- osc_lib.utils.is_ascii(string)
- osc_lib.utils.read_blob_file_contents(blob_file)
- osc_lib.utils.sort_items(items, sort_str, sort_type=None)
- Sort items based on sort keys and sort directions given by sort_str.
- Parameters
- items -- a list or generator object of items
- sort_str -- a string defining the sort rules, the format is '<key1>:[direction1],<key2>:[direction2]...', direction can be 'asc' for ascending or 'desc' for descending, if direction is not given, it's ascending by default
- Returns
- sorted items
- osc_lib.utils.wait_for_delete(manager, res_id, status_field='status', error_status=['error'], exception_name=['NotFound'], sleep_time=5, timeout=300, callback=None)
- Wait for resource deletion
- Parameters
- manager -- the manager from which we can get the resource
- res_id -- the resource id to watch
- status_field -- the status attribute in the returned resource object, this is used to check for error states while the resource is being deleted
- error_status -- a list of status strings for error
- exception_name -- a list of exception strings for deleted case
- sleep_time -- wait this long between checks (seconds)
- timeout -- check until this long (seconds)
- callback -- called per sleep cycle, useful to display progress; this function is passed a progress value during each iteration of the wait loop
- Return type
- True on success, False if the resource has gone to error state or the timeout has been reached
- osc_lib.utils.wait_for_status(status_f, res_id, status_field='status', success_status=['active'], error_status=['error'], sleep_time=5, callback=None)
- Wait for status change on a resource during a long-running operation
- Parameters
- status_f -- a status function that takes a single id argument
- res_id -- the resource id to watch
- status_field -- the status attribute in the returned resource object
- success_status -- a list of status strings for successful completion
- error_status -- a list of status strings for error
- sleep_time -- wait this long (seconds)
- callback -- called per sleep cycle, useful to display progress
- Return type
- True on success
Submodules
osc_lib.clientmanager module
Manage access to the clients, including authenticating when needed.
- class osc_lib.clientmanager.ClientCache(factory)
- Bases: object
Descriptor class for caching created client handles.
- class osc_lib.clientmanager.ClientManager(cli_options=None, api_version=None, pw_func=None, app_name=None, app_version=None)
- Bases: object
Manages access to API clients, including authentication.
- property auth_ref
- Dereference will trigger an auth if it hasn't already
- get_configuration()
- get_endpoint_for_service_type(service_type, region_name=None, interface='public')
- Return the endpoint URL for the service type.
- is_service_available(service_type)
- Check if a service type is in the current Service Catalog
- setup_auth()
- Set up authentication
This is deferred until authentication is actually attempted because it gets in the way of things that do not require auth.
- validate_scope()
osc_lib.exceptions module
Exception definitions.
- exception osc_lib.exceptions.AuthorizationFailure
- Bases: Exception
- exception osc_lib.exceptions.BadRequest(code, message=None, details=None)
- Bases: osc_lib.exceptions.ClientException
HTTP 400 - Bad request: you sent some malformed data.
- http_status = 400
- message = 'Bad request'
- exception osc_lib.exceptions.ClientException(code, message=None, details=None)
- Bases: Exception
The base exception class for all exceptions this library raises.
- exception osc_lib.exceptions.CommandError
- Bases: Exception
- exception osc_lib.exceptions.Conflict(code, message=None, details=None)
- Bases: osc_lib.exceptions.ClientException
HTTP 409 - Conflict
- http_status = 409
- message = 'Conflict'
- exception osc_lib.exceptions.EndpointNotFound
- Bases: Exception
Could not find Service or Region in Service Catalog.
- exception osc_lib.exceptions.Forbidden(code, message=None, details=None)
- Bases: osc_lib.exceptions.ClientException
HTTP 403 - Forbidden: not authorized to access to this resource.
- http_status = 403
- message = 'Forbidden'
- exception osc_lib.exceptions.HTTPNotImplemented(code, message=None, details=None)
- Bases: osc_lib.exceptions.ClientException
HTTP 501 - Not Implemented: server does not support this operation.
- http_status = 501
- message = 'Not Implemented'
- exception osc_lib.exceptions.InvalidValue
- Bases: Exception
An argument value is not valid: wrong type, out of range, etc
- message = 'Supplied value is not valid'
- exception osc_lib.exceptions.NoTokenLookupException
- Bases: Exception
This does not support looking up endpoints from an existing token.
- exception osc_lib.exceptions.NotFound(code, message=None, details=None)
- Bases: osc_lib.exceptions.ClientException
HTTP 404 - Not found
- http_status = 404
- message = 'Not found'
- exception osc_lib.exceptions.OverLimit(code, message=None, details=None)
- Bases: osc_lib.exceptions.ClientException
HTTP 413 - Over limit: reached the API limits for this time period.
- http_status = 413
- message = 'Over limit'
- exception osc_lib.exceptions.PluginAttributeError
- Bases: Exception
A plugin threw an AttributeError while being lazily loaded.
- exception osc_lib.exceptions.Unauthorized(code, message=None, details=None)
- Bases: osc_lib.exceptions.ClientException
HTTP 401 - Unauthorized: bad credentials.
- http_status = 401
- message = 'Unauthorized'
- exception osc_lib.exceptions.UnsupportedVersion
- Bases: Exception
The user is trying to use an unsupported version of the API
osc_lib.i18n module
osc_lib.logs module
Application logging
- class osc_lib.logs.LogConfigurator(options)
- Bases: object
- configure(cloud_config)
- osc_lib.logs.get_loggers()
- osc_lib.logs.log_level_from_config(config)
- osc_lib.logs.log_level_from_options(options)
- osc_lib.logs.log_level_from_string(level_string)
- osc_lib.logs.set_warning_filter(log_level)
osc_lib.shell module
Command-line interface to the OpenStack APIs
- class osc_lib.shell.OpenStackShell(description=None, version=None, command_manager=None, stdin=None, stdout=None, stderr=None, interactive_app_factory=None, deferred_help=False)
- Bases: cliff.app.App
- CONSOLE_MESSAGE_FORMAT = '%(levelname)s: %(name)s %(message)s'
- build_option_parser(description, version)
- Return an argparse option parser for this application.
Subclasses may override this method to extend the parser with more global options.
- Parameters
- description (str) -- full description of the application
- version (str) -- version number for the application
- argparse_kwargs -- extra keyword argument passed to the ArgumentParser constructor
- clean_up(cmd, result, err)
- Hook run after a command is done to shutdown the app.
- Parameters
- cmd (cliff.command.Command) -- command processor being invoked
- result (int) -- return value of cmd
- err (Exception) -- exception or None
- close_profile()
- configure_logging()
- Configure logging for the app.
- init_profile()
- initialize_app(argv)
- Global app init bits:
- set up API versions
- validate authentication info
- authenticate against Identity if requested
- interact()
- log = <Logger osc_lib.shell (WARNING)>
- prepare_to_run_command(cmd)
- Set up auth and API versions
- run(argv)
- Equivalent to the main program for the application.
- Parameters
- argv (list of str) -- input arguments and options
- run_subcommand(argv)
- timing_data = []
- osc_lib.shell.main(argv=None)
- osc_lib.shell.prompt_for_password(prompt=None)
- Prompt user for a password
Prompt for a password if stdin is a tty.
osc_lib.version module
Module contents
CONTRIBUTING
osc-lib utilizes all of the usual OpenStack processes and requirements for contributions. The code is hosted on OpenStack's Git server. Bug reports and blueprints may be submitted to the python-openstackclient project on Launchpad. Code may be submitted to the openstack/osc-lib project using Gerrit. Developers may also be found in the IRC channel #openstack-sdks.
Indices and tables
- genindex
- modindex
- search
AUTHOR
unknown
| November 29, 2023 | 2.7.0 |
