Bind CLI arguments to a shell.py do_foo function.
Decorator for CLI args.
Example:
>>> @arg("name", help="Name of the new entity")
... def entity_create(args):
... pass
Helper to run an action on many resources.
Returns the first environment variable set.
If all are empty, defaults to ‘’ or keyword arg default.
Helper for the _find_* methods.
Return a new dict whose sub-dicts have been merged into the original. Each of the parents keys are prepended to the child’s to prevent collisions. Any string elements will be JSON parsed before flattening.
>>> flatten_dict({'service': {'host':'cloud9@compute-068', 'id': 143}})
{'service_host': colud9@compute-068', 'service_id': 143}
Retrieves service type from function.
Returns validation of a value as an integer.
Checks if the function does not require authentication.
Mark such functions with the @unauthenticated decorator.
bool
Given an object attribute, return a formatted field name and a formatter suitable for passing to print_list.
Optionally pass a dict mapping attribute names to a function. The function will be passed the value of the attribute and should return the string to display.
Convert dict params to query string
Returns a formatted dict as ‘key=value’.
Record the time of a specific action.
times – A list of tuples holds time data.
enabled – Whether timing is enabled.
args – Other data to be stored besides time data, these args will be joined to a string.
Like issubclass, but will just return False if not a class.
Adds ‘service_type’ attribute to decorated function.
Usage:
@service_type('volume')
def mymethod(f):
...
Adds ‘unauthenticated’ attribute to decorated function.
Usage:
>>> @unauthenticated
... def mymethod(f):
... pass
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.