From: John Mulligan Date: Thu, 25 Apr 2024 14:10:25 +0000 (-0400) Subject: qa/tasks/cephadm: refactor out a download cephadm function X-Git-Tag: v20.0.0~1973^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=41b64715c1ca7d3187d759528546a98189645189;p=ceph.git qa/tasks/cephadm: refactor out a download cephadm function The code was duplicated across two of the functions after getting the cephadm binary download url from shaman/chacra. Deduplicate it. Signed-off-by: John Mulligan --- diff --git a/qa/tasks/cephadm.py b/qa/tasks/cephadm.py index ec052ef0daa..8df3e01af53 100644 --- a/qa/tasks/cephadm.py +++ b/qa/tasks/cephadm.py @@ -316,28 +316,8 @@ def _fetch_cephadm_from_chachra(ctx, config, cluster_name): sha1=sha1, ) log.info("Discovered cachra url: %s", url) - ctx.cluster.run( - args=[ - 'curl', '--silent', '-L', url, - run.Raw('>'), - ctx.cephadm, - run.Raw('&&'), - 'ls', '-l', - ctx.cephadm, - ], - ) + _download_cephadm(ctx, url) - # sanity-check the resulting file and set executable bit - cephadm_file_size = '$(stat -c%s {})'.format(ctx.cephadm) - ctx.cluster.run( - args=[ - 'test', '-s', ctx.cephadm, - run.Raw('&&'), - 'test', run.Raw(cephadm_file_size), "-gt", run.Raw('1000'), - run.Raw('&&'), - 'chmod', '+x', ctx.cephadm, - ], - ) def _fetch_stable_branch_cephadm_from_chacra(ctx, config, cluster_name): branch = config.get('compiled_cephadm_branch', 'reef') @@ -365,6 +345,11 @@ def _fetch_stable_branch_cephadm_from_chacra(ctx, config, cluster_name): branch=branch, ) log.info("Discovered cachra url: %s", url) + _download_cephadm(ctx, url) + + +def _download_cephadm(ctx, url): + log.info("Downloading cephadm from url: %s", url) ctx.cluster.run( args=[ 'curl', '--silent', '-L', url,