diff --git a/TODO.md b/TODO.md
index bfa860a2..bfad8a93 100644
--- a/TODO.md
+++ b/TODO.md
@@ -460,29 +460,3 @@ mkhomedir_helper or create ssh homes with bash.rc and such
# POSTFIX web traffic monitor '": uid=" from=<%(user)s>'
-
-# orchestra.server PING/SSH+uptime status
- class ServerState(models.Model):
- server = models.OneToOneField(Server)
- ping = models.CharField(max_length=256)
- uptime = models.CharField(max_length=256)
- from orchestra.contrib.orchestration.models import Server
- from orchestra.utils.sys import run, sshrun, joinall
- def retrieve_state(servers):
- uptimes = []
- pings = []
- for server in servers:
- address = server.get_address()
- ping = run('ping -c 1 %s' % address, async=True)
- pings.append(ping)
- uptime = sshrun(address, 'uptime', persist=True, async=True)
- uptimes.append(uptime)
-
- pings = joinall(pings, silent=True)
- uptimes = joinall(uptimes, silent=True)
- for ping in pings:
- print(ping.stdout.splitlines()[-1])
-
- for uptime in uptimes:
- print(uptime.stdout)
- retrieve_state(Server.objects.all())
diff --git a/orchestra/contrib/orchestration/models.py b/orchestra/contrib/orchestration/models.py
index 9e65638b..bcd45464 100644
--- a/orchestra/contrib/orchestration/models.py
+++ b/orchestra/contrib/orchestration/models.py
@@ -27,7 +27,7 @@ class Server(models.Model):
address = NullableCharField(_("address"), max_length=256, blank=True,
validators=[OrValidator(validate_ip_address, validate_hostname)],
null=True, unique=True, help_text=_(
- "Optional IP address or domain name. Name field will be used if not provided.
"
+ "Optional IP address or domain name. If blank, name field will be used for address resolution.
"
"If the IP address never changes you can set this field and save DNS requests."))
description = models.TextField(_("description"), blank=True)
os = models.CharField(_("operative system"), max_length=32,
diff --git a/orchestra/contrib/payments/methods/options.py b/orchestra/contrib/payments/methods/options.py
index 9a98d988..cf74a635 100644
--- a/orchestra/contrib/payments/methods/options.py
+++ b/orchestra/contrib/payments/methods/options.py
@@ -8,9 +8,6 @@ from orchestra.utils.python import import_class
from .. import settings
-logger = logging.getLogger(__name__)
-
-
class PaymentMethod(plugins.Plugin):
label_field = 'label'
number_field = 'number'
@@ -24,10 +21,7 @@ class PaymentMethod(plugins.Plugin):
def get_plugins(cls):
plugins = []
for cls in settings.PAYMENTS_ENABLED_METHODS:
- try:
- plugins.append(import_class(cls))
- except ImportError as exc:
- logger.error('Error loading %s: %s' % (cls, exc))
+ plugins.append(import_class(cls))
return plugins
def get_label(self):
diff --git a/orchestra/contrib/payments/methods/sepadirectdebit.py b/orchestra/contrib/payments/methods/sepadirectdebit.py
index 49b5203c..53a1e788 100644
--- a/orchestra/contrib/payments/methods/sepadirectdebit.py
+++ b/orchestra/contrib/payments/methods/sepadirectdebit.py
@@ -1,8 +1,6 @@
import datetime
-import lxml.builder
+import logging
import os
-from lxml import etree
-from lxml.builder import E
from io import StringIO
from django import forms
@@ -17,6 +15,14 @@ from .. import settings
from .options import PaymentMethod
+logger = logging.getLogger(__name__)
+
+try:
+ import lxml
+except ImportError:
+ logger.error('Error loading lxml, module not install')
+
+
class SEPADirectDebitForm(PluginDataForm):
iban = forms.CharField(label='IBAN',
widget=forms.TextInput(attrs={'size': '50'}))
@@ -76,6 +82,8 @@ class SEPADirectDebit(PaymentMethod):
@classmethod
def process_credits(cls, transactions):
+ import lxml.builder
+ from lxml.builder import E
from ..models import TransactionProcess
process = TransactionProcess.objects.create()
context = cls.get_context(transactions)
@@ -120,6 +128,8 @@ class SEPADirectDebit(PaymentMethod):
@classmethod
def process_debts(cls, transactions):
+ import lxml.builder
+ from lxml.builder import E
from ..models import TransactionProcess
process = TransactionProcess.objects.create()
context = cls.get_context(transactions)
@@ -185,6 +195,8 @@ class SEPADirectDebit(PaymentMethod):
@classmethod
def get_debt_transactions(cls, transactions, process):
+ import lxml.builder
+ from lxml.builder import E
for transaction in transactions:
transaction.process = process
transaction.state = transaction.WAITTING_EXECUTION
@@ -228,6 +240,8 @@ class SEPADirectDebit(PaymentMethod):
@classmethod
def get_credit_transactions(transactions, process):
+ import lxml.builder
+ from lxml.builder import E
for transaction in transactions:
transaction.process = process
transaction.state = transaction.WAITTING_EXECUTION
@@ -263,6 +277,8 @@ class SEPADirectDebit(PaymentMethod):
@classmethod
def get_header(cls, context, process):
+ import lxml.builder
+ from lxml.builder import E
return E.GrpHdr( # Group Header
E.MsgId(str(process.id)), # Message Id
E.CreDtTm( # Creation Date Time
@@ -284,6 +300,7 @@ class SEPADirectDebit(PaymentMethod):
@classmethod
def process_xml(cls, sepa, xsd, file_name, process):
+ from lxml import etree
# http://www.iso20022.org/documents/messages/1_0_version/pain/schemas/pain.008.001.02.zip
path = os.path.dirname(os.path.realpath(__file__))
xsd_path = os.path.join(path, xsd)