Skip to content

Commit

Permalink
echo: fix regression issue when use single quotes in file
Browse files Browse the repository at this point in the history
  • Loading branch information
LiliDeng committed Aug 13, 2024
1 parent 660c472 commit 538216e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lisa/tools/echo.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def write_to_file(
if append:
operator = ">>"
result = self.run(
f"'{value}' {operator} '{file}'",
f'"{value}" {operator} "{file}"',
force_run=True,
shell=True,
sudo=sudo,
Expand Down
4 changes: 2 additions & 2 deletions lisa/tools/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ def generate_key_pairs(self) -> str:
)
cat = self.node.tools[Cat]
public_key = cat.read(
str(self.node.get_pure_path("~/.ssh/id_rsa.pub")),
str(self.node.get_pure_path("$HOME/.ssh/id_rsa.pub")),
force_run=True,
)
return public_key

def enable_public_key(self, public_key: str) -> None:
self.node.tools[Echo].write_to_file(
public_key,
self.node.get_pure_path("~/.ssh/authorized_keys"),
self.node.get_pure_path("$HOME/.ssh/authorized_keys"),
append=True,
)

Expand Down
2 changes: 1 addition & 1 deletion microsoft/testsuites/network/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def sriov_vf_connection_test(

# copy 200 Mb file from source ip to dest ip
source_node.execute(
f"scp -o BindAddress={source_ip} -i ~/.ssh/id_rsa -o"
f"scp -o BindAddress={source_ip} -i $HOME/.ssh/id_rsa -o"
f" StrictHostKeyChecking=no large_file "
f"$USER@{dest_ip}:/tmp/large_file",
shell=True,
Expand Down

0 comments on commit 538216e

Please sign in to comment.