mirror of
https://github.com/dkmstr/openuds.git
synced 2024-12-22 13:34:04 +03:00
Fixing up several minor lang issues
This commit is contained in:
parent
c6683db6e6
commit
e0843179cd
@ -9,6 +9,6 @@ ovirt-engine-sdk-python
|
||||
pycurl
|
||||
pyOpenSSL
|
||||
python-ldap
|
||||
six
|
||||
MySQL-python
|
||||
reportlab
|
||||
reportlab
|
||||
bitarray
|
||||
|
@ -37,7 +37,7 @@ from uds.models import User, Service, UserService, DeployedService, getSqlDateti
|
||||
from uds.core.util.stats import counters
|
||||
from uds.core.util.Cache import Cache
|
||||
from uds.REST import Handler, RequestError, ResponseError
|
||||
import cPickle
|
||||
import pickle
|
||||
from datetime import timedelta
|
||||
|
||||
import logging
|
||||
@ -70,11 +70,11 @@ def getServicesPoolsCounters(servicePool, counter_type):
|
||||
for x in counters.getCounters(us, counter_type, since=since, to=to, limit=POINTS, use_max=USE_MAX, all=complete):
|
||||
val.append({'stamp': x[0], 'value': int(x[1])})
|
||||
if len(val) > 2:
|
||||
cache.put(cacheKey, cPickle.dumps(val).encode('zip'), 600)
|
||||
cache.put(cacheKey, pickle.dumps(val).encode('zip'), 600)
|
||||
else:
|
||||
val = [{'stamp': since, 'value': 0}, {'stamp': to, 'value': 0}]
|
||||
else:
|
||||
val = cPickle.loads(val.decode('zip'))
|
||||
val = pickle.loads(val.decode('zip'))
|
||||
|
||||
return val
|
||||
except:
|
||||
|
@ -141,7 +141,7 @@ class gui(object):
|
||||
'''
|
||||
if isinstance(str_, bool):
|
||||
return str_
|
||||
if unicode(str_).lower() == gui.TRUE:
|
||||
if six.text_type(str_).lower() == gui.TRUE:
|
||||
return True
|
||||
return False
|
||||
|
||||
@ -219,7 +219,7 @@ class gui(object):
|
||||
'length': options.get('length', gui.InputField.DEFAULT_LENTGH),
|
||||
'required': options.get('required', False),
|
||||
'label': options.get('label', ''),
|
||||
'defvalue': unicode(options.get('defvalue', '')),
|
||||
'defvalue': six.text_type(options.get('defvalue', '')),
|
||||
'rdonly': options.get('rdonly', False), # This property only affects in "modify" operations
|
||||
'order': options.get('order', 0),
|
||||
'tooltip': options.get('tooltip', ''),
|
||||
|
@ -32,7 +32,7 @@
|
||||
'''
|
||||
|
||||
from uds.core.Serializable import Serializable
|
||||
import cPickle
|
||||
import pickle
|
||||
import timeit
|
||||
|
||||
|
||||
@ -93,7 +93,7 @@ class AutoAttributes(Serializable):
|
||||
self.dict = d
|
||||
|
||||
def marshal(self):
|
||||
return '\2'.join(['%s\1%s' % (k, cPickle.dumps(v)) for k, v in self.dict.iteritems()]).encode(AutoAttributes.ACODEC)
|
||||
return '\2'.join(['%s\1%s' % (k, pickle.dumps(v)) for k, v in self.dict.iteritems()]).encode(AutoAttributes.ACODEC)
|
||||
|
||||
def unmarshal(self, data):
|
||||
if data == '': # Can be empty
|
||||
@ -101,7 +101,7 @@ class AutoAttributes(Serializable):
|
||||
# We keep original data (maybe incomplete)
|
||||
for pair in data.decode(AutoAttributes.ACODEC).split('\2'):
|
||||
k, v = pair.split('\1')
|
||||
self.dict[k] = cPickle.loads(str(v))
|
||||
self.dict[k] = pickle.loads(str(v))
|
||||
|
||||
def __str__(self):
|
||||
str_ = '<AutoAttribute '
|
||||
|
@ -36,7 +36,7 @@ from uds.models import Cache as dbCache, getSqlDatetime
|
||||
from datetime import datetime, timedelta
|
||||
import hashlib
|
||||
import logging
|
||||
import cPickle
|
||||
import pickle
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -62,7 +62,7 @@ class Cache(object):
|
||||
expired = now > c.created + timedelta(seconds=c.validity)
|
||||
if expired:
|
||||
return defValue
|
||||
val = cPickle.loads(c.value.decode(Cache.CODEC))
|
||||
val = pickle.loads(c.value.decode(Cache.CODEC))
|
||||
return val
|
||||
except dbCache.DoesNotExist: # @UndefinedVariable
|
||||
logger.debug('key not found: {}'.format(skey))
|
||||
@ -90,7 +90,7 @@ class Cache(object):
|
||||
if validity is None:
|
||||
validity = Cache.DEFAULT_VALIDITY
|
||||
key = self.__getKey(skey)
|
||||
value = cPickle.dumps(value).encode(Cache.CODEC)
|
||||
value = pickle.dumps(value).encode(Cache.CODEC)
|
||||
now = getSqlDatetime()
|
||||
try:
|
||||
dbCache.objects.create(owner=self._owner, key=key, value=value, created=now, validity=validity) # @UndefinedVariable
|
||||
|
@ -36,7 +36,7 @@ from django.db import transaction
|
||||
from uds.models import Storage as dbStorage
|
||||
import hashlib
|
||||
import logging
|
||||
import cPickle
|
||||
import pickle
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -69,7 +69,7 @@ class Storage(object):
|
||||
return self.saveData(skey, data)
|
||||
|
||||
def putPickle(self, skey, data, attr1=None):
|
||||
return self.saveData(skey, cPickle.dumps(data), attr1)
|
||||
return self.saveData(skey, pickle.dumps(data), attr1)
|
||||
|
||||
def updateData(self, skey, data, attr1=None):
|
||||
self.saveData(skey, data, attr1)
|
||||
@ -98,12 +98,12 @@ class Storage(object):
|
||||
def getPickle(self, skey):
|
||||
v = self.readData(skey, True)
|
||||
if v is not None:
|
||||
v = cPickle.loads(v)
|
||||
v = pickle.loads(v)
|
||||
return v
|
||||
|
||||
def getPickleByAttr1(self, attr1):
|
||||
try:
|
||||
return cPickle.loads(dbStorage.objects.get(owner=self._owner, attr1=attr1).data.decode(Storage.CODEC)) # @UndefinedVariable
|
||||
return pickle.loads(dbStorage.objects.get(owner=self._owner, attr1=attr1).data.decode(Storage.CODEC)) # @UndefinedVariable
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
@ -144,7 +144,7 @@ class Storage(object):
|
||||
query = dbStorage.objects.filter(owner=self._owner, attr1=attr1) # @UndefinedVariable
|
||||
|
||||
for v in query: # @UndefinedVariable
|
||||
yield (v.key, cPickle.loads(v.data.decode(Storage.CODEC)), v.attr1)
|
||||
yield (v.key, pickle.loads(v.data.decode(Storage.CODEC)), v.attr1)
|
||||
|
||||
@staticmethod
|
||||
def delete(owner=None):
|
||||
|
@ -32,7 +32,7 @@
|
||||
'''
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from UniqueIDGenerator import UniqueIDGenerator
|
||||
from .UniqueIDGenerator import UniqueIDGenerator
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -32,7 +32,7 @@
|
||||
'''
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from UniqueIDGenerator import UniqueIDGenerator
|
||||
from .UniqueIDGenerator import UniqueIDGenerator
|
||||
import logging
|
||||
import re
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
'''
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from UniqueIDGenerator import UniqueIDGenerator
|
||||
from .UniqueIDGenerator import UniqueIDGenerator
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -40,17 +40,17 @@ from django.utils.encoding import python_2_unicode_compatible
|
||||
|
||||
from uds.core.util.State import State
|
||||
from uds.core.util import log
|
||||
from uds.models.UUIDModel import UUIDModel
|
||||
from .UUIDModel import UUIDModel
|
||||
|
||||
from uds.models.Authenticator import Authenticator
|
||||
from uds.models.User import User
|
||||
from uds.models.Util import UnsavedForeignKey, getSqlDatetime
|
||||
from .Authenticator import Authenticator
|
||||
from .User import User
|
||||
from .Util import UnsavedForeignKey, getSqlDatetime
|
||||
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
__updated__ = '2015-04-30'
|
||||
__updated__ = '2015-09-07'
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
|
@ -34,10 +34,10 @@ from uds.core.services import UserDeployment
|
||||
from uds.core.util.State import State
|
||||
from uds.core.util import log
|
||||
|
||||
import cPickle
|
||||
import pickle
|
||||
import logging
|
||||
|
||||
__updated__ = '2015-06-09'
|
||||
__updated__ = '2015-09-07'
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -75,7 +75,7 @@ class OVirtLinkedDeployment(UserDeployment):
|
||||
'''
|
||||
Does nothing right here, we will use envoronment storage in this sample
|
||||
'''
|
||||
return '\1'.join(['v1', self._name, self._ip, self._mac, self._vmid, self._reason, cPickle.dumps(self._queue)])
|
||||
return '\1'.join(['v1', self._name, self._ip, self._mac, self._vmid, self._reason, pickle.dumps(self._queue)])
|
||||
|
||||
def unmarshal(self, str_):
|
||||
'''
|
||||
@ -84,7 +84,7 @@ class OVirtLinkedDeployment(UserDeployment):
|
||||
vals = str_.split('\1')
|
||||
if vals[0] == 'v1':
|
||||
self._name, self._ip, self._mac, self._vmid, self._reason, queue = vals[1:]
|
||||
self._queue = cPickle.loads(queue)
|
||||
self._queue = pickle.loads(queue)
|
||||
|
||||
def getName(self):
|
||||
'''
|
||||
|
@ -37,15 +37,16 @@ from __future__ import unicode_literals
|
||||
from django.utils.translation import ugettext_noop as _
|
||||
from uds.core.util.State import State
|
||||
from uds.core.services import ServiceProvider
|
||||
from OVirtLinkedService import OVirtLinkedService
|
||||
from uds.core.ui import gui
|
||||
from uds.core.util import validators
|
||||
|
||||
from client import oVirtClient
|
||||
from .OVirtLinkedService import OVirtLinkedService
|
||||
|
||||
from .client import oVirtClient
|
||||
|
||||
import logging
|
||||
|
||||
__updated__ = '2015-07-24'
|
||||
__updated__ = '2015-09-07'
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -28,5 +28,5 @@
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
from OVirtProvider import Provider
|
||||
from .OVirtProvider import Provider
|
||||
|
||||
|
@ -10,7 +10,7 @@ from ovirtsdk.api import API
|
||||
import threading
|
||||
import logging
|
||||
|
||||
__updated__ = '2015-06-12'
|
||||
__updated__ = '2015-09-07'
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -373,7 +373,7 @@ class Client(object):
|
||||
if vm.get_status().get_state() != 'down':
|
||||
raise Exception('Machine must be in down state to publish it')
|
||||
|
||||
print vm.disks.list()
|
||||
print(vm.disks.list())
|
||||
|
||||
# Create disks description to be created in specified storage domain, one for each disk
|
||||
sd = params.StorageDomains(storage_domain=[params.StorageDomain(id=storageId)])
|
||||
|
@ -34,11 +34,10 @@
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from uds.core import services
|
||||
from uds.core.services import types as serviceTypes
|
||||
from uds.core.util.AutoAttributes import AutoAttributes
|
||||
from uds.core.ui.UserInterface import gui
|
||||
from IPMachineDeployed import IPMachineDeployed
|
||||
from .IPMachineDeployed import IPMachineDeployed
|
||||
import logging
|
||||
import cPickle
|
||||
import pickle
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -79,12 +78,12 @@ class IPMachinesService(services.Service):
|
||||
return {'ipList': gui.convertToList(ips)}
|
||||
|
||||
def marshal(self):
|
||||
self.storage().saveData('ips', cPickle.dumps(self._ips))
|
||||
self.storage().saveData('ips', pickle.dumps(self._ips))
|
||||
return 'v1'
|
||||
|
||||
def unmarshal(self, vals):
|
||||
if vals == 'v1':
|
||||
self._ips = cPickle.loads(str(self.storage().readData('ips')))
|
||||
self._ips = pickle.loads(str(self.storage().readData('ips')))
|
||||
|
||||
def getUnassignedMachine(self):
|
||||
# Search first unassigned machine
|
||||
|
@ -4,27 +4,27 @@
|
||||
# Copyright (c) 2012 Virtual Cable S.L.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# * Neither the name of Virtual Cable S.L. nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# * Neither the name of Virtual Cable S.L. nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
'''
|
||||
@ -43,9 +43,9 @@ class PhysicalMachinesProvider(services.ServiceProvider):
|
||||
typeName = 'Physical Machines Provider'
|
||||
typeType = 'PhysicalMachinesServiceProvider'
|
||||
typeDescription = 'Provides connection to Virtual Center Services'
|
||||
iconFile = 'provider.png'
|
||||
iconFile = 'provider.png'
|
||||
|
||||
from IPMachinesService import IPMachinesService
|
||||
from .IPMachinesService import IPMachinesService
|
||||
offers = [IPMachinesService]
|
||||
|
||||
def __unicode__(self):
|
||||
|
@ -4,35 +4,35 @@
|
||||
# Copyright (c) 2012 Virtual Cable S.L.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# * Neither the name of Virtual Cable S.L. nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# * Neither the name of Virtual Cable S.L. nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
'''
|
||||
@author: Adolfo Gómez, dkmaster at dkmon dot com
|
||||
'''
|
||||
|
||||
from ServiceProvider import PhysicalMachinesProvider
|
||||
from .ServiceProvider import PhysicalMachinesProvider
|
||||
|
||||
# Now we use __subclasses__ method to locate Service Providers
|
||||
# and register them inside factory
|
||||
#ServiceProviderFactory.factory().insert(PhysicalMachinesProvider)
|
||||
# ServiceProviderFactory.factory().insert(PhysicalMachinesProvider)
|
||||
|
@ -4,27 +4,27 @@
|
||||
# Copyright (c) 2012 Virtual Cable S.L.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# * Neither the name of Virtual Cable S.L. nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# * Neither the name of Virtual Cable S.L. nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
'''
|
||||
@ -35,7 +35,7 @@ Created on Jun 22, 2012
|
||||
|
||||
from django.utils.translation import ugettext_noop as _
|
||||
from uds.core.services import ServiceProvider
|
||||
from SampleService import ServiceOne, ServiceTwo
|
||||
from .SampleService import ServiceOne, ServiceTwo
|
||||
from uds.core.ui import gui
|
||||
|
||||
import logging
|
||||
@ -60,19 +60,19 @@ class Provider(ServiceProvider):
|
||||
we MUST register it at package __init__.
|
||||
|
||||
'''
|
||||
#: What kind of services we offer, this are classes inherited from Service
|
||||
# : What kind of services we offer, this are classes inherited from Service
|
||||
offers = [ServiceOne, ServiceTwo]
|
||||
#: Name to show the administrator. This string will be translated BEFORE
|
||||
#: sending it to administration interface, so don't forget to
|
||||
#: mark it as _ (using ugettext_noop)
|
||||
# : Name to show the administrator. This string will be translated BEFORE
|
||||
# : sending it to administration interface, so don't forget to
|
||||
# : mark it as _ (using ugettext_noop)
|
||||
typeName = _('Sample Provider')
|
||||
#: Type used internally to identify this provider
|
||||
# : Type used internally to identify this provider
|
||||
typeType = 'SampleProvider'
|
||||
#: Description shown at administration interface for this provider
|
||||
# : Description shown at administration interface for this provider
|
||||
typeDescription = _('Sample (and dummy) service provider')
|
||||
#: Icon file used as icon for this provider. This string will be translated
|
||||
#: BEFORE sending it to administration interface, so don't forget to
|
||||
#: mark it as _ (using ugettext_noop)
|
||||
# : Icon file used as icon for this provider. This string will be translated
|
||||
# : BEFORE sending it to administration interface, so don't forget to
|
||||
# : mark it as _ (using ugettext_noop)
|
||||
iconFile = 'provider.png'
|
||||
|
||||
# now comes the form fields
|
||||
@ -85,39 +85,39 @@ class Provider(ServiceProvider):
|
||||
# If we don't indicate an order, the output order of fields will be
|
||||
# "random"
|
||||
|
||||
#: Remote host. Here core will translate label and tooltip, remember to
|
||||
#: mark them as _ using ugettext_noop.
|
||||
# : Remote host. Here core will translate label and tooltip, remember to
|
||||
# : mark them as _ using ugettext_noop.
|
||||
remoteHost = gui.TextField(oder=1,
|
||||
length=64,
|
||||
label=_('Remote host'),
|
||||
tooltip=_('This fields contains a remote host'),
|
||||
required=True,
|
||||
)
|
||||
#: Name of your pet (sample, not really needed :-) )
|
||||
# : Name of your pet (sample, not really needed :-) )
|
||||
petName = gui.TextField(order=2,
|
||||
length=32,
|
||||
label=_('Your pet\'s name'),
|
||||
tooltip=_('If you like, write the name of your pet'),
|
||||
requred=False,
|
||||
defvalue='Tux' #: This will not get translated
|
||||
defvalue='Tux' # : This will not get translated
|
||||
)
|
||||
#: Age of Methuselah (matusalén in spanish)
|
||||
#: in Spain there is a well-known to say that something is very old,
|
||||
#: "Tiene mas años que matusalén"(is older than Methuselah)
|
||||
# : Age of Methuselah (matusalén in spanish)
|
||||
# : in Spain there is a well-known to say that something is very old,
|
||||
# : "Tiene mas años que matusalén"(is older than Methuselah)
|
||||
methAge = gui.NumericField(order=3,
|
||||
length=4, # That is, max allowed value is 9999
|
||||
label=_('Age of Methuselah'),
|
||||
tooltip=_('If you know it, please, tell me!!!'),
|
||||
required=True, #: Numeric fields have always a value, so this not really needed
|
||||
required=True, # : Numeric fields have always a value, so this not really needed
|
||||
defvalue='4500'
|
||||
)
|
||||
|
||||
#: Is Methuselah istill alive?
|
||||
# : Is Methuselah istill alive?
|
||||
methAlive = gui.CheckBoxField(order=4,
|
||||
label=_('Is Methuselah still alive?'),
|
||||
tooltip=_('If you fail, this will not get saved :-)'),
|
||||
required=True, #: Also means nothing. Check boxes has always a value
|
||||
defvalue=gui.TRUE #: By default, at new item, check this
|
||||
required=True, # : Also means nothing. Check boxes has always a value
|
||||
defvalue=gui.TRUE # : By default, at new item, check this
|
||||
)
|
||||
|
||||
# There is more fields type, but not here the best place to cover it
|
||||
|
@ -4,27 +4,27 @@
|
||||
# Copyright (c) 2012 Virtual Cable S.L.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# * Neither the name of Virtual Cable S.L. nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# * Neither the name of Virtual Cable S.L. nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
'''
|
||||
@ -33,9 +33,9 @@
|
||||
|
||||
from django.utils.translation import ugettext_noop as _
|
||||
from uds.core.services import Service
|
||||
from SamplePublication import SamplePublication
|
||||
from SampleUserDeploymentOne import SampleUserDeploymentOne
|
||||
from SampleUserDeploymentTwo import SampleUserDeploymentTwo
|
||||
from .SamplePublication import SamplePublication
|
||||
from .SampleUserDeploymentOne import SampleUserDeploymentOne
|
||||
from .SampleUserDeploymentTwo import SampleUserDeploymentTwo
|
||||
|
||||
from uds.core.ui import gui
|
||||
|
||||
@ -46,189 +46,189 @@ logger = logging.getLogger(__name__)
|
||||
class ServiceOne(Service):
|
||||
'''
|
||||
Basic service, the first part (variables) include the description of the service.
|
||||
|
||||
|
||||
Remember to fill all variables needed, but at least you must define:
|
||||
* typeName
|
||||
* typeType
|
||||
* typeDescription
|
||||
* iconFile (defaults to service.png)
|
||||
* publicationType, type of publication in case it needs publication.
|
||||
If this is not provided, core will assume that the service do not
|
||||
* publicationType, type of publication in case it needs publication.
|
||||
If this is not provided, core will assume that the service do not
|
||||
needs publishing.
|
||||
* deployedType, type of deployed user service. Do not forget this!!!
|
||||
|
||||
|
||||
The rest of them can be ommited, but its recommended that you fill all
|
||||
declarations shown in this sample (that in fact, are all)
|
||||
|
||||
|
||||
This description informs the core what this service really provides,
|
||||
and how this is done. Look at description of class variables for more
|
||||
information.
|
||||
|
||||
'''
|
||||
#: Name to show the administrator. This string will be translated BEFORE
|
||||
#: sending it to administration interface, so don't forget to
|
||||
#: mark it as _ (using ugettext_noop)
|
||||
typeName = _('Sample Service One')
|
||||
#: Type used internally to identify this provider
|
||||
typeType = 'SampleService1'
|
||||
#: Description shown at administration interface for this provider
|
||||
typeDescription = _('Sample (and dummy) service ONE')
|
||||
#: Icon file used as icon for this provider. This string will be translated
|
||||
#: BEFORE sending it to administration interface, so don't forget to
|
||||
#: mark it as _ (using ugettext_noop)
|
||||
iconFile = 'service.png'
|
||||
|
||||
# Functional related data
|
||||
|
||||
#: If the service provides more than 1 "deployed user" (-1 = no limit,
|
||||
#: 0 = ???? (do not use it!!!), N = max number to deploy
|
||||
maxDeployed = -1
|
||||
#: If we need to generate "cache" for this service, so users can access the
|
||||
#: provided services faster. Is usesCache is True, you will need also
|
||||
#: set publicationType, do take care about that!
|
||||
usesCache = False
|
||||
#: Tooltip shown to user when this item is pointed at admin interface, none
|
||||
#: because we don't use it
|
||||
cacheTooltip = _('None')
|
||||
#: If we need to generate a "Level 2" cache for this service (i.e., L1
|
||||
#: could be running machines and L2 suspended machines)
|
||||
usesCache_L2 = False
|
||||
#: Tooltip shown to user when this item is pointed at admin interface, None
|
||||
#: also because we don't use it
|
||||
cacheTooltip_L2 = _('None')
|
||||
|
||||
#: If the service needs a s.o. manager (managers are related to agents
|
||||
#: provided by services itselfs, i.e. virtual machines with actors)
|
||||
needsManager = False
|
||||
#: If true, the system can't do an automatic assignation of a deployed user
|
||||
#: service from this service
|
||||
mustAssignManually = False
|
||||
|
||||
#: Types of publications (preparated data for deploys)
|
||||
#: In our case, we do no need a publication, so this is None
|
||||
'''
|
||||
# : Name to show the administrator. This string will be translated BEFORE
|
||||
# : sending it to administration interface, so don't forget to
|
||||
# : mark it as _ (using ugettext_noop)
|
||||
typeName = _('Sample Service One')
|
||||
# : Type used internally to identify this provider
|
||||
typeType = 'SampleService1'
|
||||
# : Description shown at administration interface for this provider
|
||||
typeDescription = _('Sample (and dummy) service ONE')
|
||||
# : Icon file used as icon for this provider. This string will be translated
|
||||
# : BEFORE sending it to administration interface, so don't forget to
|
||||
# : mark it as _ (using ugettext_noop)
|
||||
iconFile = 'service.png'
|
||||
|
||||
# Functional related data
|
||||
|
||||
# : If the service provides more than 1 "deployed user" (-1 = no limit,
|
||||
# : 0 = ???? (do not use it!!!), N = max number to deploy
|
||||
maxDeployed = -1
|
||||
# : If we need to generate "cache" for this service, so users can access the
|
||||
# : provided services faster. Is usesCache is True, you will need also
|
||||
# : set publicationType, do take care about that!
|
||||
usesCache = False
|
||||
# : Tooltip shown to user when this item is pointed at admin interface, none
|
||||
# : because we don't use it
|
||||
cacheTooltip = _('None')
|
||||
# : If we need to generate a "Level 2" cache for this service (i.e., L1
|
||||
# : could be running machines and L2 suspended machines)
|
||||
usesCache_L2 = False
|
||||
# : Tooltip shown to user when this item is pointed at admin interface, None
|
||||
# : also because we don't use it
|
||||
cacheTooltip_L2 = _('None')
|
||||
|
||||
# : If the service needs a s.o. manager (managers are related to agents
|
||||
# : provided by services itselfs, i.e. virtual machines with actors)
|
||||
needsManager = False
|
||||
# : If true, the system can't do an automatic assignation of a deployed user
|
||||
# : service from this service
|
||||
mustAssignManually = False
|
||||
|
||||
# : Types of publications (preparated data for deploys)
|
||||
# : In our case, we do no need a publication, so this is None
|
||||
publicationType = None
|
||||
#: Types of deploys (services in cache and/or assigned to users)
|
||||
# : Types of deploys (services in cache and/or assigned to users)
|
||||
deployedType = SampleUserDeploymentOne
|
||||
|
||||
|
||||
# Now the form part, this service will have only two "dummy" fields
|
||||
# If we don't indicate an order, the output order of fields will be
|
||||
# "random"
|
||||
|
||||
colour = gui.ChoiceField(order = 1,
|
||||
label = _('Colour'),
|
||||
tooltip = _('Colour of the field'),
|
||||
|
||||
colour = gui.ChoiceField(order=1,
|
||||
label=_('Colour'),
|
||||
tooltip=_('Colour of the field'),
|
||||
# In this case, the choice can have none value selected by default
|
||||
required = True,
|
||||
values = [ gui.choiceItem('red', 'Red'),
|
||||
required=True,
|
||||
values=[ gui.choiceItem('red', 'Red'),
|
||||
gui.choiceItem('green', 'Green'),
|
||||
gui.choiceItem('blue', 'Blue'),
|
||||
gui.choiceItem('nonsense', 'Blagenta')
|
||||
],
|
||||
defvalue = '1' # Default value is the ID of the choicefield
|
||||
defvalue='1' # Default value is the ID of the choicefield
|
||||
)
|
||||
|
||||
passw = gui.PasswordField(order = 2,
|
||||
label = _('Password'),
|
||||
tooltip = _('Password for testing purposes'),
|
||||
required = True,
|
||||
defvalue = '1234' #: Default password are nonsense?? :-)
|
||||
|
||||
passw = gui.PasswordField(order=2,
|
||||
label=_('Password'),
|
||||
tooltip=_('Password for testing purposes'),
|
||||
required=True,
|
||||
defvalue='1234' # : Default password are nonsense?? :-)
|
||||
)
|
||||
|
||||
baseName = gui.TextField(order = 3,
|
||||
label = _('Services names'),
|
||||
tooltip = _('Base name for this user services'),
|
||||
baseName = gui.TextField(order=3,
|
||||
label=_('Services names'),
|
||||
tooltip=_('Base name for this user services'),
|
||||
# In this case, the choice can have none value selected by default
|
||||
required = True,
|
||||
defvalue = '' # Default value is the ID of the choicefield
|
||||
required=True,
|
||||
defvalue='' # Default value is the ID of the choicefield
|
||||
)
|
||||
|
||||
|
||||
def initialize(self, values):
|
||||
'''
|
||||
We check here form values to see if they are valid.
|
||||
|
||||
|
||||
Note that we check them throught FROM variables, that already has been
|
||||
initialized by __init__ method of base class, before invoking this.
|
||||
'''
|
||||
|
||||
|
||||
# We don't need to check anything, bat because this is a sample, we do
|
||||
# As in provider, we receive values only at new Service creation,
|
||||
# so we only need to validate params if values is not None
|
||||
if values is not None:
|
||||
if self.colour.value == 'nonsense':
|
||||
raise Service.ValidationException('The selected colour is invalid!!!')
|
||||
|
||||
|
||||
|
||||
|
||||
# Services itself are non testeable right now, so we don't even have
|
||||
# to provide one!!!
|
||||
|
||||
|
||||
|
||||
# Congratulations!!!, the needed part of your first simple service is done!
|
||||
# Now you can go to administration panel, and check it
|
||||
#
|
||||
# From now onwards, we implement our own methods, that will be used by,
|
||||
# From now onwards, we implement our own methods, that will be used by,
|
||||
# for example, services derived from this provider
|
||||
|
||||
|
||||
def getColour(self):
|
||||
'''
|
||||
Simply returns colour, for deployed user services.
|
||||
|
||||
|
||||
Remember that choiceField.value returns the id part of the ChoiceItem
|
||||
'''
|
||||
return self.colour.value
|
||||
|
||||
|
||||
def getPassw(self):
|
||||
'''
|
||||
Simply returns passwd, for deloyed user services
|
||||
'''
|
||||
return self.passw.value
|
||||
|
||||
|
||||
def getBaseName(self):
|
||||
'''
|
||||
'''
|
||||
return self.baseName.value
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class ServiceTwo(Service):
|
||||
'''
|
||||
Just a second service, no comments here (almost same that ServiceOne
|
||||
'''
|
||||
typeName = _('Sample Service Two')
|
||||
typeName = _('Sample Service Two')
|
||||
typeType = 'SampleService2'
|
||||
typeDescription = _('Sample (and dummy) service ONE+ONE')
|
||||
iconFile = 'provider.png' #: We reuse provider icon here :-)
|
||||
|
||||
iconFile = 'provider.png' # : We reuse provider icon here :-)
|
||||
|
||||
# Functional related data
|
||||
maxDeployed = 5
|
||||
usesCache = True
|
||||
cacheTooltip = _('L1 cache for dummy elements')
|
||||
usesCache_L2 = True
|
||||
cacheTooltip_L2 = _('L2 cache for dummy elements')
|
||||
|
||||
|
||||
needsManager = False
|
||||
mustAssignManually = False
|
||||
|
||||
#: Types of publications. In this case, we will include a publication
|
||||
#: type for this one
|
||||
#: Note that this is a MUST if you indicate that needPublication
|
||||
# : Types of publications. In this case, we will include a publication
|
||||
# : type for this one
|
||||
# : Note that this is a MUST if you indicate that needPublication
|
||||
publicationType = SamplePublication
|
||||
#: Types of deploys (services in cache and/or assigned to users)
|
||||
# : Types of deploys (services in cache and/or assigned to users)
|
||||
deployedType = SampleUserDeploymentTwo
|
||||
|
||||
|
||||
|
||||
|
||||
# Gui, we will use here the EditableList field
|
||||
names = gui.EditableList(label=_('List of names'))
|
||||
|
||||
def __init__(self, environment, parent, values = None):
|
||||
|
||||
def __init__(self, environment, parent, values=None):
|
||||
'''
|
||||
We here can get a HUGE list from client.
|
||||
Right now, this is treated same as other fields, in a near
|
||||
future we will se how to handle this better
|
||||
'''
|
||||
super(ServiceTwo, self).__init__(environment, parent, values)
|
||||
|
||||
|
||||
# No checks here
|
||||
|
||||
|
||||
def getNames(self):
|
||||
'''
|
||||
For using at deployed services, really nothing
|
||||
|
@ -4,41 +4,41 @@
|
||||
# Copyright (c) 2012 Virtual Cable S.L.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# * Neither the name of Virtual Cable S.L. nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# * Neither the name of Virtual Cable S.L. nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
'''
|
||||
Sample Service module.
|
||||
|
||||
This package simply shows how a new service can be implemented.
|
||||
This package simply shows how a new service can be implemented.
|
||||
|
||||
|
||||
The first thing to do in every package that is a module is register the
|
||||
The first thing to do in every package that is a module is register the
|
||||
class that is responsible of providing the module with the system.
|
||||
|
||||
For this, we must simply import the class at __init__, UDS will take care
|
||||
of the rest
|
||||
'''
|
||||
|
||||
from SampleProvider import Provider
|
||||
from .SampleProvider import Provider
|
||||
|
||||
|
@ -37,7 +37,7 @@ from uds.core.util import log
|
||||
|
||||
from uds.services.Xen.xen_client import XenPowerState
|
||||
|
||||
import cPickle
|
||||
import pickle
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -76,7 +76,7 @@ class XenLinkedDeployment(UserDeployment):
|
||||
'''
|
||||
Does nothing right here, we will use envoronment storage in this sample
|
||||
'''
|
||||
return '\1'.join(['v1', self._name, self._ip, self._mac, self._vmid, self._reason, cPickle.dumps(self._queue), self._task])
|
||||
return '\1'.join(['v1', self._name, self._ip, self._mac, self._vmid, self._reason, pickle.dumps(self._queue), self._task])
|
||||
|
||||
def unmarshal(self, str_):
|
||||
'''
|
||||
@ -85,7 +85,7 @@ class XenLinkedDeployment(UserDeployment):
|
||||
vals = str_.split('\1')
|
||||
if vals[0] == 'v1':
|
||||
self._name, self._ip, self._mac, self._vmid, self._reason, queue, self._task = vals[1:]
|
||||
self._queue = cPickle.loads(queue)
|
||||
self._queue = pickle.loads(queue)
|
||||
|
||||
def getName(self):
|
||||
'''
|
||||
|
Loading…
Reference in New Issue
Block a user