Skip to content

Commit 2f4b523

Browse files
committed
Remove usage of linux specific dirs
1 parent ab1c94e commit 2f4b523

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

src/confcom/azext_confcom/custom.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import os
77
import sys
8+
import tempfile
89
from typing import Optional, BinaryIO
910

1011
from azext_confcom import oras_proxy, os_util, security_policy
@@ -372,7 +373,7 @@ def acifragmentgen_confcom(
372373
filename = f"{output_filename or namespace}.rego"
373374

374375
if out_signed_fragment:
375-
filename = os.path.join("/tmp", filename)
376+
filename = os.path.join(tempfile.gettempdir(), filename)
376377

377378
os_util.write_str_to_file(filename, fragment_text)
378379

@@ -382,7 +383,7 @@ def acifragmentgen_confcom(
382383
out_path = filename + ".cose"
383384

384385
if out_signed_fragment:
385-
out_path = os.path.join("/tmp", os.path.basename(out_path))
386+
out_path = os.path.join(tempfile.gettempdir(), os.path.basename(out_path))
386387

387388
cose_proxy.cose_sign(filename, key, chain, feed, iss, algo, out_path)
388389

src/confcom/azext_confcom/tests/latest/test_confcom_acifragmentgen.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def test_acifragmentgen_fragment_upload_fragment(docker_image, cert_chain):
153153
raise AssertionError(f"{oras_result=}")
154154

155155
fragment_path = json.loads(subprocess.run(
156-
["oras", "pull", fragment_ref, "--format", "json", "-o", "/tmp"],
156+
["oras", "pull", fragment_ref, "--format", "json", "-o", tempfile.gettempdir()],
157157
check=True,
158158
stdout=subprocess.PIPE,
159159
).stdout)["files"][0]["path"]
@@ -193,7 +193,7 @@ def test_acifragmentgen_fragment_push(docker_image, cert_chain, capsysbinary):
193193

194194
# Confirm the fragment exists in the registry
195195
fragment_path = json.loads(subprocess.run(
196-
["oras", "pull", fragment_ref, "--format", "json", "-o", "/tmp"],
196+
["oras", "pull", fragment_ref, "--format", "json", "-o", tempfile.gettempdir()],
197197
check=True,
198198
stdout=subprocess.PIPE,
199199
).stdout)["files"][0]["path"]
@@ -243,7 +243,7 @@ def test_acifragmentgen_fragment_attach(docker_image, cert_chain, capsysbinary):
243243
raise AssertionError(f"{oras_result=}")
244244

245245
fragment_path = json.loads(subprocess.run(
246-
["oras", "pull", fragment_ref, "--format", "json", "-o", "/tmp"],
246+
["oras", "pull", fragment_ref, "--format", "json", "-o", tempfile.gettempdir()],
247247
check=True,
248248
stdout=subprocess.PIPE,
249249
).stdout)["files"][0]["path"]

src/confcom/azext_confcom/tests/latest/test_confcom_arm.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import fcntl
77
import os
8+
import tempfile
89
import unittest
910
import json
1011
import deepdiff
@@ -27,7 +28,7 @@
2728
)
2829

2930
TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), ".."))
30-
PRUNE_LOCK_PATH = "/tmp/confcom_docker_prune.lock"
31+
PRUNE_LOCK_PATH = f"{tempfile.gettempdir()}/confcom_docker_prune.lock"
3132

3233

3334
class PolicyGeneratingArm(unittest.TestCase):

0 commit comments

Comments
 (0)