cli: move some references to duplicate list machines
This commit is contained in:
@@ -10,6 +10,7 @@ from tempfile import TemporaryDirectory
|
|||||||
from clan_lib.cmd import RunOpts, run
|
from clan_lib.cmd import RunOpts, run
|
||||||
from clan_lib.errors import ClanError
|
from clan_lib.errors import ClanError
|
||||||
from clan_lib.git import commit_files
|
from clan_lib.git import commit_files
|
||||||
|
from clan_lib.machines.list import list_full_machines
|
||||||
from clan_lib.machines.machines import Machine
|
from clan_lib.machines.machines import Machine
|
||||||
from clan_lib.nix import nix_shell
|
from clan_lib.nix import nix_shell
|
||||||
|
|
||||||
@@ -18,7 +19,6 @@ from clan_cli.completions import (
|
|||||||
complete_machines,
|
complete_machines,
|
||||||
complete_services_for_machine,
|
complete_services_for_machine,
|
||||||
)
|
)
|
||||||
from clan_cli.machines.list import list_full_machines
|
|
||||||
|
|
||||||
from .check import check_secrets
|
from .check import check_secrets
|
||||||
from .public_modules import FactStoreBase
|
from .public_modules import FactStoreBase
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ import argparse
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from clan_lib.flake import Flake
|
from clan_lib.flake import Flake
|
||||||
from clan_lib.machines.list import list_full_machines, query_machines_by_tags
|
from clan_lib.machines.actions import list_machines
|
||||||
|
from clan_lib.machines.list import query_machines_by_tags
|
||||||
|
|
||||||
from clan_cli.completions import add_dynamic_completer, complete_tags
|
from clan_cli.completions import add_dynamic_completer, complete_tags
|
||||||
|
|
||||||
@@ -16,7 +17,7 @@ def list_command(args: argparse.Namespace) -> None:
|
|||||||
for name in query_machines_by_tags(flake, args.tags):
|
for name in query_machines_by_tags(flake, args.tags):
|
||||||
print(name)
|
print(name)
|
||||||
else:
|
else:
|
||||||
for name in list_full_machines(flake):
|
for name in list_machines(flake):
|
||||||
print(name)
|
print(name)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import sys
|
|||||||
|
|
||||||
from clan_lib.async_run import AsyncContext, AsyncOpts, AsyncRuntime
|
from clan_lib.async_run import AsyncContext, AsyncOpts, AsyncRuntime
|
||||||
from clan_lib.errors import ClanError
|
from clan_lib.errors import ClanError
|
||||||
|
from clan_lib.machines.list import list_full_machines
|
||||||
from clan_lib.machines.machines import Machine
|
from clan_lib.machines.machines import Machine
|
||||||
from clan_lib.machines.suggestions import validate_machine_names
|
from clan_lib.machines.suggestions import validate_machine_names
|
||||||
from clan_lib.machines.update import deploy_machine
|
from clan_lib.machines.update import deploy_machine
|
||||||
@@ -15,7 +16,7 @@ from clan_cli.completions import (
|
|||||||
complete_machines,
|
complete_machines,
|
||||||
complete_tags,
|
complete_tags,
|
||||||
)
|
)
|
||||||
from clan_cli.machines.list import list_full_machines, query_machines_by_tags
|
from clan_cli.machines.list import query_machines_by_tags
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ from clan_cli.completions import (
|
|||||||
complete_machines,
|
complete_machines,
|
||||||
complete_services_for_machine,
|
complete_services_for_machine,
|
||||||
)
|
)
|
||||||
from clan_cli.machines.list import list_full_machines
|
|
||||||
from clan_cli.vars._types import StoreBase
|
from clan_cli.vars._types import StoreBase
|
||||||
from clan_cli.vars.migration import check_can_migrate, migrate_files
|
from clan_cli.vars.migration import check_can_migrate, migrate_files
|
||||||
from clan_lib.api import API
|
from clan_lib.api import API
|
||||||
@@ -22,6 +21,7 @@ from clan_lib.cmd import RunOpts, run
|
|||||||
from clan_lib.errors import ClanError
|
from clan_lib.errors import ClanError
|
||||||
from clan_lib.flake import Flake
|
from clan_lib.flake import Flake
|
||||||
from clan_lib.git import commit_files
|
from clan_lib.git import commit_files
|
||||||
|
from clan_lib.machines.list import list_full_machines
|
||||||
from clan_lib.nix import nix_config, nix_shell, nix_test_store
|
from clan_lib.nix import nix_config, nix_shell, nix_test_store
|
||||||
|
|
||||||
from .check import check_vars
|
from .check import check_vars
|
||||||
|
|||||||
0
pkgs/clan-cli/clan_lib/machines/actions_test.py
Normal file
0
pkgs/clan-cli/clan_lib/machines/actions_test.py
Normal file
@@ -31,6 +31,7 @@ def list_full_machines(flake: Flake) -> dict[str, Machine]:
|
|||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: Add filter to list_machines -> list_machines(flake, filter={tags=...})
|
||||||
def query_machines_by_tags(flake: Flake, tags: list[str]) -> dict[str, Machine]:
|
def query_machines_by_tags(flake: Flake, tags: list[str]) -> dict[str, Machine]:
|
||||||
"""
|
"""
|
||||||
Query machines by their respective tags, if multiple tags are specified
|
Query machines by their respective tags, if multiple tags are specified
|
||||||
|
|||||||
Reference in New Issue
Block a user