Fix properties
This commit is contained in:
@@ -35,9 +35,6 @@ class DatabaseService(Service, identifier="DatabaseService"):
|
||||
|
||||
config: "DatabaseService.ConfigSchema" = Field(default_factory=lambda: DatabaseService.ConfigSchema())
|
||||
|
||||
password: Optional[str] = None
|
||||
"""Password that needs to be provided by clients if they want to connect to the DatabaseService."""
|
||||
|
||||
backup_server_ip: IPv4Address = None
|
||||
"""IP address of the backup server."""
|
||||
|
||||
@@ -60,6 +57,10 @@ class DatabaseService(Service, identifier="DatabaseService"):
|
||||
"""Convenience property for accessing the password."""
|
||||
return self.config.db_password
|
||||
|
||||
@password.setter
|
||||
def password(self, val: str) -> None:
|
||||
self.config.db_password = val
|
||||
|
||||
def install(self):
|
||||
"""
|
||||
Perform first-time setup of the DatabaseService.
|
||||
|
||||
@@ -30,8 +30,6 @@ class DNSClient(Service, identifier="DNSClient"):
|
||||
config: "DNSClient.ConfigSchema" = Field(default_factory=lambda: DNSClient.ConfigSchema())
|
||||
dns_cache: Dict[str, IPv4Address] = {}
|
||||
"A dict of known mappings between domain/URLs names and IPv4 addresses."
|
||||
dns_server: Optional[IPv4Address] = None
|
||||
"The DNS Server the client sends requests to."
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
kwargs["name"] = "DNSClient"
|
||||
@@ -43,11 +41,6 @@ class DNSClient(Service, identifier="DNSClient"):
|
||||
super().__init__(**kwargs)
|
||||
self.start()
|
||||
|
||||
@property
|
||||
def dns_server(self) -> Optional[IPV4Address]:
|
||||
"""Convenience property for accessing the dns server configuration."""
|
||||
return self.config.dns_server
|
||||
|
||||
def describe_state(self) -> Dict:
|
||||
"""
|
||||
Describes the current state of the software.
|
||||
@@ -61,6 +54,15 @@ class DNSClient(Service, identifier="DNSClient"):
|
||||
state = super().describe_state()
|
||||
return state
|
||||
|
||||
@property
|
||||
def dns_server(self) -> Optional[IPV4Address]:
|
||||
"""Convenience property for accessing the dns server configuration."""
|
||||
return self.config.dns_server
|
||||
|
||||
@dns_server.setter
|
||||
def dns_server(self, val: IPV4Address) -> None:
|
||||
self.config.dns_server = val
|
||||
|
||||
def add_domain_to_cache(self, domain_name: str, ip_address: IPv4Address) -> bool:
|
||||
"""
|
||||
Adds a domain name to the DNS Client cache.
|
||||
|
||||
Reference in New Issue
Block a user