diff options
author | Linghui Zeng <linghui.zeng@huawei.com> | 2016-11-14 10:29:21 +0800 |
---|---|---|
committer | Linghui Zeng <linghui.zeng@huawei.com> | 2016-11-15 12:35:55 +0000 |
commit | b90fc8907f0c4ba716d6332159f881f880965277 (patch) | |
tree | ef45a29df64a4d401c796e6da6ede3c5f857af00 /dovetail/container.py | |
parent | 64b221bee631cf52bf6a1109c16f9544eff58f80 (diff) |
dovetail tool: replace the hard-coded "Tescase" and modify some classmethod
JIRA: DOVETAIL-45
1. In the testcase.py file, we replace the hard-coded "Tesecase" with "cls" or "self" based on
the specific contexts.
2. For all the four committed files, we modify some classmethod into staticmethod because each
method is basically just a function, called syntactically like a method, but without access
to the object and its' internals (attributes and other methods).
Change-Id: Ieb452f476a2d33ae9aca4c904ae7d2c92b68689e
Signed-off-by: Linghui Zeng <linghui.zeng@huawei.com>
Diffstat (limited to 'dovetail/container.py')
-rw-r--r-- | dovetail/container.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/dovetail/container.py b/dovetail/container.py index 6d7ac94d..57ce2144 100644 --- a/dovetail/container.py +++ b/dovetail/container.py @@ -29,8 +29,8 @@ class Container: def get(cls, type): return cls.container_list[type] - @classmethod - def get_docker_image(cls, type): + @staticmethod + def get_docker_image(type): return '%s:%s' % (dovetail_config[type]['image_name'], dovetail_config[type]['docker_tag']) @@ -62,14 +62,14 @@ class Container: dt_utils.exec_cmd(cmd, logger) cls.has_pull_latest_image[type] = True - @classmethod - def clean(cls, container_id): + @staticmethod + def clean(container_id): cmd1 = 'sudo docker stop %s' % (container_id) dt_utils.exec_cmd(cmd1, logger) cmd2 = 'sudo docker rm %s' % (container_id) dt_utils.exec_cmd(cmd2, logger) - @classmethod - def exec_cmd(cls, container_id, sub_cmd, exit_on_error=False): + @staticmethod + def exec_cmd(container_id, sub_cmd, exit_on_error=False): cmd = 'sudo docker exec %s /bin/bash -c "%s"' % (container_id, sub_cmd) dt_utils.exec_cmd(cmd, logger, exit_on_error) |