Skip to content

Commit 4163657

Browse files
authored
Merge pull request #50 from ceph/fixes
Fix a doctor crash and two regressions
2 parents d91736d + 6cdc423 commit 4163657

5 files changed

Lines changed: 22 additions & 10 deletions

File tree

‎ceph_devstack/host.py‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ async def arun(
5151
).arun()
5252

5353
def path_exists(self, path: Union[str, pathlib.Path]):
54-
if isinstance(path, pathlib.Path):
55-
return path.exists()
56-
return os.path.exists(path)
54+
if isinstance(path, str):
55+
path = pathlib.Path(path)
56+
return path.expanduser().exists()
5757

5858
def hostname(self) -> str:
5959
name = socket.getfqdn()
@@ -148,8 +148,6 @@ class RemoteHost(Host):
148148

149149
def _remote_args(self, args: List[str], stream_output: bool) -> List[str]:
150150
remote = list(self.base_args)
151-
if stream_output:
152-
remote.append("-t")
153151
remote.append("--")
154152
remote.extend(args)
155153
return remote

‎ceph_devstack/requirements.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ async def suggest(self):
3838

3939
async def fix(self) -> bool:
4040
assert self.fix_cmd, "Attempted to fix without a fix command"
41-
proc = await self.host.arun(self.fix_cmd, stream_output=True)
41+
stream_output = config["args"].get("verbose", False)
42+
proc = await self.host.arun(self.fix_cmd, stream_output=stream_output)
4243
return await proc.wait() == 0
4344

4445

@@ -94,7 +95,7 @@ async def check(self):
9495
class PodmanGraphDriver(Requirement):
9596
async def check(self):
9697
podman_info = await self.host.podman_info()
97-
storage_conf_path = podman_info["store"]["configFile"]
98+
storage_conf_path = podman_info["store"].get("configFile", "storage.conf")
9899
graph_driver = podman_info["store"]["graphDriverName"]
99100
if graph_driver == "overlay":
100101
return True

‎ceph_devstack/resources/ceph/containers.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class Archive(Container):
123123

124124
@property
125125
def archive_dir(self):
126-
return Path(config["data_dir"]) / "archive"
126+
return (Path(config["data_dir"]) / "archive").expanduser()
127127

128128

129129
class Pulpito(Container):
@@ -412,7 +412,7 @@ def create_cmd(self):
412412

413413
@property
414414
def archive_dir(self) -> Path:
415-
return Path(config["data_dir"]) / "archive"
415+
return (Path(config["data_dir"]) / "archive").expanduser()
416416

417417
async def create(self):
418418
self.archive_dir.expanduser().resolve().mkdir(parents=True, exist_ok=True)

‎tests/test_exec.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
def test_remote_host_uses_tty_for_streaming():
1212
host = RemoteHost()
1313
cmd = host.cmd(["python", "build.py"], stream_output=True)
14-
assert cmd.args == ["podman", "machine", "ssh", "-t", "--", "python", "build.py"]
14+
assert cmd.args == ["podman", "machine", "ssh", "--", "python", "build.py"]
1515

1616

1717
def test_remote_host_no_tty_for_buffered_remote_cmd():

‎tests/test_host.py‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import pytest
2+
3+
from ceph_devstack.host import LocalHost
4+
5+
6+
class TestLocalHost:
7+
@pytest.fixture
8+
def host(self):
9+
return LocalHost()
10+
11+
def test_path_exists_expands_tilde(self, host):
12+
assert host.path_exists("~") is True
13+
assert host.path_exists("~/nonexistent_dir_12345") is False

0 commit comments

Comments
 (0)