diff --git a/examples/authenticate.py b/examples/authenticate.py index 981c62c6b..de0e150a8 100644 --- a/examples/authenticate.py +++ b/examples/authenticate.py @@ -14,7 +14,7 @@ Authentication example To authenticate you must have the environment variables set or use the -command line options. This is a good example to start wtih because once +command line options. This is a good example to start with because once you know you can authenticate, you can perform other operations that require authentication. Refer to the example common.py for the environment variables or command line options to use. diff --git a/examples/head.py b/examples/head.py index bc7ba9f3f..87e80de34 100644 --- a/examples/head.py +++ b/examples/head.py @@ -10,13 +10,21 @@ # License for the specific language governing permissions and limitations # under the License. +""" +Example Head Command + +For example: + python -m examples.head openstack/image/v1/image.py \ + --data 9d7d22d0-7d43-481f-a7eb-d93ea2791409 +""" + import sys from examples import common from examples import session -def run_get(opts): +def run_head(opts): sess = session.make_session(opts) cls = common.find_resource_cls(opts) data = common.get_data_option(opts) @@ -28,4 +36,4 @@ def run_get(opts): if __name__ == "__main__": opts = common.setup() - sys.exit(common.main(opts, run_get)) + sys.exit(common.main(opts, run_head)) diff --git a/examples/list.py b/examples/list.py index ed94c58e6..0246b6484 100644 --- a/examples/list.py +++ b/examples/list.py @@ -16,19 +16,9 @@ from examples import common from examples import session -def make_resource(opts): - argument = opts.argument - args = argument.rpartition('.') - from_str = args[0] - class_str = args[2] - __import__(from_str) - mod = sys.modules[from_str] - return getattr(mod, class_str) - - def run_list(opts): sess = session.make_session(opts) - cls = make_resource(opts) + cls = common.find_resource_cls(opts) for obj in cls.list(sess): print(str(obj)) return