From 48434138834b51f0e77f4e3995a29f7618793d39 Mon Sep 17 00:00:00 2001 From: jmsgrogan Date: Fri, 29 Mar 2024 12:23:14 +0000 Subject: [PATCH] Clean package structure ahead of tests --- .gitignore | 3 +++ Containerfile | 4 ++-- {machine_admin => src/machine_admin}/__init__.py | 0 {machine_admin => src/machine_admin}/firewall.py | 3 ++- {machine_admin => src/machine_admin}/machine.py | 8 ++++---- {machine_admin => src/machine_admin}/package_manager.py | 3 ++- {machine_admin => src/machine_admin}/ssh_config.py | 3 ++- {machine_admin => src/machine_admin}/user.py | 2 +- {machine_admin => src/machine_admin}/util.py | 0 machine_setup.py => src/machine_setup.py | 0 10 files changed, 16 insertions(+), 10 deletions(-) rename {machine_admin => src/machine_admin}/__init__.py (100%) rename {machine_admin => src/machine_admin}/firewall.py (90%) rename {machine_admin => src/machine_admin}/machine.py (77%) rename {machine_admin => src/machine_admin}/package_manager.py (96%) rename {machine_admin => src/machine_admin}/ssh_config.py (93%) rename {machine_admin => src/machine_admin}/user.py (93%) rename {machine_admin => src/machine_admin}/util.py (100%) rename machine_setup.py => src/machine_setup.py (100%) diff --git a/.gitignore b/.gitignore index e69de29..35ca24f 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,3 @@ +.venv +*.pyc +__pycache__/ \ No newline at end of file diff --git a/Containerfile b/Containerfile index 417485d..8e96c64 100644 --- a/Containerfile +++ b/Containerfile @@ -1,4 +1,4 @@ FROM debian -COPY machine_admin /machine_admin -COPY machine_setup.py / +COPY src/machine_admin /machine_admin +COPY src/machine_setup.py / diff --git a/machine_admin/__init__.py b/src/machine_admin/__init__.py similarity index 100% rename from machine_admin/__init__.py rename to src/machine_admin/__init__.py diff --git a/machine_admin/firewall.py b/src/machine_admin/firewall.py similarity index 90% rename from machine_admin/firewall.py rename to src/machine_admin/firewall.py index 7ed1619..ee5ba35 100644 --- a/machine_admin/firewall.py +++ b/src/machine_admin/firewall.py @@ -1,5 +1,6 @@ import logging -from util import run_op + +from .util import run_op class UfwInterface: diff --git a/machine_admin/machine.py b/src/machine_admin/machine.py similarity index 77% rename from machine_admin/machine.py rename to src/machine_admin/machine.py index 63aa482..1a2a7e0 100644 --- a/machine_admin/machine.py +++ b/src/machine_admin/machine.py @@ -1,7 +1,7 @@ -from firewall import Firewall -from user import User, UserManager -from ssh_config import SshConfig -from package_manager import PackageManager +from .firewall import Firewall +from .user import User, UserManager +from .ssh_config import SshConfig +from .package_manager import PackageManager class Machine: diff --git a/machine_admin/package_manager.py b/src/machine_admin/package_manager.py similarity index 96% rename from machine_admin/package_manager.py rename to src/machine_admin/package_manager.py index 56b8b20..e7d25ae 100644 --- a/machine_admin/package_manager.py +++ b/src/machine_admin/package_manager.py @@ -1,5 +1,6 @@ import logging -from util import run_op + +from .util import run_op class AptInterface: diff --git a/machine_admin/ssh_config.py b/src/machine_admin/ssh_config.py similarity index 93% rename from machine_admin/ssh_config.py rename to src/machine_admin/ssh_config.py index 74259c8..6b65291 100644 --- a/machine_admin/ssh_config.py +++ b/src/machine_admin/ssh_config.py @@ -1,6 +1,7 @@ from pathlib import Path import logging -from util import run_op + +from .util import run_op class SshConfig: diff --git a/machine_admin/user.py b/src/machine_admin/user.py similarity index 93% rename from machine_admin/user.py rename to src/machine_admin/user.py index 071b1ad..c44d7c3 100644 --- a/machine_admin/user.py +++ b/src/machine_admin/user.py @@ -1,5 +1,5 @@ import logging -from util import run_op +from .util import run_op class User: def __init__(self, name, has_sudo=False): diff --git a/machine_admin/util.py b/src/machine_admin/util.py similarity index 100% rename from machine_admin/util.py rename to src/machine_admin/util.py diff --git a/machine_setup.py b/src/machine_setup.py similarity index 100% rename from machine_setup.py rename to src/machine_setup.py