beanstalk,
nuke,
report,
+ repo_utils,
worker,
)
from teuthology.config import config as teuth_config
from teuthology.dispatcher import supervisor
from teuthology.exceptions import SkipJob
from teuthology.lock import ops as lock_ops
-from teuthology.repo_utils import fetch_qa_suite, fetch_teuthology
from teuthology import safepath
log = logging.getLogger(__name__)
result_proc = None
if teuth_config.teuthology_path is None:
- fetch_teuthology('main')
- fetch_qa_suite('main')
+ repo_utils.fetch_teuthology('main')
+ repo_utils.fetch_qa_suite('main')
keep_running = True
job_procs = set()
from teuthology.openstack import OpenStack, OpenStackInstance, enforce_json_dictionary
from teuthology.orchestra.remote import Remote
from teuthology.parallel import parallel
-from teuthology.task.internal import check_lock, add_remotes, connect
+from teuthology.task import internal
log = logging.getLogger(__name__)
if ctx.check_locks:
# does not check to ensure if the node is 'up'
# we want to be able to nuke a downed node
- check_lock.check_lock(ctx, None, check_up=False)
+ internal.check_lock.check_lock(ctx, None, check_up=False)
status = get_status(host)
if status['machine_type'] in provision.fog.get_types():
remote.console.power_off()
log.info("Will attempt to connect via SSH")
remote = Remote(host)
remote.connect()
- add_remotes(ctx, None)
- connect(ctx, None)
+ internal.add_remotes(ctx, None)
+ internal.connect(ctx, None)
clear_firewall(ctx)
shutdown_daemons(ctx)
kill_valgrind(ctx)
from tempfile import mkdtemp, NamedTemporaryFile
+from teuthology import repo_utils
from teuthology.config import config as teuth_config
from teuthology.exceptions import CommandFailedError, AnsibleFailedError
from teuthology.job_status import set_status
-from teuthology.repo_utils import fetch_repo
from teuthology.task import Task
log = logging.getLogger(__name__)
+
class LoggerFile(object):
"""
A thin wrapper around a logging.Logger instance that provides a file-like
"""
repo = self.config.get('repo', '.')
if repo.startswith(('http://', 'https://', 'git@', 'git://')):
- repo_path = fetch_repo(
+ repo_path = repo_utils.fetch_repo(
repo,
self.config.get('branch', 'main'),
)
task.find_repo()
assert task.repo_path == os.path.expanduser(self.task_config['repo'])
- @patch('teuthology.task.ansible.fetch_repo')
+ @patch('teuthology.repo_utils.fetch_repo')
def test_find_repo_path_remote(self, m_fetch_repo):
self.task_config.update(dict(
repo='git://fake_host/repo.git',
task.find_repo()
assert task.repo_path == os.path.expanduser('/tmp/repo')
- @patch('teuthology.task.ansible.fetch_repo')
+ @patch('teuthology.repo_utils.fetch_repo')
def test_find_repo_http(self, m_fetch_repo):
self.task_config.update(dict(
repo='http://example.com/my/repo',
m_fetch_repo.assert_called_once_with(self.task_config['repo'],
'main')
- @patch('teuthology.task.ansible.fetch_repo')
+ @patch('teuthology.repo_utils.fetch_repo')
def test_find_repo_git(self, m_fetch_repo):
self.task_config.update(dict(
repo='git@example.com/my/repo',
def start_patchers(self):
super(TestCephLabTask, self).start_patchers()
self.patchers['fetch_repo'] = patch(
- 'teuthology.task.ansible.fetch_repo',
+ 'teuthology.repo_utils.fetch_repo',
)
self.patchers['fetch_repo'].return_value = 'PATH'
for name in self.patchers.keys():
self.start_patcher(name)
- @patch('teuthology.task.ansible.fetch_repo')
+ @patch('teuthology.repo_utils.fetch_repo')
def test_find_repo_http(self, m_fetch_repo):
repo = os.path.join(config.ceph_git_base_url,
'ceph-cm-ansible.git')
worker.run_with_watchdog(process, config)
m_symlink_log.assert_called_with(config["worker_log"], config["archive_path"])
- @patch("teuthology.worker.ls_remote")
+ @patch("teuthology.repo_utils.ls_remote")
@patch("os.path.isdir")
- @patch("teuthology.worker.fetch_teuthology")
+ @patch("teuthology.repo_utils.fetch_teuthology")
@patch("teuthology.worker.teuth_config")
- @patch("teuthology.worker.fetch_qa_suite")
+ @patch("teuthology.repo_utils.fetch_qa_suite")
def test_prep_job(self, m_fetch_qa_suite, m_teuth_config,
m_fetch_teuthology, m_isdir, m_ls_remote):
config = dict(
@patch("teuthology.worker.run_job")
@patch("teuthology.worker.prep_job")
@patch("beanstalkc.Job", autospec=True)
- @patch("teuthology.worker.fetch_qa_suite")
- @patch("teuthology.worker.fetch_teuthology")
+ @patch("teuthology.repo_utils.fetch_qa_suite")
+ @patch("teuthology.repo_utils.fetch_teuthology")
@patch("teuthology.worker.beanstalk.watch_tube")
@patch("teuthology.worker.beanstalk.connect")
@patch("os.path.isdir", return_value=True)
job.bury.assert_called_once_with()
job.delete.assert_called_once_with()
- @patch("teuthology.worker.ls_remote")
+ @patch("teuthology.repo_utils.ls_remote")
@patch("teuthology.worker.report.try_push_job_info")
@patch("teuthology.worker.run_job")
@patch("beanstalkc.Job", autospec=True)
- @patch("teuthology.worker.fetch_qa_suite")
- @patch("teuthology.worker.fetch_teuthology")
+ @patch("teuthology.repo_utils.fetch_qa_suite")
+ @patch("teuthology.repo_utils.fetch_teuthology")
@patch("teuthology.worker.beanstalk.watch_tube")
@patch("teuthology.worker.beanstalk.connect")
@patch("os.path.isdir", return_value=True)
from datetime import datetime
-from teuthology import setup_log_file, install_except_hook, kill
-from teuthology import beanstalk
-from teuthology import report
-from teuthology import safepath
+from teuthology import (
+ # non-modules
+ setup_log_file,
+ install_except_hook,
+ # modules
+ beanstalk,
+ kill,
+ report,
+ repo_utils,
+ safepath,
+)
from teuthology.config import config as teuth_config
from teuthology.config import set_config_attr
from teuthology.exceptions import BranchNotFoundError, CommitNotFoundError, SkipJob, MaxWhileTries
-from teuthology.repo_utils import fetch_qa_suite, fetch_teuthology, ls_remote, build_git_url
log = logging.getLogger(__name__)
start_time = datetime.utcnow()
result_proc = None
if teuth_config.teuthology_path is None:
- fetch_teuthology('main')
- fetch_qa_suite('main')
+ repo_utils.fetch_teuthology('main')
+ repo_utils.fetch_qa_suite('main')
keep_running = True
while keep_running:
job_config['teuthology_branch'] = teuthology_branch
teuthology_sha1 = job_config.get('teuthology_sha1')
if not teuthology_sha1:
- repo_url = build_git_url('teuthology', 'ceph')
- teuthology_sha1 = ls_remote(repo_url, teuthology_branch)
+ repo_url = repo_utils.build_git_url('teuthology', 'ceph')
+ teuthology_sha1 = repo_utils.ls_remote(repo_url, teuthology_branch)
if not teuthology_sha1:
reason = "Teuthology branch {} not found; marking job as dead".format(teuthology_branch)
log.error(reason)
if teuth_config.teuthology_path is not None:
teuth_path = teuth_config.teuthology_path
else:
- teuth_path = fetch_teuthology(branch=teuthology_branch,
+ teuth_path = repo_utils.fetch_teuthology(branch=teuthology_branch,
commit=teuthology_sha1)
# For the teuthology tasks, we look for suite_branch, and if we
# don't get that, we look for branch, and fall back to 'main'.
if suite_repo:
teuth_config.ceph_qa_suite_git_url = suite_repo
job_config['suite_path'] = os.path.normpath(os.path.join(
- fetch_qa_suite(suite_branch, suite_sha1),
+ repo_utils.fetch_qa_suite(suite_branch, suite_sha1),
job_config.get('suite_relpath', ''),
))
except (BranchNotFoundError, CommitNotFoundError) as exc: