Fixes for make pastafari2 independent of monit module
This commit is contained in:
parent
05d8824d6f
commit
437f0ca08a
3 changed files with 41 additions and 4 deletions
|
|
@ -17,9 +17,33 @@ from redis import Redis
|
|||
from rq import Queue
|
||||
import importlib
|
||||
import traceback
|
||||
from modules.monit.models.monit import LonelyIpField
|
||||
#from modules.monit.models.monit import LonelyIpField
|
||||
from modules.pastafari2.libraries.configtask import config_task
|
||||
|
||||
class LonelyIpField(IpField):
|
||||
|
||||
def __init__(self, name, size=64):
|
||||
|
||||
super().__init__(name, size)
|
||||
|
||||
self.duplicated_ip=False
|
||||
|
||||
def check(self, value):
|
||||
|
||||
value=super().check(value)
|
||||
|
||||
if self.duplicated_ip==True:
|
||||
self.txt_error='Error: you have a server with this ip in the database'
|
||||
self.error=True
|
||||
return value
|
||||
|
||||
return value
|
||||
|
||||
def show_formatted(self, value):
|
||||
|
||||
return '<input id="ip_%s" value="" type="hidden"/>%s' % (value, value)
|
||||
|
||||
|
||||
class Task(WebModel):
|
||||
|
||||
def __init__(self, connection):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue