Skip to content

Commit

Permalink
blueos_startup_update: use new upload_file()
Browse files Browse the repository at this point in the history
  • Loading branch information
Williangalvani committed Jun 4, 2024
1 parent a69a440 commit 69d9d6b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions core/tools/blueos_startup_update/blueos_startup_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from typing import List, Optional, Tuple

import appdirs
from commonwealth.utils.commands import run_command
from commonwealth.utils.commands import run_command, upload_file
from commonwealth.utils.logs import InterceptHandler, init_logger
from loguru import logger

Expand Down Expand Up @@ -191,12 +191,12 @@ def load_file(file_name) -> str:
return run_command(command, False).stdout


def save_file(file_name: str, file_content: str, backup_identifier: str) -> None:
def save_file(file_name: str, file_content: str, backup_identifier: str, ensure_newline: bool = True) -> None:
if ensure_newline and not file_content.endswith("\n"):
file_content += "\n"
command = f'sudo cp "{file_name}" "{file_name}.{backup_identifier}.bak"'
run_command(command, False)

command = f'echo "{file_content}" | sudo tee "{file_name}"'
run_command(command, False)
upload_file(file_content, file_name, False)


def hardlink_exists(file_name: str) -> bool:
Expand Down

0 comments on commit 69d9d6b

Please sign in to comment.