1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-08 21:18:00 +03:00

* Started to add a "reason" for publication (an small changelog that

helps to keep track of reasonf for launching new publications)
* Removed non usable "Usage" report
This commit is contained in:
Adolfo Gómez García 2015-06-12 10:21:46 +02:00
parent e07f1ae068
commit 3ff281ffa3
6 changed files with 22 additions and 8 deletions

View File

@ -274,6 +274,8 @@ class Publications(DetailHandler):
Custom method "publish", provided to initiate a publication of a deployed service
:param parent: Parent service pool
'''
changeLog = self._params['changelog'] if 'changelog' in self._params else None
if permissions.checkPermissions(self._user, parent, permissions.PERMISSION_MANAGEMENT) is False:
logger.debug('Management Permission failed for user {}'.format(self._user))
self.accessDenied()

View File

@ -193,7 +193,7 @@ class PublicationManager(object):
PublicationManager._manager = PublicationManager()
return PublicationManager._manager
def publish(self, servicePool): # pylint: disable=no-self-use
def publish(self, servicePool, changeLog=None): # pylint: disable=no-self-use
'''
Initiates the publication of a service pool, or raises an exception if this cannot be done
:param servicePool: Service pool object (db object)
@ -208,6 +208,8 @@ class PublicationManager(object):
now = getSqlDatetime()
dsp = None
dsp = servicePool.publications.create(state=State.LAUNCHING, state_date=now, publish_date=now, revision=servicePool.current_pub_revision)
if changeLog:
dsp.changelog.create(revision=servicePool.current_pub_revision, log=changeLog)
DelayedTaskRunner.runner().insert(PublicationLauncher(dsp), 4, PUBTAG + str(dsp.id))
except Exception as e:
logger.debug('Caught exception at publish: {0}'.format(e))

View File

@ -55,7 +55,7 @@ from uds.models.Util import getSqlDatetime
from datetime import timedelta
import logging
__updated__ = '2015-05-01'
__updated__ = '2015-06-12'
logger = logging.getLogger(__name__)
@ -326,14 +326,14 @@ class DeployedService(UUIDModel):
# And generate a single list without duplicates
return list(set([r for r in list1] + [r for r in list2]))
def publish(self):
def publish(self, changeLog=None):
'''
Launches the publication of this deployed service.
No check is done, it simply redirects the request to PublicationManager, where checks are done.
'''
from uds.core.managers.PublicationManager import PublicationManager
PublicationManager.manager().publish(self)
PublicationManager.manager().publish(self, changeLog)
def unpublish(self):
'''

View File

@ -37,10 +37,11 @@ from django.utils.translation import ugettext, ugettext_noop as _
from .base import StatsReport
__updated__ = '2015-04-28'
__updated__ = '2015-06-10'
class StatsReportUsage(StatsReport):
class StatsReportUsage(object): # Disabled from being used
# class StatsReportUsage(StatsReport):
name = _('Usage stats') # Report name
description = _('Statistics of platform use') # Report description
uuid = '9ae54172-ed48-11e4-b8e1-10feed05884b'

View File

@ -10,7 +10,7 @@ from ovirtsdk.api import API
import threading
import logging
__updated__ = '2015-06-09'
__updated__ = '2015-06-12'
logger = logging.getLogger(__name__)
@ -65,7 +65,7 @@ class Client(object):
pass
try:
cached_api_key = aKey
cached_api = API(url='https://' + self._host + '/api', username=self._username, password=self._password, timeout=self._timeout, insecure=True, debug=True)
cached_api = API(url='https://' + self._host + '/api', username=self._username, password=self._password, timeout=self._timeout, insecure=True, debug=False)
return cached_api
except:
logger.exception('Exception connection ovirt at {0}'.format(self._host))

View File

@ -0,0 +1,9 @@
{% load i18n html5 %}
{% image_size as size %}
<h3 class="text-center">{% trans 'Publish service' %}</h3>
<div class="center-block" style="width: 60%">
<div class="form-group">
<label for="id_publish_log" class="col-sm-3 control-label" data-toggle="tooltip" data-title="{% trans 'reason of publication'%}">{% trans 'Reason' %}</label>
<input id="id_publish_log" name="image_name" type="text" class="form-control" placeholder="{% trans 'Image name' %}" autofocus required>
</div>
</div>