fix(packaging): move templates/ into decnet/ package so they ship with pip install
The docker build contexts and syslog_bridge.py lived at repo root, which meant setuptools (include = ["decnet*"]) never shipped them. Agents installed via `pip install $RELEASE_DIR` got site-packages/decnet/** but no templates/, so every deploy blew up in deployer._sync_logging_helper with FileNotFoundError on templates/syslog_bridge.py. Move templates/ -> decnet/templates/ and declare it as setuptools package-data. Path resolutions in services/*.py and engine/deployer.py drop one .parent since templates now lives beside the code. Test fixtures, bandit exclude path, and coverage omit glob updated to match.
This commit is contained in:
@@ -31,7 +31,7 @@ from decnet.network import (
|
|||||||
log = get_logger("engine")
|
log = get_logger("engine")
|
||||||
console = Console()
|
console = Console()
|
||||||
COMPOSE_FILE = Path("decnet-compose.yml")
|
COMPOSE_FILE = Path("decnet-compose.yml")
|
||||||
_CANONICAL_LOGGING = Path(__file__).parent.parent.parent / "templates" / "syslog_bridge.py"
|
_CANONICAL_LOGGING = Path(__file__).parent.parent / "templates" / "syslog_bridge.py"
|
||||||
|
|
||||||
|
|
||||||
def _sync_logging_helper(config: DecnetConfig) -> None:
|
def _sync_logging_helper(config: DecnetConfig) -> None:
|
||||||
|
|||||||
@@ -32,4 +32,4 @@ class ConpotService(BaseService):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def dockerfile_context(self):
|
def dockerfile_context(self):
|
||||||
return Path(__file__).parent.parent.parent / "templates" / "conpot"
|
return Path(__file__).parent.parent / "templates" / "conpot"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from decnet.services.base import BaseService
|
from decnet.services.base import BaseService
|
||||||
|
|
||||||
TEMPLATES_DIR = Path(__file__).parent.parent.parent / "templates" / "docker_api"
|
TEMPLATES_DIR = Path(__file__).parent.parent / "templates" / "docker_api"
|
||||||
|
|
||||||
|
|
||||||
class DockerAPIService(BaseService):
|
class DockerAPIService(BaseService):
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ from pathlib import Path
|
|||||||
|
|
||||||
from decnet.services.base import BaseService
|
from decnet.services.base import BaseService
|
||||||
|
|
||||||
TEMPLATES_DIR = Path(__file__).parent.parent.parent / "templates" / "elasticsearch"
|
TEMPLATES_DIR = Path(__file__).parent.parent / "templates" / "elasticsearch"
|
||||||
|
|
||||||
|
|
||||||
class ElasticsearchService(BaseService):
|
class ElasticsearchService(BaseService):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from decnet.services.base import BaseService
|
from decnet.services.base import BaseService
|
||||||
|
|
||||||
TEMPLATES_DIR = Path(__file__).parent.parent.parent / "templates" / "ftp"
|
TEMPLATES_DIR = Path(__file__).parent.parent / "templates" / "ftp"
|
||||||
|
|
||||||
|
|
||||||
class FTPService(BaseService):
|
class FTPService(BaseService):
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import json
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from decnet.services.base import BaseService
|
from decnet.services.base import BaseService
|
||||||
|
|
||||||
TEMPLATES_DIR = Path(__file__).parent.parent.parent / "templates" / "http"
|
TEMPLATES_DIR = Path(__file__).parent.parent / "templates" / "http"
|
||||||
|
|
||||||
|
|
||||||
class HTTPService(BaseService):
|
class HTTPService(BaseService):
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import json
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from decnet.services.base import BaseService
|
from decnet.services.base import BaseService
|
||||||
|
|
||||||
TEMPLATES_DIR = Path(__file__).parent.parent.parent / "templates" / "https"
|
TEMPLATES_DIR = Path(__file__).parent.parent / "templates" / "https"
|
||||||
|
|
||||||
|
|
||||||
class HTTPSService(BaseService):
|
class HTTPSService(BaseService):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from decnet.services.base import BaseService
|
from decnet.services.base import BaseService
|
||||||
|
|
||||||
TEMPLATES_DIR = Path(__file__).parent.parent.parent / "templates" / "imap"
|
TEMPLATES_DIR = Path(__file__).parent.parent / "templates" / "imap"
|
||||||
|
|
||||||
|
|
||||||
class IMAPService(BaseService):
|
class IMAPService(BaseService):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from decnet.services.base import BaseService
|
from decnet.services.base import BaseService
|
||||||
|
|
||||||
TEMPLATES_DIR = Path(__file__).parent.parent.parent / "templates" / "k8s"
|
TEMPLATES_DIR = Path(__file__).parent.parent / "templates" / "k8s"
|
||||||
|
|
||||||
|
|
||||||
class KubernetesAPIService(BaseService):
|
class KubernetesAPIService(BaseService):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from decnet.services.base import BaseService
|
from decnet.services.base import BaseService
|
||||||
|
|
||||||
TEMPLATES_DIR = Path(__file__).parent.parent.parent / "templates" / "ldap"
|
TEMPLATES_DIR = Path(__file__).parent.parent / "templates" / "ldap"
|
||||||
|
|
||||||
|
|
||||||
class LDAPService(BaseService):
|
class LDAPService(BaseService):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from decnet.services.base import BaseService
|
from decnet.services.base import BaseService
|
||||||
|
|
||||||
TEMPLATES_DIR = Path(__file__).parent.parent.parent / "templates" / "llmnr"
|
TEMPLATES_DIR = Path(__file__).parent.parent / "templates" / "llmnr"
|
||||||
|
|
||||||
|
|
||||||
class LLMNRService(BaseService):
|
class LLMNRService(BaseService):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from decnet.services.base import BaseService
|
from decnet.services.base import BaseService
|
||||||
|
|
||||||
TEMPLATES_DIR = Path(__file__).parent.parent.parent / "templates" / "mongodb"
|
TEMPLATES_DIR = Path(__file__).parent.parent / "templates" / "mongodb"
|
||||||
|
|
||||||
|
|
||||||
class MongoDBService(BaseService):
|
class MongoDBService(BaseService):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from decnet.services.base import BaseService
|
from decnet.services.base import BaseService
|
||||||
|
|
||||||
TEMPLATES_DIR = Path(__file__).parent.parent.parent / "templates" / "mqtt"
|
TEMPLATES_DIR = Path(__file__).parent.parent / "templates" / "mqtt"
|
||||||
|
|
||||||
|
|
||||||
class MQTTService(BaseService):
|
class MQTTService(BaseService):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from decnet.services.base import BaseService
|
from decnet.services.base import BaseService
|
||||||
|
|
||||||
TEMPLATES_DIR = Path(__file__).parent.parent.parent / "templates" / "mssql"
|
TEMPLATES_DIR = Path(__file__).parent.parent / "templates" / "mssql"
|
||||||
|
|
||||||
|
|
||||||
class MSSQLService(BaseService):
|
class MSSQLService(BaseService):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from decnet.services.base import BaseService
|
from decnet.services.base import BaseService
|
||||||
|
|
||||||
TEMPLATES_DIR = Path(__file__).parent.parent.parent / "templates" / "mysql"
|
TEMPLATES_DIR = Path(__file__).parent.parent / "templates" / "mysql"
|
||||||
|
|
||||||
|
|
||||||
class MySQLService(BaseService):
|
class MySQLService(BaseService):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from decnet.services.base import BaseService
|
from decnet.services.base import BaseService
|
||||||
|
|
||||||
TEMPLATES_DIR = Path(__file__).parent.parent.parent / "templates" / "pop3"
|
TEMPLATES_DIR = Path(__file__).parent.parent / "templates" / "pop3"
|
||||||
|
|
||||||
|
|
||||||
class POP3Service(BaseService):
|
class POP3Service(BaseService):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from decnet.services.base import BaseService
|
from decnet.services.base import BaseService
|
||||||
|
|
||||||
TEMPLATES_DIR = Path(__file__).parent.parent.parent / "templates" / "postgres"
|
TEMPLATES_DIR = Path(__file__).parent.parent / "templates" / "postgres"
|
||||||
|
|
||||||
|
|
||||||
class PostgresService(BaseService):
|
class PostgresService(BaseService):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from decnet.services.base import BaseService
|
from decnet.services.base import BaseService
|
||||||
|
|
||||||
TEMPLATES_DIR = Path(__file__).parent.parent.parent / "templates" / "rdp"
|
TEMPLATES_DIR = Path(__file__).parent.parent / "templates" / "rdp"
|
||||||
|
|
||||||
|
|
||||||
class RDPService(BaseService):
|
class RDPService(BaseService):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from decnet.services.base import BaseService
|
from decnet.services.base import BaseService
|
||||||
|
|
||||||
TEMPLATES_DIR = Path(__file__).parent.parent.parent / "templates" / "redis"
|
TEMPLATES_DIR = Path(__file__).parent.parent / "templates" / "redis"
|
||||||
|
|
||||||
|
|
||||||
class RedisService(BaseService):
|
class RedisService(BaseService):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from decnet.services.base import BaseService
|
from decnet.services.base import BaseService
|
||||||
|
|
||||||
TEMPLATES_DIR = Path(__file__).parent.parent.parent / "templates" / "sip"
|
TEMPLATES_DIR = Path(__file__).parent.parent / "templates" / "sip"
|
||||||
|
|
||||||
|
|
||||||
class SIPService(BaseService):
|
class SIPService(BaseService):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from decnet.services.base import BaseService
|
from decnet.services.base import BaseService
|
||||||
|
|
||||||
TEMPLATES_DIR = Path(__file__).parent.parent.parent / "templates" / "smb"
|
TEMPLATES_DIR = Path(__file__).parent.parent / "templates" / "smb"
|
||||||
|
|
||||||
|
|
||||||
class SMBService(BaseService):
|
class SMBService(BaseService):
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ from pathlib import Path
|
|||||||
|
|
||||||
from decnet.services.base import BaseService
|
from decnet.services.base import BaseService
|
||||||
|
|
||||||
TEMPLATES_DIR = Path(__file__).parent.parent.parent / "templates" / "smtp"
|
TEMPLATES_DIR = Path(__file__).parent.parent / "templates" / "smtp"
|
||||||
|
|
||||||
|
|
||||||
class SMTPService(BaseService):
|
class SMTPService(BaseService):
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ from decnet.services.base import BaseService
|
|||||||
|
|
||||||
# Reuses the same template as the smtp service — only difference is
|
# Reuses the same template as the smtp service — only difference is
|
||||||
# SMTP_OPEN_RELAY=1 in the environment, which enables the open relay persona.
|
# SMTP_OPEN_RELAY=1 in the environment, which enables the open relay persona.
|
||||||
_TEMPLATES_DIR = Path(__file__).parent.parent.parent / "templates" / "smtp"
|
_TEMPLATES_DIR = Path(__file__).parent.parent / "templates" / "smtp"
|
||||||
|
|
||||||
|
|
||||||
class SMTPRelayService(BaseService):
|
class SMTPRelayService(BaseService):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from decnet.services.base import BaseService
|
from decnet.services.base import BaseService
|
||||||
|
|
||||||
TEMPLATES_DIR = Path(__file__).parent.parent.parent / "templates" / "sniffer"
|
TEMPLATES_DIR = Path(__file__).parent.parent / "templates" / "sniffer"
|
||||||
|
|
||||||
|
|
||||||
class SnifferService(BaseService):
|
class SnifferService(BaseService):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from decnet.services.base import BaseService
|
from decnet.services.base import BaseService
|
||||||
|
|
||||||
TEMPLATES_DIR = Path(__file__).parent.parent.parent / "templates" / "snmp"
|
TEMPLATES_DIR = Path(__file__).parent.parent / "templates" / "snmp"
|
||||||
|
|
||||||
|
|
||||||
class SNMPService(BaseService):
|
class SNMPService(BaseService):
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ from pathlib import Path
|
|||||||
|
|
||||||
from decnet.services.base import BaseService
|
from decnet.services.base import BaseService
|
||||||
|
|
||||||
TEMPLATES_DIR = Path(__file__).parent.parent.parent / "templates" / "ssh"
|
TEMPLATES_DIR = Path(__file__).parent.parent / "templates" / "ssh"
|
||||||
|
|
||||||
|
|
||||||
class SSHService(BaseService):
|
class SSHService(BaseService):
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ from pathlib import Path
|
|||||||
|
|
||||||
from decnet.services.base import BaseService
|
from decnet.services.base import BaseService
|
||||||
|
|
||||||
TEMPLATES_DIR = Path(__file__).parent.parent.parent / "templates" / "telnet"
|
TEMPLATES_DIR = Path(__file__).parent.parent / "templates" / "telnet"
|
||||||
|
|
||||||
|
|
||||||
class TelnetService(BaseService):
|
class TelnetService(BaseService):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from decnet.services.base import BaseService
|
from decnet.services.base import BaseService
|
||||||
|
|
||||||
TEMPLATES_DIR = Path(__file__).parent.parent.parent / "templates" / "tftp"
|
TEMPLATES_DIR = Path(__file__).parent.parent / "templates" / "tftp"
|
||||||
|
|
||||||
|
|
||||||
class TFTPService(BaseService):
|
class TFTPService(BaseService):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from decnet.services.base import BaseService
|
from decnet.services.base import BaseService
|
||||||
|
|
||||||
TEMPLATES_DIR = Path(__file__).parent.parent.parent / "templates" / "vnc"
|
TEMPLATES_DIR = Path(__file__).parent.parent / "templates" / "vnc"
|
||||||
|
|
||||||
|
|
||||||
class VNCService(BaseService):
|
class VNCService(BaseService):
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user