Unverified Commit 7c68c878 authored by Marius van den Beek's avatar Marius van den Beek Committed by GitHub
Browse files

Merge pull request #14105 from mvdbeek/more_robust_test_exit_code_127_k8s_test

Improve robustness of test_exit_code_127 k8s test
parents 24690547 13c34e97
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -6,7 +6,6 @@ import json
import logging
import os
import re
import shlex
import subprocess
import tempfile

@@ -28,6 +27,7 @@ from galaxy.datatypes.sniff import (
)
from galaxy.util import (
    nice_size,
    shlex_join,
    string_as_bool,
    unicodify,
)
@@ -219,7 +219,7 @@ class Ipynb(Json):
                ofilename = dataset.file_name
                log.exception(
                    'Command "%s" failed. Could not convert the Jupyter Notebook to HTML, defaulting to plain text.',
                    " ".join(map(shlex.quote, cmd)),
                    shlex_join(cmd),
                )
            return open(ofilename, mode="rb"), headers

+2 −2
Original line number Diff line number Diff line
@@ -4,7 +4,6 @@ import json
import logging
import os
import re
import shlex
import shutil
import sys
import tempfile
@@ -18,6 +17,7 @@ import packaging.version
from galaxy.util import (
    commands,
    listify,
    shlex_join,
    smart_str,
    which,
)
@@ -237,7 +237,7 @@ class CondaContext(installable.InstallableContext):
        env = {}
        if self.condarc_override:
            env["CONDARC"] = self.condarc_override
        cmd_string = " ".join(map(shlex.quote, cmd))
        cmd_string = shlex_join(cmd)
        kwds = dict()
        try:
            if stdout_path:
+2 −2
Original line number Diff line number Diff line
@@ -12,7 +12,6 @@ Build a mulled image with:
import json
import logging
import os
import shlex
import shutil
import stat
import string
@@ -31,6 +30,7 @@ from galaxy.tool_util.deps.docker_util import command_list as docker_command_lis
from galaxy.util import (
    commands,
    safe_makedirs,
    shlex_join,
    unicodify,
)
from ._cli import arg_parser
@@ -301,7 +301,7 @@ def mull_targets(
            involucro_args.insert(6, "-set")
            involucro_args.insert(7, f"TEST_BINDS={','.join(test_bind)}")
    cmd = involucro_context.build_command(involucro_args)
    print(f"Executing: {' '.join(shlex.quote(_) for _ in cmd)}")
    print(f"Executing: {shlex_join(cmd)}")
    if dry_run:
        return 0
    ensure_installed(involucro_context, True)
+9 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ import json
import os
import random
import re
import shlex
import shutil
import smtplib
import stat
@@ -77,6 +78,14 @@ from .path import ( # noqa: F401
    safe_relpath,
)

try:
    shlex_join = shlex.join  # type: ignore[attr-defined]
except AttributeError:
    # Python < 3.8
    def shlex_join(split_command):
        return " ".join(map(shlex.quote, split_command))


inflector = Inflector()

log = get_logger(__name__)
+1 −1
Original line number Diff line number Diff line
@@ -365,7 +365,7 @@ def external_chown(path, pwent, external_chown_script, description="file"):

        cmd = shlex.split(external_chown_script)
        cmd.extend([path, pwent[0], str(pwent[3])])
        log.debug(f"Changing ownership of {path} with: {' '.join(map(shlex.quote, cmd))}")
        log.debug(f"Changing ownership of {path} with: '{galaxy.util.shlex_join(cmd)}'")
        galaxy.util.commands.execute(cmd)
        return True
    except galaxy.util.commands.CommandLineException as e:
Loading