clan: remove config subcommand

This removes the `config` subcommand from the cli and the documentation
to keep the api surface small.

While this functionality was convenient it doesn't need to be surfaced
by the clan cli.

The remaining `config` python module should be ported to the `clan-app`
in a follow up pr. Because the functionality is currently only used by
the `clan-app`.
Ideally together with: #1830.
This commit is contained in:
a-kenji
2024-07-31 12:09:27 +02:00
committed by Mic92
parent 26edcb8562
commit a465ad8638
7 changed files with 2 additions and 152 deletions

View File

@@ -1,8 +1,6 @@
from pathlib import Path
import pytest
from fixtures_flakes import FlakeForTest
from helpers import cli
from clan_cli import config
from clan_cli.config import parsing
@@ -11,28 +9,6 @@ from clan_cli.errors import ClanError
example_options = f"{Path(config.__file__).parent}/jsonschema/options.json"
def test_configure_machine(
test_flake: FlakeForTest,
capsys: pytest.CaptureFixture,
) -> None:
# clear the output buffer
capsys.readouterr()
# read a option value
cli.run(
[
"config",
"--flake",
str(test_flake.path),
"-m",
"machine1",
"clan.jitsi.enable",
]
)
# read the output
assert capsys.readouterr().out == "false\n"
def test_walk_jsonschema_all_types() -> None:
schema = dict(
type="object",

View File

@@ -1,48 +0,0 @@
import pytest
from fixtures_flakes import FlakeForTest
from clan_cli.clan_uri import FlakeId
from clan_cli.config.machine import (
config_for_machine,
set_config_for_machine,
verify_machine_config,
)
from clan_cli.config.schema import machine_schema
from clan_cli.inventory import Machine, MachineDeploy
from clan_cli.machines.create import create_machine
from clan_cli.machines.list import list_machines
@pytest.mark.with_core
def test_schema_for_machine(test_flake_with_core: FlakeForTest) -> None:
schema = machine_schema(test_flake_with_core.path, config={})
assert "properties" in schema
@pytest.mark.with_core
def test_create_machine_on_minimal_clan(test_flake_minimal: FlakeForTest) -> None:
assert list_machines(test_flake_minimal.path) == {}
create_machine(
FlakeId(test_flake_minimal.path),
Machine(
name="foo",
system="x86_64-linux",
description="A test machine",
tags=["test"],
icon=None,
deploy=MachineDeploy(),
),
)
result = list_machines(test_flake_minimal.path)
assert list(result.keys()) == ["foo"]
# Writes into settings.json
set_config_for_machine(
test_flake_minimal.path, "foo", dict(services=dict(openssh=dict(enable=True)))
)
config = config_for_machine(test_flake_minimal.path, "foo")
assert config["services"]["openssh"]["enable"]
assert verify_machine_config(test_flake_minimal.path, "foo") is None