This commit is contained in:
Adolfo Gómez García 2018-12-10 11:42:23 +01:00
parent eae79364b8
commit fb818f06a5
2 changed files with 11 additions and 4 deletions

View File

@ -138,7 +138,7 @@ class Services(DetailHandler): # pylint: disable=too-many-public-methods
def saveItem(self, parent, item):
# Extract item db fields
# We need this fields for all
logger.debug('Saving service {0} / {1}'.format(parent, item))
logger.debug('Saving service for {0} / {1}'.format(parent, item))
fields = self.readFieldsFromParams(['name', 'comments', 'data_type', 'tags', 'proxy_id'])
tags = fields['tags']
del fields['tags']

View File

@ -78,12 +78,19 @@ class IPMachinesService(services.Service):
return {'ipList': gui.convertToList(ips)}
def marshal(self):
logger.debug('Marshal: %s', self._ips)
self.storage.saveData('ips', pickle.dumps(self._ips))
return 'v1'
return b'v1'
def unmarshal(self, vals):
if vals == 'v1':
self._ips = pickle.loads(str(self.storage.readData('ips')))
logger.debug('Vals %s', vals)
if vals == b'v1':
vals = self.storage.readData('ips')
try:
self._ips = pickle.loads(vals)
except: # Legacy "as string"
self._ips = pickle.loads(vals.encode('utf8'))
logger.debug('Unmarshal: %s', self._ips)
def getUnassignedMachine(self):
# Search first unassigned machine