1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-27 14:03:53 +03:00

Created Azure publication

This commit is contained in:
Adolfo Gómez García 2018-06-08 01:36:35 +02:00
parent 9906b80702
commit b0268346e5
6 changed files with 26 additions and 12 deletions

View File

@ -196,7 +196,7 @@ class Module(UserInterface, Environmentable, Serializable):
'''
return [True, _("No connection checking method is implemented.")]
def __init__(self, environment, values=None):
def __init__(self, environment, values=None, uuid=None):
'''
Do not forget to invoke this in your derived class using
"super(self.__class__, self).__init__(environment, values)".
@ -223,6 +223,7 @@ class Module(UserInterface, Environmentable, Serializable):
UserInterface.__init__(self, values)
Environmentable.__init__(self, environment)
Serializable.__init__(self)
self._uuid = uuid if uuid is not None else ''
def __str__(self):
return "Base Module"
@ -265,6 +266,9 @@ class Module(UserInterface, Environmentable, Serializable):
'''
return _("No check method provided.")
def getUuid(self):
return self._uuid
def destroy(self):
'''
Invoked before deleting an module from database.

View File

@ -36,7 +36,7 @@ from uds.core import Environmentable
from uds.core import Serializable
from uds.core.util.State import State
__updated__ = '2018-03-14'
__updated__ = '2018-06-07'
class UserDeployment(Environmentable, Serializable):
@ -138,6 +138,7 @@ class UserDeployment(Environmentable, Serializable):
self._publication = kwargs.get('publication', None)
self._osmanager = kwargs.get('osmanager', None)
self._dbService = kwargs.get('dbservice', None)
self._uuid = kwargs.get('uuid', '')
self.initialize()
@ -196,6 +197,9 @@ class UserDeployment(Environmentable, Serializable):
'''
return self._osmanager
def getUuid(self):
return self._uuid
def dbservice(self):
'''
Utility method to access database object for the object this represents.

View File

@ -35,7 +35,7 @@ from __future__ import unicode_literals
from uds.core import Environmentable
from uds.core import Serializable
__updated__ = '2016-02-26'
__updated__ = '2018-06-07'
class Publication(Environmentable, Serializable):
@ -90,6 +90,7 @@ class Publication(Environmentable, Serializable):
self._service = kwargs['service'] # Raises an exception if service is not included
self._revision = kwargs.get('revision', -1)
self._dsName = kwargs.get('dsName', 'Unknown')
self._uuid = kwargs.get('uuid', '')
self.initialize()
@ -141,6 +142,11 @@ class Publication(Environmentable, Serializable):
'''
return self._dsName
def getUuid(self):
"""
"""
return self._uuid
def publish(self):
'''
This method is invoked whenever the administrator requests a new publication.

View File

@ -37,7 +37,7 @@ from uds.core import Module
from uds.core.transports import protocols
from . import types
__updated__ = '2018-03-14'
__updated__ = '2018-06-07'
class Service(Module):
@ -175,13 +175,13 @@ class Service(Module):
# : For example, VDI, VAPP, ...
servicesTypeProvided = types.ALL
def __init__(self, environment, parent, values=None):
def __init__(self, environment, parent, values=None, uuid=None):
'''
Do not forget to invoke this in your derived class using "super(self.__class__, self).__init__(environment, parent, values)".
We want to use the env, parent methods outside class. If not called, you must implement your own methods
cache and storage are "convenient" methods to access _env.cache and _env.storage
'''
super(Service, self).__init__(environment, values)
super(Service, self).__init__(environment, values, uuid=uuid)
self._provider = parent
self.initialize(values)

View File

@ -39,7 +39,7 @@ import logging
logger = logging.getLogger(__name__)
__updated__ = '2018-03-14'
__updated__ = '2018-06-07'
class ServiceProvider(Module):
@ -144,7 +144,7 @@ class ServiceProvider(Module):
break
return res
def __init__(self, environment, values=None):
def __init__(self, environment, values=None, uuid=None):
'''
Do not forget to invoke this in your derived class using "super(self.__class__, self).__init__(environment, values)"
if you override this method. Better is to provide an "__initialize__" method, that will be invoked
@ -152,7 +152,7 @@ class ServiceProvider(Module):
Values parameter is provided (are not None) when creating or modifying the service provider, so params check should ocur here and, if not
valid, raise an "ValidationException" message
'''
super(ServiceProvider, self).__init__(environment, values)
super(ServiceProvider, self).__init__(environment, values, uuid=uuid)
self.initialize(values)
def initialize(self, values):

View File

@ -47,8 +47,7 @@ from uds.models.UUIDModel import UUIDModel
import logging
__updated__ = '2016-03-29'
__updated__ = '2018-06-07'
logger = logging.getLogger(__name__)
@ -134,7 +133,7 @@ class DeployedServicePublication(UUIDModel):
if serviceInstance.publicationType is None:
raise Exception('Class {0} do not have defined publicationType but needs to be published!!!'.format(serviceInstance.__class__))
dpl = serviceInstance.publicationType(self.getEnvironment(), service=serviceInstance, osManager=osManagerInstance, revision=self.revision, dsName=self.deployed_service.name)
dpl = serviceInstance.publicationType(self.getEnvironment(), service=serviceInstance, osManager=osManagerInstance, revision=self.revision, dsName=self.deployed_service.name, uuid=self.uuid)
# Only invokes deserialization if data has something. '' is nothing
if self.data != '' and self.data is not None:
dpl.unserialize(self.data)
@ -205,6 +204,7 @@ class DeployedServicePublication(UUIDModel):
def __str__(self):
return 'Publication {0}, rev {1}, state {2}'.format(self.deployed_service.name, self.revision, State.toString(self.state))
# Connects a pre deletion signal to Authenticator
signals.pre_delete.connect(DeployedServicePublication.beforeDelete, sender=DeployedServicePublication)