Skip to content

Commit 2a0cfc7

Browse files
committed
fix(update): fix update requirements.txt bug windows linux mac
1 parent f8252a7 commit 2a0cfc7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

veadk/integrations/ve_faas/ve_faas.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import json
1616
import time
1717
import shutil
18+
import tempfile
1819
from pathlib import Path
1920
from cookiecutter.main import cookiecutter
2021
import veadk.integrations.ve_faas as vefaas
@@ -309,12 +310,10 @@ def _update_function_code(
309310

310311
# Get application status and extract function info
311312
status, full_response = self._get_application_status(app_id)
312-
313313
# Extract function name from application config
314314
cloud_resource = full_response["Result"]["CloudResource"]
315315
cloud_resource = json.loads(cloud_resource)
316316
function_name = cloud_resource["framework"]["function"]["Name"]
317-
# existing_url = cloud_resource["framework"]["url"]["system_url"]
318317
function_id = cloud_resource["framework"]["function"]["Id"]
319318
if not function_id:
320319
raise ValueError(f"Function '{function_name}' not found for update")
@@ -333,14 +332,17 @@ def _update_function_code(
333332
"veadk_version": VERSION,
334333
}
335334

335+
temp_base = Path(tempfile.gettempdir())
336+
336337
cookiecutter(
337338
template=str(template_dir),
338-
output_dir="/tmp",
339+
output_dir=str(temp_base),
339340
no_input=True,
340341
extra_context=settings,
341342
)
342343

343-
tmp_path = Path("/tmp") / tmp_dir_name
344+
tmp_path = temp_base / tmp_dir_name
345+
344346
try:
345347
agent_dir = tmp_path / "src" / user_proj_path.name.replace("-", "_")
346348
if agent_dir.exists():

0 commit comments

Comments
 (0)