Classgen: add error reporting and combine common classes
This commit is contained in:
@@ -15,10 +15,10 @@ from .classes import (
|
||||
Meta,
|
||||
Service,
|
||||
ServiceBorgbackup,
|
||||
ServiceBorgbackupMeta,
|
||||
ServiceBorgbackupRole,
|
||||
ServiceBorgbackupRoleClient,
|
||||
ServiceBorgbackupRoleServer,
|
||||
ServiceMeta,
|
||||
)
|
||||
|
||||
# Re export classes here
|
||||
@@ -30,7 +30,7 @@ __all__ = [
|
||||
"Inventory",
|
||||
"MachineDeploy",
|
||||
"ServiceBorgbackup",
|
||||
"ServiceBorgbackupMeta",
|
||||
"ServiceMeta",
|
||||
"ServiceBorgbackupRole",
|
||||
"ServiceBorgbackupRoleClient",
|
||||
"ServiceBorgbackupRoleServer",
|
||||
|
||||
@@ -48,7 +48,7 @@ class ServiceBorgbackupMachine:
|
||||
|
||||
|
||||
@dataclass
|
||||
class ServiceBorgbackupMeta:
|
||||
class ServiceMeta:
|
||||
name: str
|
||||
description: str | None = field(default=None )
|
||||
icon: str | None = field(default=None )
|
||||
@@ -78,7 +78,7 @@ class ServiceBorgbackupRole:
|
||||
|
||||
@dataclass
|
||||
class ServiceBorgbackup:
|
||||
meta: ServiceBorgbackupMeta
|
||||
meta: ServiceMeta
|
||||
roles: ServiceBorgbackupRole
|
||||
config: BorgbackupConfig = field(default_factory=BorgbackupConfig )
|
||||
machines: dict[str, ServiceBorgbackupMachine] = field(default_factory=dict )
|
||||
@@ -95,13 +95,6 @@ class ServicePackageMachine:
|
||||
imports: list[str] = field(default_factory=list )
|
||||
|
||||
|
||||
@dataclass
|
||||
class ServicePackageMeta:
|
||||
name: str
|
||||
description: str | None = field(default=None )
|
||||
icon: str | None = field(default=None )
|
||||
|
||||
|
||||
@dataclass
|
||||
class ServicePackageRoleDefault:
|
||||
config: PackagesConfig = field(default_factory=PackagesConfig )
|
||||
@@ -117,7 +110,7 @@ class ServicePackageRole:
|
||||
|
||||
@dataclass
|
||||
class ServicePackage:
|
||||
meta: ServicePackageMeta
|
||||
meta: ServiceMeta
|
||||
roles: ServicePackageRole
|
||||
config: PackagesConfig = field(default_factory=PackagesConfig )
|
||||
machines: dict[str, ServicePackageMachine] = field(default_factory=dict )
|
||||
@@ -134,13 +127,6 @@ class ServiceSingleDiskMachine:
|
||||
imports: list[str] = field(default_factory=list )
|
||||
|
||||
|
||||
@dataclass
|
||||
class ServiceSingleDiskMeta:
|
||||
name: str
|
||||
description: str | None = field(default=None )
|
||||
icon: str | None = field(default=None )
|
||||
|
||||
|
||||
@dataclass
|
||||
class ServiceSingleDiskRoleDefault:
|
||||
config: SingleDiskConfig = field(default_factory=SingleDiskConfig )
|
||||
@@ -156,7 +142,7 @@ class ServiceSingleDiskRole:
|
||||
|
||||
@dataclass
|
||||
class ServiceSingleDisk:
|
||||
meta: ServiceSingleDiskMeta
|
||||
meta: ServiceMeta
|
||||
roles: ServiceSingleDiskRole
|
||||
config: SingleDiskConfig = field(default_factory=SingleDiskConfig )
|
||||
machines: dict[str, ServiceSingleDiskMachine] = field(default_factory=dict )
|
||||
|
||||
@@ -10,10 +10,10 @@ from clan_cli.inventory import (
|
||||
Machine,
|
||||
MachineDeploy,
|
||||
ServiceBorgbackup,
|
||||
ServiceBorgbackupMeta,
|
||||
ServiceBorgbackupRole,
|
||||
ServiceBorgbackupRoleClient,
|
||||
ServiceBorgbackupRoleServer,
|
||||
ServiceMeta,
|
||||
load_inventory,
|
||||
save_inventory,
|
||||
)
|
||||
@@ -71,7 +71,7 @@ def test_add_module_to_inventory(
|
||||
|
||||
inventory.services.borgbackup = {
|
||||
"borg1": ServiceBorgbackup(
|
||||
meta=ServiceBorgbackupMeta(name="borg1"),
|
||||
meta=ServiceMeta(name="borg1"),
|
||||
roles=ServiceBorgbackupRole(
|
||||
client=ServiceBorgbackupRoleClient(
|
||||
machines=["machine1"],
|
||||
|
||||
Reference in New Issue
Block a user