Skip to content

Commit

Permalink
Merge pull request #4007 from cliping/fix-process
Browse files Browse the repository at this point in the history
Fix no directory issue
  • Loading branch information
chloerh authored Sep 29, 2024
2 parents 5ca5488 + fa7ce9c commit 5442a10
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions virttest/nfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,14 +459,13 @@ def setup_remote(self):
"""
check_mount_dir_cmd = self.ssh_cmd + "'ls -d %s'" % self.mount_dir
LOG.debug("To check if the %s exists", self.mount_dir)
output = process.getoutput(check_mount_dir_cmd)
if re.findall("No such file or directory", output, re.M):
mkdir_cmd = self.ssh_cmd + "'mkdir -p %s'" % self.mount_dir
LOG.debug("Prepare to create %s", self.mount_dir)
s, o = process.getstatusoutput(mkdir_cmd)
if s != 0:
raise exceptions.TestFail("Failed to run %s: %s" % (mkdir_cmd, o))
self.mkdir_mount_remote = True
ret = process.run(check_mount_dir_cmd, shell=True, ignore_status=True)
if ret.exit_status:
if re.findall("No such file or directory", ret.stderr_text, re.M):
mkdir_cmd = self.ssh_cmd + "'mkdir -p %s'" % self.mount_dir
LOG.debug("Prepare to create %s", self.mount_dir)
process.run(mkdir_cmd, shell=True)
self.mkdir_mount_remote = True

if self.params.get("firewall_to_permit_nfs", "yes") == "yes":
if distro.detect().name != "Ubuntu":
Expand Down

0 comments on commit 5442a10

Please sign in to comment.