From 79dfe2cbefbbf14b69ae10c44a89a4fe45fedbe5 Mon Sep 17 00:00:00 2001 From: John Spray Date: Mon, 12 May 2014 10:55:58 +0100 Subject: [PATCH] tasks: Use '_' instead of '-' in names Python modules are not allowed to contain hyphens in the name. Using hyphens only works here because we're using low level __import__. Change run_tasks to replace '-' with '_' when reading configs, and rename the task modules to have valid python module names. Aside from general hygiene, the motivation to do this is to allow one task to build on code in another task by importing it. Signed-off-by: John Spray --- teuthology/run_tasks.py | 4 ++++ teuthology/task/{ceph-deploy.py => ceph_deploy.py} | 0 teuthology/task/{ceph-fuse.py => ceph_fuse.py} | 0 teuthology/task/{cifs-mount.py => cifs_mount.py} | 0 teuthology/task/{radosgw-admin.py => radosgw_admin.py} | 0 .../task/{radosgw-admin-rest.py => radosgw_admin_rest.py} | 0 teuthology/task/{radosgw-agent.py => radosgw_agent.py} | 0 teuthology/task/{rest-api.py => rest_api.py} | 0 teuthology/task/{rgw-logsocket.py => rgw_logsocket.py} | 0 9 files changed, 4 insertions(+) rename teuthology/task/{ceph-deploy.py => ceph_deploy.py} (100%) rename teuthology/task/{ceph-fuse.py => ceph_fuse.py} (100%) rename teuthology/task/{cifs-mount.py => cifs_mount.py} (100%) rename teuthology/task/{radosgw-admin.py => radosgw_admin.py} (100%) rename teuthology/task/{radosgw-admin-rest.py => radosgw_admin_rest.py} (100%) rename teuthology/task/{radosgw-agent.py => radosgw_agent.py} (100%) rename teuthology/task/{rest-api.py => rest_api.py} (100%) rename teuthology/task/{rgw-logsocket.py => rgw_logsocket.py} (100%) diff --git a/teuthology/run_tasks.py b/teuthology/run_tasks.py index cc387e37..99158ff2 100644 --- a/teuthology/run_tasks.py +++ b/teuthology/run_tasks.py @@ -13,6 +13,10 @@ def run_one_task(taskname, **kwargs): subtask = 'task' if '.' in taskname: (submod, subtask) = taskname.rsplit('.', 1) + + # Teuthology configs may refer to modules like ceph_deploy as ceph-deploy + submod = submod.replace('-', '_') + parent = __import__('teuthology.task', globals(), locals(), [submod], 0) try: mod = getattr(parent, submod) diff --git a/teuthology/task/ceph-deploy.py b/teuthology/task/ceph_deploy.py similarity index 100% rename from teuthology/task/ceph-deploy.py rename to teuthology/task/ceph_deploy.py diff --git a/teuthology/task/ceph-fuse.py b/teuthology/task/ceph_fuse.py similarity index 100% rename from teuthology/task/ceph-fuse.py rename to teuthology/task/ceph_fuse.py diff --git a/teuthology/task/cifs-mount.py b/teuthology/task/cifs_mount.py similarity index 100% rename from teuthology/task/cifs-mount.py rename to teuthology/task/cifs_mount.py diff --git a/teuthology/task/radosgw-admin.py b/teuthology/task/radosgw_admin.py similarity index 100% rename from teuthology/task/radosgw-admin.py rename to teuthology/task/radosgw_admin.py diff --git a/teuthology/task/radosgw-admin-rest.py b/teuthology/task/radosgw_admin_rest.py similarity index 100% rename from teuthology/task/radosgw-admin-rest.py rename to teuthology/task/radosgw_admin_rest.py diff --git a/teuthology/task/radosgw-agent.py b/teuthology/task/radosgw_agent.py similarity index 100% rename from teuthology/task/radosgw-agent.py rename to teuthology/task/radosgw_agent.py diff --git a/teuthology/task/rest-api.py b/teuthology/task/rest_api.py similarity index 100% rename from teuthology/task/rest-api.py rename to teuthology/task/rest_api.py diff --git a/teuthology/task/rgw-logsocket.py b/teuthology/task/rgw_logsocket.py similarity index 100% rename from teuthology/task/rgw-logsocket.py rename to teuthology/task/rgw_logsocket.py -- 2.47.3