diff options
author | 2024-03-26 09:14:39 +0000 | |
---|---|---|
committer | 2024-03-26 09:14:39 +0000 | |
commit | de4032713caec1eb7558df76996d1d158caf5b2b (patch) | |
tree | 84bcd4f2f79974610a3d614387558218eba9efc0 | |
parent | Bump black from 24.1.1 to 24.3.0 (#192) (diff) |
Make Kubernetes user creation script Linux friendly (#195)
-rw-r--r-- | kubernetes/scripts/create_x509_user_config.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/kubernetes/scripts/create_x509_user_config.py b/kubernetes/scripts/create_x509_user_config.py index f670eaf..195e149 100644 --- a/kubernetes/scripts/create_x509_user_config.py +++ b/kubernetes/scripts/create_x509_user_config.py @@ -40,7 +40,8 @@ ROLE_BINDING_PATCH_TEMPLATE = """[ def run_and_return_output(command: str, cwd: str | None = None) -> str: """Run a command in a shell and return the result as a string.""" return subprocess.run( - command, # noqa: S603 + command, + shell=True, # noqa: S602 stdout=subprocess.PIPE, text=True, check=True, @@ -84,7 +85,7 @@ def give_user_perms(tmpdir: str) -> None: def build_kubectl_config(tmpdir: str) -> None: """Build up a kubectl config from all the files in the tmpdir.""" - cluster_public_key = run_and_return_output(r"kubectl get cm kube-root-ca.crt -o jsonpath={['data']['ca\.crt']}") + cluster_public_key = run_and_return_output(r"kubectl get cm kube-root-ca.crt -o jsonpath={.data.ca\.crt}") with Path(tmpdir, "ca.crt").open("w") as f: f.write(cluster_public_key) cluster_url = run_and_return_output("kubectl config view --minify --output jsonpath={.clusters[*].cluster.server}") |