clan-cli/ssh: rename Group -> HostGroup
This commit is contained in:
@@ -534,7 +534,7 @@ def _worker(
|
|||||||
results[idx] = HostResult(host, e)
|
results[idx] = HostResult(host, e)
|
||||||
|
|
||||||
|
|
||||||
class Group:
|
class HostGroup:
|
||||||
def __init__(self, hosts: List[Host]) -> None:
|
def __init__(self, hosts: List[Host]) -> None:
|
||||||
self.hosts = hosts
|
self.hosts = hosts
|
||||||
|
|
||||||
@@ -745,9 +745,9 @@ class Group:
|
|||||||
self._reraise_errors(results)
|
self._reraise_errors(results)
|
||||||
return results
|
return results
|
||||||
|
|
||||||
def filter(self, pred: Callable[[Host], bool]) -> "Group":
|
def filter(self, pred: Callable[[Host], bool]) -> "HostGroup":
|
||||||
"""Return a new Group with the results filtered by the predicate"""
|
"""Return a new Group with the results filtered by the predicate"""
|
||||||
return Group(list(filter(pred, self.hosts)))
|
return HostGroup(list(filter(pred, self.hosts)))
|
||||||
|
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from clan_cli.ssh import Group, Host, run
|
from clan_cli.ssh import Host, HostGroup, run
|
||||||
|
|
||||||
|
|
||||||
def test_run() -> None:
|
def test_run() -> None:
|
||||||
@@ -20,7 +20,7 @@ def test_run_failure() -> None:
|
|||||||
assert False, "Command should have raised an error"
|
assert False, "Command should have raised an error"
|
||||||
|
|
||||||
|
|
||||||
hosts = Group([Host("some_host")])
|
hosts = HostGroup([Host("some_host")])
|
||||||
|
|
||||||
|
|
||||||
def test_run_environment() -> None:
|
def test_run_environment() -> None:
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ import subprocess
|
|||||||
|
|
||||||
from sshd import Sshd
|
from sshd import Sshd
|
||||||
|
|
||||||
from clan_cli.ssh import Group, Host, HostKeyCheck
|
from clan_cli.ssh import Host, HostGroup, HostKeyCheck
|
||||||
|
|
||||||
|
|
||||||
def deploy_group(sshd: Sshd) -> Group:
|
def deploy_group(sshd: Sshd) -> HostGroup:
|
||||||
login = pwd.getpwuid(os.getuid()).pw_name
|
login = pwd.getpwuid(os.getuid()).pw_name
|
||||||
return Group(
|
return HostGroup(
|
||||||
[
|
[
|
||||||
Host(
|
Host(
|
||||||
"127.0.0.1",
|
"127.0.0.1",
|
||||||
|
|||||||
Reference in New Issue
Block a user