From 12b7d86229346c68e653a51d1e6598a5973901ba Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Mon, 16 Jun 2008 16:26:44 -0300 Subject: [PATCH] Move services outside the "static" pymin modules structure (refs #27). --- config.py | 2 +- pymin/{services => service}/__init__.py | 0 pymin/{services => service}/util.py | 2 +- pymind | 2 +- {pymin/services => services}/dhcp/__init__.py | 6 +++--- {pymin/services => services}/dhcp/templates/dhcpd.conf | 0 {pymin/services => services}/dns/__init__.py | 6 +++--- {pymin/services => services}/dns/templates/named.conf | 0 {pymin/services => services}/dns/templates/zoneX.zone | 0 {pymin/services => services}/firewall/__init__.py | 4 ++-- .../firewall/templates/iptables.sh | 0 {pymin/services => services}/ip/__init__.py | 10 +++++----- {pymin/services => services}/ip/templates/device | 0 {pymin/services => services}/ip/templates/hop | 0 {pymin/services => services}/ip/templates/ip_add | 0 {pymin/services => services}/ip/templates/ip_del | 0 {pymin/services => services}/ip/templates/ip_flush | 0 {pymin/services => services}/ip/templates/route_add | 0 {pymin/services => services}/ip/templates/route_del | 0 {pymin/services => services}/ip/templates/route_flush | 0 {pymin/services => services}/nat/__init__.py | 6 +++--- {pymin/services => services}/ppp/__init__.py | 4 ++-- .../services => services}/ppp/templates/chap-secrets | 0 {pymin/services => services}/ppp/templates/nameX | 0 {pymin/services => services}/ppp/templates/options.X | 0 {pymin/services => services}/ppp/templates/pap-secrets | 0 {pymin/services => services}/proxy/__init__.py | 6 +++--- .../services => services}/proxy/templates/squid.conf | 0 .../services => services}/proxy/templates/users.conf | 0 {pymin/services => services}/qos/__init__.py | 8 ++++---- {pymin/services => services}/qos/templates/class_add | 0 {pymin/services => services}/qos/templates/class_del | 0 {pymin/services => services}/qos/templates/device | 0 {pymin/services => services}/qos/templates/host_add | 0 {pymin/services => services}/vpn/__init__.py | 5 ++--- {pymin/services => services}/vpn/templates/host | 0 {pymin/services => services}/vpn/templates/tinc-up | 0 {pymin/services => services}/vpn/templates/tinc.conf | 0 {pymin/services => services}/vrrp/__init__.py | 6 +++--- 39 files changed, 33 insertions(+), 34 deletions(-) rename pymin/{services => service}/__init__.py (100%) rename pymin/{services => service}/util.py (99%) rename {pymin/services => services}/dhcp/__init__.py (95%) rename {pymin/services => services}/dhcp/templates/dhcpd.conf (100%) rename {pymin/services => services}/dns/__init__.py (97%) rename {pymin/services => services}/dns/templates/named.conf (100%) rename {pymin/services => services}/dns/templates/zoneX.zone (100%) rename {pymin/services => services}/firewall/__init__.py (97%) rename {pymin/services => services}/firewall/templates/iptables.sh (100%) rename {pymin/services => services}/ip/__init__.py (97%) rename {pymin/services => services}/ip/templates/device (100%) rename {pymin/services => services}/ip/templates/hop (100%) rename {pymin/services => services}/ip/templates/ip_add (100%) rename {pymin/services => services}/ip/templates/ip_del (100%) rename {pymin/services => services}/ip/templates/ip_flush (100%) rename {pymin/services => services}/ip/templates/route_add (100%) rename {pymin/services => services}/ip/templates/route_del (100%) rename {pymin/services => services}/ip/templates/route_flush (100%) rename {pymin/services => services}/nat/__init__.py (97%) rename {pymin/services => services}/ppp/__init__.py (98%) rename {pymin/services => services}/ppp/templates/chap-secrets (100%) rename {pymin/services => services}/ppp/templates/nameX (100%) rename {pymin/services => services}/ppp/templates/options.X (100%) rename {pymin/services => services}/ppp/templates/pap-secrets (100%) rename {pymin/services => services}/proxy/__init__.py (93%) rename {pymin/services => services}/proxy/templates/squid.conf (100%) rename {pymin/services => services}/proxy/templates/users.conf (100%) rename {pymin/services => services}/qos/__init__.py (96%) rename {pymin/services => services}/qos/templates/class_add (100%) rename {pymin/services => services}/qos/templates/class_del (100%) rename {pymin/services => services}/qos/templates/device (100%) rename {pymin/services => services}/qos/templates/host_add (100%) rename {pymin/services => services}/vpn/__init__.py (97%) rename {pymin/services => services}/vpn/templates/host (100%) rename {pymin/services => services}/vpn/templates/tinc-up (100%) rename {pymin/services => services}/vpn/templates/tinc.conf (100%) rename {pymin/services => services}/vrrp/__init__.py (92%) diff --git a/config.py b/config.py index aa3e5eb..26f8442 100644 --- a/config.py +++ b/config.py @@ -83,5 +83,5 @@ bind_addr = \ services = 'firewall nat ppp vpn ip dns dhcp proxy vrrp qos'.split() -services_dirs = ['pymin/services'] +services_dirs = ['services'] diff --git a/pymin/services/__init__.py b/pymin/service/__init__.py similarity index 100% rename from pymin/services/__init__.py rename to pymin/service/__init__.py diff --git a/pymin/services/util.py b/pymin/service/util.py similarity index 99% rename from pymin/services/util.py rename to pymin/service/util.py index 00f2385..cdea1a0 100644 --- a/pymin/services/util.py +++ b/pymin/service/util.py @@ -8,7 +8,7 @@ try: import cPickle as pickle except ImportError: import pickle -import logging ; log = logging.getLogger('pymin.services.util') +import logging ; log = logging.getLogger('pymin.service.util') from pymin.dispatcher import Handler, handler, HandlerError, \ CommandNotFoundError diff --git a/pymind b/pymind index 2f428b5..c29dabb 100755 --- a/pymind +++ b/pymind @@ -4,7 +4,7 @@ import sys from pymin.pymindaemon import PyminDaemon from pymin.dispatcher import Handler -from pymin.services import load_service, LoadError +from pymin.service import load_service, LoadError import config class Root(Handler): diff --git a/pymin/services/dhcp/__init__.py b/services/dhcp/__init__.py similarity index 95% rename from pymin/services/dhcp/__init__.py rename to services/dhcp/__init__.py index 1c6a919..c33a555 100644 --- a/pymin/services/dhcp/__init__.py +++ b/services/dhcp/__init__.py @@ -5,9 +5,9 @@ import logging ; log = logging.getLogger('pymin.services.dhcp') from pymin.seqtools import Sequence from pymin.dispatcher import Handler, handler, HandlerError -from pymin.services.util import Restorable, ConfigWriter, InitdHandler, \ - TransactionalHandler, ParametersHandler, \ - DictSubHandler, ReloadHandler +from pymin.service.util import Restorable, ConfigWriter, InitdHandler, \ + TransactionalHandler, ParametersHandler, \ + DictSubHandler, ReloadHandler __all__ = ('DhcpHandler', 'get_service') diff --git a/pymin/services/dhcp/templates/dhcpd.conf b/services/dhcp/templates/dhcpd.conf similarity index 100% rename from pymin/services/dhcp/templates/dhcpd.conf rename to services/dhcp/templates/dhcpd.conf diff --git a/pymin/services/dns/__init__.py b/services/dns/__init__.py similarity index 97% rename from pymin/services/dns/__init__.py rename to services/dns/__init__.py index c3cf03e..23046c5 100644 --- a/pymin/services/dns/__init__.py +++ b/services/dns/__init__.py @@ -7,9 +7,9 @@ import logging ; log = logging.getLogger('pymin.services.dns') from pymin.seqtools import Sequence from pymin.dispatcher import handler, HandlerError, Handler -from pymin.services.util import Restorable, ConfigWriter, InitdHandler, \ - TransactionalHandler, ParametersHandler, \ - DictComposedSubHandler, DictSubHandler, call +from pymin.service.util import Restorable, ConfigWriter, InitdHandler, \ + TransactionalHandler, ParametersHandler, \ + DictComposedSubHandler, DictSubHandler, call __all__ = ('DnsHandler', 'get_service') diff --git a/pymin/services/dns/templates/named.conf b/services/dns/templates/named.conf similarity index 100% rename from pymin/services/dns/templates/named.conf rename to services/dns/templates/named.conf diff --git a/pymin/services/dns/templates/zoneX.zone b/services/dns/templates/zoneX.zone similarity index 100% rename from pymin/services/dns/templates/zoneX.zone rename to services/dns/templates/zoneX.zone diff --git a/pymin/services/firewall/__init__.py b/services/firewall/__init__.py similarity index 97% rename from pymin/services/firewall/__init__.py rename to services/firewall/__init__.py index 7b17c23..50a8dfb 100644 --- a/pymin/services/firewall/__init__.py +++ b/services/firewall/__init__.py @@ -11,8 +11,8 @@ import logging ; log = logging.getLogger('pymin.services.firewall') from pymin.item import Item from pymin.validatedclass import Field from pymin.dispatcher import Handler, handler, HandlerError -from pymin.services.util import Restorable, ConfigWriter, ServiceHandler, \ - TransactionalHandler, ListSubHandler +from pymin.service.util import Restorable, ConfigWriter, ServiceHandler, \ + TransactionalHandler, ListSubHandler __all__ = ('FirewallHandler', 'get_service') diff --git a/pymin/services/firewall/templates/iptables.sh b/services/firewall/templates/iptables.sh similarity index 100% rename from pymin/services/firewall/templates/iptables.sh rename to services/firewall/templates/iptables.sh diff --git a/pymin/services/ip/__init__.py b/services/ip/__init__.py similarity index 97% rename from pymin/services/ip/__init__.py rename to services/ip/__init__.py index 54ee30b..2bbc288 100644 --- a/pymin/services/ip/__init__.py +++ b/services/ip/__init__.py @@ -6,11 +6,11 @@ import logging ; log = logging.getLogger('pymin.services.ip') from pymin.seqtools import Sequence from pymin.dispatcher import handler, HandlerError, Handler -from pymin.services.util import Restorable, ConfigWriter, InitdHandler, \ - TransactionalHandler, SubHandler, call, \ - get_network_devices, ListComposedSubHandler, \ - DictComposedSubHandler, ListSubHandler, \ - Device, Address, ExecutionError +from pymin.service.util import Restorable, ConfigWriter, InitdHandler, \ + TransactionalHandler, SubHandler, call, \ + get_network_devices, ListComposedSubHandler, \ + DictComposedSubHandler, ListSubHandler, \ + Device, Address, ExecutionError __all__ = ('IpHandler', 'get_service') diff --git a/pymin/services/ip/templates/device b/services/ip/templates/device similarity index 100% rename from pymin/services/ip/templates/device rename to services/ip/templates/device diff --git a/pymin/services/ip/templates/hop b/services/ip/templates/hop similarity index 100% rename from pymin/services/ip/templates/hop rename to services/ip/templates/hop diff --git a/pymin/services/ip/templates/ip_add b/services/ip/templates/ip_add similarity index 100% rename from pymin/services/ip/templates/ip_add rename to services/ip/templates/ip_add diff --git a/pymin/services/ip/templates/ip_del b/services/ip/templates/ip_del similarity index 100% rename from pymin/services/ip/templates/ip_del rename to services/ip/templates/ip_del diff --git a/pymin/services/ip/templates/ip_flush b/services/ip/templates/ip_flush similarity index 100% rename from pymin/services/ip/templates/ip_flush rename to services/ip/templates/ip_flush diff --git a/pymin/services/ip/templates/route_add b/services/ip/templates/route_add similarity index 100% rename from pymin/services/ip/templates/route_add rename to services/ip/templates/route_add diff --git a/pymin/services/ip/templates/route_del b/services/ip/templates/route_del similarity index 100% rename from pymin/services/ip/templates/route_del rename to services/ip/templates/route_del diff --git a/pymin/services/ip/templates/route_flush b/services/ip/templates/route_flush similarity index 100% rename from pymin/services/ip/templates/route_flush rename to services/ip/templates/route_flush diff --git a/pymin/services/nat/__init__.py b/services/nat/__init__.py similarity index 97% rename from pymin/services/nat/__init__.py rename to services/nat/__init__.py index 3afc997..32e2608 100644 --- a/pymin/services/nat/__init__.py +++ b/services/nat/__init__.py @@ -5,9 +5,9 @@ import logging ; log = logging.getLogger('pymin.services.nat') from pymin.seqtools import Sequence from pymin.dispatcher import Handler, handler, HandlerError -from pymin.services.util import Restorable, ConfigWriter, RestartHandler, \ - ReloadHandler, TransactionalHandler, \ - ServiceHandler, ListSubHandler, call +from pymin.service.util import Restorable, ConfigWriter, RestartHandler, \ + ReloadHandler, TransactionalHandler, \ + ServiceHandler, ListSubHandler, call __all__ = ('NatHandler', 'get_service') diff --git a/pymin/services/ppp/__init__.py b/services/ppp/__init__.py similarity index 98% rename from pymin/services/ppp/__init__.py rename to services/ppp/__init__.py index 7f5a143..9c6bdff 100644 --- a/pymin/services/ppp/__init__.py +++ b/services/ppp/__init__.py @@ -8,8 +8,8 @@ import logging ; log = logging.getLogger('pymin.services.ppp') from pymin.seqtools import Sequence from pymin.dispatcher import Handler, handler, HandlerError -from pymin.services.util import Restorable, ConfigWriter, ReloadHandler, \ - TransactionalHandler, DictSubHandler, call +from pymin.service.util import Restorable, ConfigWriter, ReloadHandler, \ + TransactionalHandler, DictSubHandler, call __all__ = ('PppHandler', 'get_service') diff --git a/pymin/services/ppp/templates/chap-secrets b/services/ppp/templates/chap-secrets similarity index 100% rename from pymin/services/ppp/templates/chap-secrets rename to services/ppp/templates/chap-secrets diff --git a/pymin/services/ppp/templates/nameX b/services/ppp/templates/nameX similarity index 100% rename from pymin/services/ppp/templates/nameX rename to services/ppp/templates/nameX diff --git a/pymin/services/ppp/templates/options.X b/services/ppp/templates/options.X similarity index 100% rename from pymin/services/ppp/templates/options.X rename to services/ppp/templates/options.X diff --git a/pymin/services/ppp/templates/pap-secrets b/services/ppp/templates/pap-secrets similarity index 100% rename from pymin/services/ppp/templates/pap-secrets rename to services/ppp/templates/pap-secrets diff --git a/pymin/services/proxy/__init__.py b/services/proxy/__init__.py similarity index 93% rename from pymin/services/proxy/__init__.py rename to services/proxy/__init__.py index 448f568..7a52724 100644 --- a/pymin/services/proxy/__init__.py +++ b/services/proxy/__init__.py @@ -5,9 +5,9 @@ import logging ; log = logging.getLogger('pymin.services.proxy') from pymin.seqtools import Sequence from pymin.dispatcher import Handler, handler, HandlerError -from pymin.services.util import Restorable, ConfigWriter, InitdHandler, \ - TransactionalHandler, ParametersHandler, \ - DictSubHandler +from pymin.service.util import Restorable, ConfigWriter, InitdHandler, \ + TransactionalHandler, ParametersHandler, \ + DictSubHandler import crypt diff --git a/pymin/services/proxy/templates/squid.conf b/services/proxy/templates/squid.conf similarity index 100% rename from pymin/services/proxy/templates/squid.conf rename to services/proxy/templates/squid.conf diff --git a/pymin/services/proxy/templates/users.conf b/services/proxy/templates/users.conf similarity index 100% rename from pymin/services/proxy/templates/users.conf rename to services/proxy/templates/users.conf diff --git a/pymin/services/qos/__init__.py b/services/qos/__init__.py similarity index 96% rename from pymin/services/qos/__init__.py rename to services/qos/__init__.py index d021d68..c175049 100644 --- a/pymin/services/qos/__init__.py +++ b/services/qos/__init__.py @@ -5,10 +5,10 @@ from os import path from pymin.seqtools import Sequence from pymin.dispatcher import handler, HandlerError, Handler -from pymin.services.util import Restorable, ConfigWriter, InitdHandler, \ - TransactionalHandler, SubHandler, call, \ - get_network_devices, ListComposedSubHandler, \ - DictComposedSubHandler, ExecutionError +from pymin.service.util import Restorable, ConfigWriter, InitdHandler, \ + TransactionalHandler, SubHandler, call, \ + get_network_devices, ListComposedSubHandler, \ + DictComposedSubHandler, ExecutionError __all__ = ('QoSHandler', 'get_service') diff --git a/pymin/services/qos/templates/class_add b/services/qos/templates/class_add similarity index 100% rename from pymin/services/qos/templates/class_add rename to services/qos/templates/class_add diff --git a/pymin/services/qos/templates/class_del b/services/qos/templates/class_del similarity index 100% rename from pymin/services/qos/templates/class_del rename to services/qos/templates/class_del diff --git a/pymin/services/qos/templates/device b/services/qos/templates/device similarity index 100% rename from pymin/services/qos/templates/device rename to services/qos/templates/device diff --git a/pymin/services/qos/templates/host_add b/services/qos/templates/host_add similarity index 100% rename from pymin/services/qos/templates/host_add rename to services/qos/templates/host_add diff --git a/pymin/services/vpn/__init__.py b/services/vpn/__init__.py similarity index 97% rename from pymin/services/vpn/__init__.py rename to services/vpn/__init__.py index 066e8fc..ebfa0ab 100644 --- a/pymin/services/vpn/__init__.py +++ b/services/vpn/__init__.py @@ -9,9 +9,8 @@ import logging ; log = logging.getLogger('pymin.services.vpn') from pymin.seqtools import Sequence from pymin.dispatcher import Handler, handler, HandlerError -from pymin.services.util import Restorable, ConfigWriter, InitdHandler, \ - TransactionalHandler, DictSubHandler, DictComposedSubHandler, call, ExecutionError - +from pymin.service.util import Restorable, ConfigWriter, InitdHandler, \ + TransactionalHandler, DictSubHandler, DictComposedSubHandler, call, ExecutionError __all__ = ('VpnHandler', 'get_service') diff --git a/pymin/services/vpn/templates/host b/services/vpn/templates/host similarity index 100% rename from pymin/services/vpn/templates/host rename to services/vpn/templates/host diff --git a/pymin/services/vpn/templates/tinc-up b/services/vpn/templates/tinc-up similarity index 100% rename from pymin/services/vpn/templates/tinc-up rename to services/vpn/templates/tinc-up diff --git a/pymin/services/vpn/templates/tinc.conf b/services/vpn/templates/tinc.conf similarity index 100% rename from pymin/services/vpn/templates/tinc.conf rename to services/vpn/templates/tinc.conf diff --git a/pymin/services/vrrp/__init__.py b/services/vrrp/__init__.py similarity index 92% rename from pymin/services/vrrp/__init__.py rename to services/vrrp/__init__.py index 9b4c0e6..5ddbbaf 100644 --- a/pymin/services/vrrp/__init__.py +++ b/services/vrrp/__init__.py @@ -1,9 +1,9 @@ # vim: set encoding=utf-8 et sw=4 sts=4 : from pymin import procman -from pymin.services.util import Restorable, TransactionalHandler, \ - ReloadHandler, RestartHandler, \ - ServiceHandler, ParametersHandler +from pymin.service.util import Restorable, TransactionalHandler, \ + ReloadHandler, RestartHandler, \ + ServiceHandler, ParametersHandler # Logger import logging ; log = logging.getLogger('pymin.services.vrrp') -- 2.43.0