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
Returns the first environment variable set.
If all are empty, defaults to ‘’ or keyword arg default.
Look for resource in a given manager.
Used as a helper for the _find_* methods. Example:
def _find_hypervisor(cs, hypervisor):
#Get a hypervisor by name or ID.
return cliutils.find_resource(cs.hypervisors, hypervisor)
Read password from TTY.
Retrieves service type from function.
Checks if the function does not require authentication.
Mark such functions with the @unauthenticated decorator.
Returns: | bool |
---|
Print a dict as a table of two columns.
Parameters: |
|
---|
Print a list or objects as a table, one row per object.
Parameters: |
|
---|
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
Check that the supplied args are sufficient for calling a function.
>>> validate_args(lambda a: None)
Traceback (most recent call last):
...
MissingArgs: Missing argument(s): a
>>> validate_args(lambda a, b, c, d: None, 0, c=1)
Traceback (most recent call last):
...
MissingArgs: Missing argument(s): b, d
Parameters: |
|
---|