Commit 215075e2 by Szeberényi Imre

unicode->bytes fix:

  using unicode as it was used in the 2.7 version and
  adding ptyhon 2 & 3 compatible init snipet
introducing celeryconfig.py
parent ae937cd9
...@@ -8,6 +8,11 @@ from django.core.exceptions import ImproperlyConfigured ...@@ -8,6 +8,11 @@ from django.core.exceptions import ImproperlyConfigured
from ..models import Level, AclBase from ..models import Level, AclBase
try:
# Python 2: "unicode" is built-in
unicode
except NameError:
unicode = str
def create_levels(app_config, verbosity=False, using=DEFAULT_DB_ALIAS, def create_levels(app_config, verbosity=False, using=DEFAULT_DB_ALIAS,
**kwargs): **kwargs):
...@@ -61,10 +66,10 @@ def create_levels(app_config, verbosity=False, using=DEFAULT_DB_ALIAS, ...@@ -61,10 +66,10 @@ def create_levels(app_config, verbosity=False, using=DEFAULT_DB_ALIAS,
] ]
Level.objects.using(using).bulk_create(levels) Level.objects.using(using).bulk_create(levels)
if verbosity >= 2: if verbosity >= 2:
print(("Adding levels [%s]." % ", ".join(bytes(l) for l in levels))) print(("Adding levels [%s]." % ", ".join(unicode(l) for l in levels)))
print(("Searched: [%s]." % ", ".join( print(("Searched: [%s]." % ", ".join(
bytes(l) for l in searched_levels))) unicode(l) for l in searched_levels)))
print(("All: [%s]." % ", ".join(bytes(l) for l in all_levels))) print(("All: [%s]." % ", ".join(unicode(l) for l in all_levels)))
# set weights # set weights
for ctype, codename, weight in level_weights: for ctype, codename, weight in level_weights:
......
...@@ -26,6 +26,14 @@ from django.db.models import ( ...@@ -26,6 +26,14 @@ from django.db.models import (
ManyToManyField, ForeignKey, CharField, Model, IntegerField, Q ManyToManyField, ForeignKey, CharField, Model, IntegerField, Q
) )
from django.db import models from django.db import models
try:
# Python 2: "unicode" is built-in
unicode
except NameError:
unicode = str
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -40,7 +48,7 @@ class Level(Model): ...@@ -40,7 +48,7 @@ class Level(Model):
weight = IntegerField('weight', null=True) weight = IntegerField('weight', null=True)
def __str__(self): def __str__(self):
return "<%s/%s>" % (bytes(self.content_type), self.name) return "<%s/%s>" % (unicode(self.content_type), self.name)
class Meta: class Meta:
app_label = 'acl' app_label = 'acl'
...@@ -61,7 +69,7 @@ class ObjectLevel(Model): ...@@ -61,7 +69,7 @@ class ObjectLevel(Model):
groups = ManyToManyField(Group) groups = ManyToManyField(Group)
def __str__(self): def __str__(self):
return "<%s: %s>" % (bytes(self.content_object), bytes(self.level)) return "<%s: %s>" % (unicode(self.content_object), unicode(self.level))
class Meta: class Meta:
app_label = 'acl' app_label = 'acl'
...@@ -143,7 +151,7 @@ class AclBase(Model): ...@@ -143,7 +151,7 @@ class AclBase(Model):
:type level: str or unicode :type level: str or unicode
""" """
logger.info('%s.set_group_level(%s, %s) called', logger.info('%s.set_group_level(%s, %s) called',
*[bytes(p) for p in [self, group, level]]) *[unicode(p) for p in [self, group, level]])
if level is None: if level is None:
pk = None pk = None
else: else:
...@@ -160,7 +168,7 @@ class AclBase(Model): ...@@ -160,7 +168,7 @@ class AclBase(Model):
i.save() i.save()
def has_level(self, user, level, group_also=True): def has_level(self, user, level, group_also=True):
# logger.debug('%s.has_level(%s, %s, %s) called', *[bytes(p) for p in [self, user, level, group_also]]) # logger.debug('%s.has_level(%s, %s, %s) called', *[unicode(p) for p in [self, user, level, group_also]])
if user is None or not user.is_authenticated: if user is None or not user.is_authenticated:
return False return False
if getattr(user, 'is_superuser', False): if getattr(user, 'is_superuser', False):
...@@ -168,7 +176,7 @@ class AclBase(Model): ...@@ -168,7 +176,7 @@ class AclBase(Model):
return True return True
if isinstance(level, str): if isinstance(level, str):
level = self.get_level_object(level) level = self.get_level_object(level)
logger.debug("- level set by str: %s", bytes(level)) logger.debug("- level set by str: %s", unicode(level))
object_levels = self.object_level_set.filter( object_levels = self.object_level_set.filter(
level__weight__gte=level.weight).all() level__weight__gte=level.weight).all()
...@@ -181,7 +189,7 @@ class AclBase(Model): ...@@ -181,7 +189,7 @@ class AclBase(Model):
return False return False
def get_users_with_level(self, **kwargs): def get_users_with_level(self, **kwargs):
# logger.debug('%s.get_users_with_level() called', bytes(self)) # logger.debug('%s.get_users_with_level() called', unicode(self))
object_levels = (self.object_level_set.filter(**kwargs).select_related( object_levels = (self.object_level_set.filter(**kwargs).select_related(
'level').prefetch_related('users').all()) 'level').prefetch_related('users').all())
users = [] users = []
...@@ -193,7 +201,7 @@ class AclBase(Model): ...@@ -193,7 +201,7 @@ class AclBase(Model):
return users return users
def get_groups_with_level(self): def get_groups_with_level(self):
# logger.debug('%s.get_groups_with_level() called', bytes(self)) # logger.debug('%s.get_groups_with_level() called', unicode(self))
object_levels = (self.object_level_set.select_related( object_levels = (self.object_level_set.select_related(
'level').prefetch_related('groups').all()) 'level').prefetch_related('groups').all())
groups = [] groups = []
...@@ -208,7 +216,7 @@ class AclBase(Model): ...@@ -208,7 +216,7 @@ class AclBase(Model):
def get_objects_with_level(cls, level, user, def get_objects_with_level(cls, level, user,
group_also=True, owner_also=False, group_also=True, owner_also=False,
disregard_superuser=False): disregard_superuser=False):
# logger.debug('%s.get_objects_with_level(%s,%s) called', str(cls), bytes(level), bytes(user)) # logger.debug('%s.get_objects_with_level(%s,%s) called', str(cls), unicode(level), unicode(user))
if user is None or not user.is_authenticated: if user is None or not user.is_authenticated:
return cls.objects.none() return cls.objects.none()
if getattr(user, 'is_superuser', False) and not disregard_superuser: if getattr(user, 'is_superuser', False) and not disregard_superuser:
...@@ -216,7 +224,7 @@ class AclBase(Model): ...@@ -216,7 +224,7 @@ class AclBase(Model):
return cls.objects.all() return cls.objects.all()
if isinstance(level, str): if isinstance(level, str):
level = cls.get_level_object(level) level = cls.get_level_object(level)
# logger.debug("- level set by str: %s", bytes(level)) # logger.debug("- level set by str: %s", unicode(level))
ct = ContentType.objects.get_for_model(cls) ct = ContentType.objects.get_for_model(cls)
levelfilter = Q(users=user) levelfilter = Q(users=user)
......
CELERY_RESULT_BACKEND = 'amqp://'
CELERY_TASK_RESULT_EXPIRES = 300
CELERY_TIMEZONE = 'UTC'
CELERY_ENABLE_UTC = True
CELERY_ACCEPT_CONTENT = ['pickle', 'json', 'msgpack', 'yaml']
...@@ -14,8 +14,8 @@ def update_permissions_after_migration(sender, **kwargs): ...@@ -14,8 +14,8 @@ def update_permissions_after_migration(sender, **kwargs):
from django.conf import settings from django.conf import settings
from django.apps import apps from django.apps import apps
from django.contrib.auth.management import create_permissions from django.contrib.auth.management import create_permissions
v = 2 if settings.DEBUG else 0
create_permissions(sender, apps.get_models(), 2 if settings.DEBUG else 0) create_permissions(sender, v, apps.get_models())
post_migrate.connect(update_permissions_after_migration) post_migrate.connect(update_permissions_after_migration)
...@@ -84,7 +84,8 @@ def activitycontextimpl(act, on_abort=None, on_commit=None): ...@@ -84,7 +84,8 @@ def activitycontextimpl(act, on_abort=None, on_commit=None):
raise raise
except: except:
logger.exception("Failed activity %s" % str(act)) logger.exception("Failed activity %s" % str(act))
handler = None if on_abort is None else lambda a: on_abort(a, e) handler = None
# handler = None if on_abort is None else lambda a: on_abort(a, e)
act.finish(succeeded=False, result=result, event_handler=handler) act.finish(succeeded=False, result=result, event_handler=handler)
raise raise
else: else:
......
...@@ -51,6 +51,14 @@ from vm.models.instance import ACCESS_METHODS ...@@ -51,6 +51,14 @@ from vm.models.instance import ACCESS_METHODS
from .store_api import Store, NoStoreException, NotOkException from .store_api import Store, NoStoreException, NotOkException
from .validators import connect_command_template_validator from .validators import connect_command_template_validator
try:
# Python 2: "unicode" is built-in
unicode
except NameError:
unicode = str
logger = getLogger(__name__) logger = getLogger(__name__)
...@@ -420,11 +428,11 @@ if hasattr(settings, 'SAML_ORG_ID_ATTRIBUTE'): ...@@ -420,11 +428,11 @@ if hasattr(settings, 'SAML_ORG_ID_ATTRIBUTE'):
value = attributes[atr][0].upper() value = attributes[atr][0].upper()
except Exception as e: except Exception as e:
value = None value = None
logger.info("save_org_id couldn't find attribute. %s", bytes(e)) logger.info("save_org_id couldn't find attribute. %s", unicode(e))
if instance.pk is None: if instance.pk is None:
instance.save() instance.save()
logger.debug("save_org_id saved user %s", bytes(instance)) logger.debug("save_org_id saved user %s", unicode(instance))
profile, created = Profile.objects.get_or_create(user=instance) profile, created = Profile.objects.get_or_create(user=instance)
if created or profile.org_id != value: if created or profile.org_id != value:
...@@ -444,7 +452,7 @@ if hasattr(settings, 'SAML_ORG_ID_ATTRIBUTE'): ...@@ -444,7 +452,7 @@ if hasattr(settings, 'SAML_ORG_ID_ATTRIBUTE'):
logger.debug('cant find membergroup %s', group) logger.debug('cant find membergroup %s', group)
else: else:
logger.debug('could find membergroup %s (%s)', logger.debug('could find membergroup %s (%s)',
group, bytes(g)) group, unicode(g))
g.user_set.add(instance) g.user_set.add(instance)
for i in FutureMember.objects.filter(org_id__iexact=value): for i in FutureMember.objects.filter(org_id__iexact=value):
...@@ -460,7 +468,7 @@ if hasattr(settings, 'SAML_ORG_ID_ATTRIBUTE'): ...@@ -460,7 +468,7 @@ if hasattr(settings, 'SAML_ORG_ID_ATTRIBUTE'):
logger.debug('cant find ownergroup %s', group) logger.debug('cant find ownergroup %s', group)
else: else:
logger.debug('could find ownergroup %s (%s)', logger.debug('could find ownergroup %s (%s)',
group, bytes(g)) group, unicode(g))
g.profile.set_level(instance, 'owner') g.profile.set_level(instance, 'owner')
return False # User did not change return False # User did not change
......
...@@ -28,6 +28,12 @@ from sizefield.utils import filesizeformat ...@@ -28,6 +28,12 @@ from sizefield.utils import filesizeformat
from storage.models import Disk from storage.models import Disk
try:
# Python 2: "unicode" is built-in
unicode
except NameError:
unicode = str
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -81,7 +87,7 @@ class Store(object): ...@@ -81,7 +87,7 @@ class Store(object):
timeout=timeout, **self.request_args) timeout=timeout, **self.request_args)
except Exception: except Exception:
logger.exception("Error in store %s loading %s", logger.exception("Error in store %s loading %s",
bytes(method), url) unicode(method), url)
raise raise
else: else:
if raise_status_code and response.status_code != codes.ok: if raise_status_code and response.status_code != codes.ok:
......
...@@ -28,6 +28,13 @@ from manager.mancelery import celery ...@@ -28,6 +28,13 @@ from manager.mancelery import celery
from ..models import Notification from ..models import Notification
from ..views import UnsubscribeFormView from ..views import UnsubscribeFormView
try:
# Python 2: "unicode" is built-in
unicode
except NameError:
unicode = str
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -46,7 +53,7 @@ def send_email_notifications(): ...@@ -46,7 +53,7 @@ def send_email_notifications():
for user, msgs in list(recipients.items()): for user, msgs in list(recipients.items()):
if (not user.profile or not user.email or not if (not user.profile or not user.email or not
user.profile.email_notifications): user.profile.email_notifications):
logger.debug("%s gets no notifications", bytes(user)) logger.debug("%s gets no notifications", unicode(user))
continue continue
with override(user.profile.preferred_language): with override(user.profile.preferred_language):
context = {'user': user.profile, 'messages': msgs, context = {'user': user.profile, 'messages': msgs,
...@@ -67,7 +74,7 @@ def send_email_notifications(): ...@@ -67,7 +74,7 @@ def send_email_notifications():
logger.error("Failed to send mail to %s", user, exc_info=True) logger.error("Failed to send mail to %s", user, exc_info=True)
else: else:
logger.info("Delivered notifications %s", logger.info("Delivered notifications %s",
" ".join(bytes(i.pk) for i in msgs)) " ".join(unicode(i.pk) for i in msgs))
for i in msgs: for i in msgs:
i.status = i.STATUS.delivered i.status = i.STATUS.delivered
i.save() i.save()
...@@ -22,6 +22,11 @@ from django.test import TestCase ...@@ -22,6 +22,11 @@ from django.test import TestCase
from ..models import Profile from ..models import Profile
from ..views import search_user from ..views import search_user
try:
# Python 2: "unicode" is built-in
unicode
except NameError:
unicode = str
class NotificationTestCase(TestCase): class NotificationTestCase(TestCase):
...@@ -40,8 +45,8 @@ class NotificationTestCase(TestCase): ...@@ -40,8 +45,8 @@ class NotificationTestCase(TestCase):
{'var': 'testme'}) {'var': 'testme'})
assert self.u1.notification_set.count() == c1 + 1 assert self.u1.notification_set.count() == c1 + 1
assert self.u2.notification_set.count() == c2 assert self.u2.notification_set.count() == c2
assert 'user1' in bytes(msg.message) assert 'user1' in unicode(msg.message)
assert 'testme' in bytes(msg.message) assert 'testme' in unicode(msg.message)
assert msg in self.u1.notification_set.all() assert msg in self.u1.notification_set.all()
......
...@@ -26,6 +26,11 @@ from django.http import HttpResponse ...@@ -26,6 +26,11 @@ from django.http import HttpResponse
from ..views import AclUpdateView from ..views import AclUpdateView
from ..models import Profile from ..models import Profile
try:
# Python 2: "unicode" is built-in
unicode
except NameError:
unicode = str
def highlight(field, q, none_wo_match=True): def highlight(field, q, none_wo_match=True):
""" """
...@@ -59,7 +64,7 @@ class AclUserAutocomplete(autocomplete.Select2ListView): ...@@ -59,7 +64,7 @@ class AclUserAutocomplete(autocomplete.Select2ListView):
if self.q: if self.q:
condition = Q() condition = Q()
for field in search_fields: for field in search_fields:
condition |= Q(**{field + '__icontains': bytes(self.q)}) condition |= Q(**{field + '__icontains': unicode(self.q)})
return list(qs.filter(condition)) return list(qs.filter(condition))
return [] return []
...@@ -68,8 +73,8 @@ class AclUserAutocomplete(autocomplete.Select2ListView): ...@@ -68,8 +73,8 @@ class AclUserAutocomplete(autocomplete.Select2ListView):
return self.filter(users, self.search_fields) return self.filter(users, self.search_fields)
def choice_displayed_text(self, choice): def choice_displayed_text(self, choice):
q = bytes(self.request.GET.get('q', '')) q = unicode(self.request.GET.get('q', ''))
name = highlight(bytes(choice), q, False) name = highlight(unicode(choice), q, False)
if isinstance(choice, User): if isinstance(choice, User):
extra_fields = [highlight(choice.get_full_name(), q, False), extra_fields = [highlight(choice.get_full_name(), q, False),
highlight(choice.email, q)] highlight(choice.email, q)]
...@@ -84,7 +89,7 @@ class AclUserAutocomplete(autocomplete.Select2ListView): ...@@ -84,7 +89,7 @@ class AclUserAutocomplete(autocomplete.Select2ListView):
def get(self, *args, **kwargs): def get(self, *args, **kwargs):
return HttpResponse(json.dumps({ return HttpResponse(json.dumps({
'results': [dict(id=bytes(r), text=self.choice_displayed_text(r)) 'results': [dict(id=unicode(r), text=self.choice_displayed_text(r))
for r in self.get_list()] for r in self.get_list()]
}), content_type="application/json") }), content_type="application/json")
......
...@@ -46,6 +46,12 @@ from ..models import FutureMember, GroupProfile ...@@ -46,6 +46,12 @@ from ..models import FutureMember, GroupProfile
from ..store_api import Store, NoStoreException from ..store_api import Store, NoStoreException
from ..tables import GroupListTable from ..tables import GroupListTable
try:
# Python 2: "unicode" is built-in
unicode
except NameError:
unicode = str
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -217,7 +223,7 @@ class GroupList(LoginRequiredMixin, SingleTableView): ...@@ -217,7 +223,7 @@ class GroupList(LoginRequiredMixin, SingleTableView):
return super(GroupList, self).get(*args, **kwargs) return super(GroupList, self).get(*args, **kwargs)
def get_queryset(self): def get_queryset(self):
# logger.debug('GroupList.get_queryset() called. User: %s', bytes(self.request.user)) # logger.debug('GroupList.get_queryset() called. User: %s', unicode(self.request.user))
profiles = GroupProfile.get_objects_with_level( profiles = GroupProfile.get_objects_with_level(
'operator', self.request.user) 'operator', self.request.user)
groups = Group.objects.filter(groupprofile__in=profiles) groups = Group.objects.filter(groupprofile__in=profiles)
......
...@@ -38,6 +38,14 @@ from braces.views import LoginRequiredMixin ...@@ -38,6 +38,14 @@ from braces.views import LoginRequiredMixin
from ..store_api import (Store, NoStoreException, from ..store_api import (Store, NoStoreException,
NotOkException) NotOkException)
try:
# Python 2: "unicode" is built-in
unicode
except NameError:
unicode = str
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -75,7 +83,7 @@ class StoreList(LoginRequiredMixin, TemplateView): ...@@ -75,7 +83,7 @@ class StoreList(LoginRequiredMixin, TemplateView):
messages.warning(self.request, _("Store has some problems now." messages.warning(self.request, _("Store has some problems now."
" Try again later.")) " Try again later."))
except Exception as e: except Exception as e:
logger.critical("Something is wrong with store: %s", bytes(e)) logger.critical("Something is wrong with store: %s", unicode(e))
messages.warning(self.request, _("Unknown store error.")) messages.warning(self.request, _("Unknown store error."))
return redirect("/") return redirect("/")
...@@ -183,7 +191,7 @@ def store_new_directory(request): ...@@ -183,7 +191,7 @@ def store_new_directory(request):
Store(request.user).new_folder(join(path, name)) Store(request.user).new_folder(join(path, name))
except Exception: except Exception:
logger.exception("Unable to create folder %s in %s for %s", logger.exception("Unable to create folder %s in %s for %s",
name, path, bytes(request.user)) name, path, unicode(request.user))
messages.error(request, _("Unable to create folder.")) messages.error(request, _("Unable to create folder."))
return redirect("%s?directory=%s" % ( return redirect("%s?directory=%s" % (
reverse("dashboard.views.store-list"), urlencode(path))) reverse("dashboard.views.store-list"), urlencode(path)))
...@@ -199,7 +207,7 @@ def store_refresh_toplist(request): ...@@ -199,7 +207,7 @@ def store_refresh_toplist(request):
quota = store.get_quota() quota = store.get_quota()
files = {'toplist': toplist, 'quota': quota} files = {'toplist': toplist, 'quota': quota}
except Exception: except Exception:
logger.exception("Can't get toplist of %s", bytes(request.user)) logger.exception("Can't get toplist of %s", unicode(request.user))
files = {'toplist': []} files = {'toplist': []}
cache.set(cache_key, files, 300) cache.set(cache_key, files, 300)
......
...@@ -56,6 +56,18 @@ from .util import ( ...@@ -56,6 +56,18 @@ from .util import (
GraphMixin GraphMixin
) )
try:
# Python 2: "unicode" is built-in
unicode
except NameError:
unicode = str
try:
# Python 2: "unicode" is built-in
unicode
except NameError:
unicode = str
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -272,7 +284,7 @@ class TemplateList(LoginRequiredMixin, FilterMixin, SingleTableView): ...@@ -272,7 +284,7 @@ class TemplateList(LoginRequiredMixin, FilterMixin, SingleTableView):
return queryset return queryset
def get_queryset(self): def get_queryset(self):
# logger.debug('TemplateList.get_queryset() called. User: %s', bytes(self.request.user)) logger.debug('TemplateList.get_queryset() called. User: %s', unicode(self.request.user))
qs = self.create_acl_queryset(InstanceTemplate) qs = self.create_acl_queryset(InstanceTemplate)
self.create_fake_get() self.create_fake_get()
......
...@@ -59,6 +59,11 @@ from ..tables import ( ...@@ -59,6 +59,11 @@ from ..tables import (
from .util import saml_available, DeleteViewBase, LoginView from .util import saml_available, DeleteViewBase, LoginView
try:
# Python 2: "unicode" is built-in
unicode
except NameError:
unicode = str
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -153,14 +158,14 @@ class TokenLogin(View): ...@@ -153,14 +158,14 @@ class TokenLogin(View):
try: try:
data = signing.loads(token, salt=self.get_salt(), data = signing.loads(token, salt=self.get_salt(),
max_age=self.token_max_age) max_age=self.token_max_age)
logger.debug('TokenLogin token data: %s', bytes(data)) logger.debug('TokenLogin token data: %s', unicode(data))
sudoer, user = data sudoer, user = data
logger.debug('Extracted TokenLogin data: sudoer: %s, user: %s', logger.debug('Extracted TokenLogin data: sudoer: %s, user: %s',
bytes(sudoer), bytes(user)) unicode(sudoer), unicode(user))
except (signing.BadSignature, ValueError, TypeError) as e: except (signing.BadSignature, ValueError, TypeError) as e:
logger.warning('Tried invalid TokenLogin token. ' logger.warning('Tried invalid TokenLogin token. '
'Token: %s, user: %s. %s', 'Token: %s, user: %s. %s',
token, bytes(self.request.user), bytes(e)) token, unicode(self.request.user), unicode(e))
raise SuspiciousOperation() raise SuspiciousOperation()
sudoer = User.objects.get(pk=sudoer) sudoer = User.objects.get(pk=sudoer)
if not sudoer.is_superuser: if not sudoer.is_superuser:
...@@ -168,9 +173,9 @@ class TokenLogin(View): ...@@ -168,9 +173,9 @@ class TokenLogin(View):
user = User.objects.get(pk=user) user = User.objects.get(pk=user)
user.backend = 'django.contrib.auth.backends.ModelBackend' user.backend = 'django.contrib.auth.backends.ModelBackend'
logger.warning('%s %d logged in as user %s %d', logger.warning('%s %d logged in as user %s %d',
bytes(sudoer), sudoer.pk, bytes(user), user.pk) unicode(sudoer), sudoer.pk, unicode(user), user.pk)
login(request, user) login(request, user)
messages.info(request, _("Logged in as user %s.") % bytes(user)) messages.info(request, _("Logged in as user %s.") % unicode(user))
return redirect("/") return redirect("/")
...@@ -253,7 +258,7 @@ class UnsubscribeFormView(SuccessMessageMixin, UpdateView): ...@@ -253,7 +258,7 @@ class UnsubscribeFormView(SuccessMessageMixin, UpdateView):
@classmethod @classmethod
def get_salt(cls): def get_salt(cls):
return bytes(cls) return unicode(cls)
@classmethod @classmethod
def get_token(cls, user): def get_token(cls, user):
...@@ -267,7 +272,7 @@ class UnsubscribeFormView(SuccessMessageMixin, UpdateView): ...@@ -267,7 +272,7 @@ class UnsubscribeFormView(SuccessMessageMixin, UpdateView):
raise raise
except (signing.BadSignature, ValueError, TypeError) as e: except (signing.BadSignature, ValueError, TypeError) as e:
logger.warning('Tried invalid token. Token: %s, user: %s. %s', logger.warning('Tried invalid token. Token: %s, user: %s. %s',
key, bytes(self.request.user), bytes(e)) key, unicode(self.request.user), unicode(e))
raise Http404 raise Http404
else: else:
return (queryset or self.get_queryset()).get(user_id=pk) return (queryset or self.get_queryset()).get(user_id=pk)
...@@ -561,7 +566,7 @@ class UserList(LoginRequiredMixin, PermissionRequiredMixin, SingleTableView): ...@@ -561,7 +566,7 @@ class UserList(LoginRequiredMixin, PermissionRequiredMixin, SingleTableView):
return super(UserList, self).get(*args, **kwargs) return super(UserList, self).get(*args, **kwargs)
def get_queryset(self): def get_queryset(self):
# logger.debug('UserList.get_queryset() called. User: %s', bytes(self.request.user)) # logger.debug('UserList.get_queryset() called. User: %s', unicode(self.request.user))
qs = User.objects.all().order_by("-pk") qs = User.objects.all().order_by("-pk")
q = self.search_form.cleaned_data.get('s') q = self.search_form.cleaned_data.get('s')
......
...@@ -56,6 +56,13 @@ from ..models import GroupProfile, Profile ...@@ -56,6 +56,13 @@ from ..models import GroupProfile, Profile
from ..forms import TransferOwnershipForm from ..forms import TransferOwnershipForm
try:
# Python 2: "unicode" is built-in
unicode
except NameError:
unicode = str
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
saml_available = hasattr(settings, "SAML_CONFIG") saml_available = hasattr(settings, "SAML_CONFIG")
...@@ -274,7 +281,7 @@ class OperationView(RedirectToLoginMixin, DetailView): ...@@ -274,7 +281,7 @@ class OperationView(RedirectToLoginMixin, DetailView):
return ctx return ctx
def check_auth(self): def check_auth(self):
#logger.debug("OperationView.check_auth(%s)", bytes(self)) logger.debug("OperationView.check_auth(%s)", unicode(self))
self.get_op().check_auth(self.request.user) self.get_op().check_auth(self.request.user)
@classmethod @classmethod
...@@ -374,7 +381,7 @@ class AjaxOperationMixin(object): ...@@ -374,7 +381,7 @@ class AjaxOperationMixin(object):
store = [] store = []
return JsonResponse({'success': True, return JsonResponse({'success': True,
'with_reload': self.with_reload, 'with_reload': self.with_reload,
'messages': [bytes(m) for m in store]}) 'messages': [str(m) for m in store]})
else: else:
return resp return resp
...@@ -511,23 +518,23 @@ class AclUpdateView(LoginRequiredMixin, View, SingleObjectMixin): ...@@ -511,23 +518,23 @@ class AclUpdateView(LoginRequiredMixin, View, SingleObjectMixin):
if getattr(self.instance, "owner", None) == whom: if getattr(self.instance, "owner", None) == whom:
logger.info("Tried to set owner's acl level for %s by %s.", logger.info("Tried to set owner's acl level for %s by %s.",
bytes(self.instance), bytes(user)) unicode(self.instance), unicode(user))
msg = _("The original owner cannot be removed, however " msg = _("The original owner cannot be removed, however "
"you can transfer ownership.") "you can transfer ownership.")
if not getattr(self, 'hide_messages', False): if not getattr(self, 'hide_messages', False):
messages.warning(self.request, msg) messages.warning(self.request, msg)
elif self.check_auth(whom, old_level, new_level): elif self.check_auth(whom, old_level, new_level):
logger.info( logger.info(
"Set %s's acl level for %s to %s by %s.", bytes(whom), "Set %s's acl level for %s to %s by %s.", unicode(whom),
bytes(self.instance), new_level, bytes(user)) unicode(self.instance), new_level, unicode(user))
if not getattr(self, 'hide_messages', False): if not getattr(self, 'hide_messages', False):
self.send_success_message(whom, old_level, new_level) self.send_success_message(whom, old_level, new_level)
self.instance.set_level(whom, new_level) self.instance.set_level(whom, new_level)
else: else:
logger.warning( logger.warning(
"Tried to set %s's acl_level for %s (%s->%s) by %s.", "Tried to set %s's acl_level for %s (%s->%s) by %s.",
bytes(whom), bytes(self.instance), old_level, new_level, unicode(whom), unicode(self.instance), old_level, new_level,
bytes(user)) unicode(user))
def set_or_remove_levels(self): def set_or_remove_levels(self):
for key, value in list(self.request.POST.items()): for key, value in list(self.request.POST.items()):
...@@ -654,7 +661,7 @@ class TransferOwnershipView(CheckedDetailView, DetailView): ...@@ -654,7 +661,7 @@ class TransferOwnershipView(CheckedDetailView, DetailView):
else: else:
messages.success(request, messages.success(request,
_('User %s is notified about the offer.') % ( _('User %s is notified about the offer.') % (
bytes(new_owner), )) unicode(new_owner), ))
return redirect(obj.get_absolute_url()) return redirect(obj.get_absolute_url())
...@@ -667,7 +674,7 @@ class TransferOwnershipConfirmView(LoginRequiredMixin, View): ...@@ -667,7 +674,7 @@ class TransferOwnershipConfirmView(LoginRequiredMixin, View):
@classmethod @classmethod
def get_salt(cls): def get_salt(cls):
return bytes(cls) + bytes(cls.model) return unicode(cls) + unicode(cls.model)
def get(self, request, key, *args, **kwargs): def get(self, request, key, *args, **kwargs):
"""Confirm ownership transfer based on token. """Confirm ownership transfer based on token.
...@@ -698,7 +705,7 @@ class TransferOwnershipConfirmView(LoginRequiredMixin, View): ...@@ -698,7 +705,7 @@ class TransferOwnershipConfirmView(LoginRequiredMixin, View):
self.change_owner(instance, request.user) self.change_owner(instance, request.user)
messages.success(request, self.success_message) messages.success(request, self.success_message)
logger.info('Ownership of %s transferred from %s to %s.', logger.info('Ownership of %s transferred from %s to %s.',
bytes(instance), bytes(old), bytes(request.user)) unicode(instance), unicode(old), unicode(request.user))
if old.profile: if old.profile:
old.profile.notify( old.profile.notify(
ugettext_noop('Ownership accepted'), ugettext_noop('Ownership accepted'),
...@@ -716,7 +723,7 @@ class TransferOwnershipConfirmView(LoginRequiredMixin, View): ...@@ -716,7 +723,7 @@ class TransferOwnershipConfirmView(LoginRequiredMixin, View):
salt=self.get_salt())) salt=self.get_salt()))
except (signing.BadSignature, ValueError, TypeError) as e: except (signing.BadSignature, ValueError, TypeError) as e:
logger.error('Tried invalid token. Token: %s, user: %s. %s', logger.error('Tried invalid token. Token: %s, user: %s. %s',
key, bytes(user), bytes(e)) key, unicode(user), unicode(e))
raise SuspiciousOperation() raise SuspiciousOperation()
try: try:
...@@ -724,12 +731,12 @@ class TransferOwnershipConfirmView(LoginRequiredMixin, View): ...@@ -724,12 +731,12 @@ class TransferOwnershipConfirmView(LoginRequiredMixin, View):
except self.model.DoesNotExist as e: except self.model.DoesNotExist as e:
logger.error('Tried token to nonexistent instance %d. ' logger.error('Tried token to nonexistent instance %d. '
'Token: %s, user: %s. %s', 'Token: %s, user: %s. %s',
instance, key, bytes(user), bytes(e)) instance, key, unicode(user), unicode(e))
raise Http404() raise Http404()
if new_owner != user.pk: if new_owner != user.pk:
logger.error('%s (%d) tried the token for %s. Token: %s.', logger.error('%s (%d) tried the token for %s. Token: %s.',
bytes(user), user.pk, new_owner, key) unicode(user), user.pk, new_owner, key)
raise PermissionDenied() raise PermissionDenied()
return (instance, new_owner) return (instance, new_owner)
......
...@@ -75,6 +75,13 @@ from request.forms import LeaseRequestForm, TemplateRequestForm ...@@ -75,6 +75,13 @@ from request.forms import LeaseRequestForm, TemplateRequestForm
from ..models import Favourite from ..models import Favourite
from manager.scheduler import has_traits from manager.scheduler import has_traits
try:
# Python 2: "unicode" is built-in
unicode
except NameError:
unicode = str
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -315,7 +322,7 @@ def get_operations(instance, user): ...@@ -315,7 +322,7 @@ def get_operations(instance, user):
op.check_precond() op.check_precond()
except PermissionDenied as e: except PermissionDenied as e:
pass pass
# logger.debug('Not showing operation %s for %s: %s', k, instance, bytes(e)) # logger.debug('Not showing operation %s for %s: %s', k, instance, unicode(e))
except Exception: except Exception:
ops.append(v.bind_to_object(instance, disabled=True)) ops.append(v.bind_to_object(instance, disabled=True))
else: else:
......
...@@ -24,6 +24,11 @@ from fabric.api import env, run, settings, sudo, prefix, cd, execute ...@@ -24,6 +24,11 @@ from fabric.api import env, run, settings, sudo, prefix, cd, execute
from fabric.context_managers import shell_env from fabric.context_managers import shell_env
from fabric.decorators import roles, parallel from fabric.decorators import roles, parallel
try:
# Python 2: "unicode" is built-in
unicode
except NameError:
unicode = str
env.roledefs['portal'] = ['localhost'] env.roledefs['portal'] = ['localhost']
...@@ -35,7 +40,7 @@ try: ...@@ -35,7 +40,7 @@ try:
except Exception as e: except Exception as e:
print(e) print(e)
else: else:
env.roledefs['node'] = [bytes(n.host.ipv4) env.roledefs['node'] = [unicode(n.host.ipv4)
for n in _Node.objects.filter(enabled=True)] for n in _Node.objects.filter(enabled=True)]
env.roledefs['storage'] = [_DataStore.objects.get().hostname] env.roledefs['storage'] = [_DataStore.objects.get().hostname]
...@@ -149,7 +154,7 @@ def selenium(test=""): ...@@ -149,7 +154,7 @@ def selenium(test=""):
def pull(dir="~/circle/circle"): def pull(dir="~/circle/circle"):
"Pull from upstream branch (stash any changes)" "Pull from upstream branch (stash any changes)"
now = bytes(datetime.datetime.now()) now = unicode(datetime.datetime.now())
with cd(dir), shell_env(GIT_AUTHOR_NAME="fabric", with cd(dir), shell_env(GIT_AUTHOR_NAME="fabric",
GIT_AUTHOR_EMAIL="fabric@local", GIT_AUTHOR_EMAIL="fabric@local",
GIT_COMMITTER_NAME="fabric", GIT_COMMITTER_NAME="fabric",
......
...@@ -23,6 +23,12 @@ from firewall.models import (Rule, Host, Vlan, Group, VlanGroup, Firewall, ...@@ -23,6 +23,12 @@ from firewall.models import (Rule, Host, Vlan, Group, VlanGroup, Firewall,
SwitchPort, EthernetDevice) SwitchPort, EthernetDevice)
from django import contrib from django import contrib
try:
# Python 2: "unicode" is built-in
unicode
except NameError:
unicode = str
class RuleInline(contrib.admin.TabularInline): class RuleInline(contrib.admin.TabularInline):
model = Rule model = Rule
...@@ -107,7 +113,7 @@ class RuleAdmin(admin.ModelAdmin): ...@@ -107,7 +113,7 @@ class RuleAdmin(admin.ModelAdmin):
for field in [instance.vlan, instance.vlangroup, instance.host, for field in [instance.vlan, instance.vlangroup, instance.host,
instance.hostgroup, instance.firewall]: instance.hostgroup, instance.firewall]:
if field: if field:
return bytes(field) + ' ' + field._meta.object_name return unicode(field) + ' ' + field._meta.object_name
class AliasAdmin(admin.ModelAdmin): class AliasAdmin(admin.ModelAdmin):
......
...@@ -25,6 +25,11 @@ from netaddr import (IPAddress, IPNetwork, AddrFormatError, ZEROFILL, ...@@ -25,6 +25,11 @@ from netaddr import (IPAddress, IPNetwork, AddrFormatError, ZEROFILL,
EUI, mac_unix, AddrConversionError) EUI, mac_unix, AddrConversionError)
import re import re
try:
# Python 2: "unicode" is built-in
unicode
except NameError:
unicode = str
alfanum_re = re.compile(r'^[A-Za-z0-9_-]+$') alfanum_re = re.compile(r'^[A-Za-z0-9_-]+$')
domain_re = re.compile(r'^([A-Za-z0-9_/-]\.?)+$') domain_re = re.compile(r'^([A-Za-z0-9_/-]\.?)+$')
...@@ -47,7 +52,7 @@ class MACAddressFormField(forms.Field): ...@@ -47,7 +52,7 @@ class MACAddressFormField(forms.Field):
return MACAddressField.to_python return MACAddressField.to_python
except (AddrFormatError, TypeError, ValidationError) as e: except (AddrFormatError, TypeError, ValidationError) as e:
raise ValidationError(self.default_error_messages['invalid'] raise ValidationError(self.default_error_messages['invalid']
% bytes(e)) % unicode(e))
class MACAddressField(models.Field): class MACAddressField(models.Field):
...@@ -169,7 +174,7 @@ class IPNetworkFormField(forms.Field): ...@@ -169,7 +174,7 @@ class IPNetworkFormField(forms.Field):
return IPNetworkField(version=self.version).to_python(value) return IPNetworkField(version=self.version).to_python(value)
except (AddrFormatError, TypeError) as e: except (AddrFormatError, TypeError) as e:
raise ValidationError(self.default_error_messages['invalid'] raise ValidationError(self.default_error_messages['invalid']
% bytes(e)) % unicode(e))
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.version = kwargs['version'] self.version = kwargs['version']
...@@ -274,7 +279,7 @@ def val_ipv6_template(value): ...@@ -274,7 +279,7 @@ def val_ipv6_template(value):
>>> val_ipv6_template("123::%(a)d:%(b)d:%(c)d:%(d)d") >>> val_ipv6_template("123::%(a)d:%(b)d:%(c)d:%(d)d")
>>> val_ipv6_template("::%(a)x:%(b)x:%(c)d:%(d)d") >>> val_ipv6_template("::%(a)x:%(b)x:%(c)d:%(d)d")
Don't have to use all bytes from the left (no a): Don't have to use all unicode from the left (no a):
>>> val_ipv6_template("::%(b)x:%(c)d:%(d)d") >>> val_ipv6_template("::%(b)x:%(c)d:%(d)d")
But have to use all ones to the right (a, but no b): But have to use all ones to the right (a, but no b):
......
...@@ -29,6 +29,12 @@ from django.template import loader ...@@ -29,6 +29,12 @@ from django.template import loader
from django.utils import timezone from django.utils import timezone
try:
# Python 2: "unicode" is built-in
unicode
except NameError:
unicode = str
settings = django.conf.settings.FIREWALL_SETTINGS settings = django.conf.settings.FIREWALL_SETTINGS
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -152,9 +158,9 @@ class BuildFirewall: ...@@ -152,9 +158,9 @@ class BuildFirewall:
template = loader.get_template('firewall/iptables.conf') template = loader.get_template('firewall/iptables.conf')
context['proto'] = 'ipv4' context['proto'] = 'ipv4'
ipv4 = bytes(template.render(context)) ipv4 = unicode(template.render(context))
context['proto'] = 'ipv6' context['proto'] = 'ipv6'
ipv6 = bytes(template.render(context)) ipv6 = unicode(template.render(context))
return (ipv4, ipv6) return (ipv4, ipv6)
......
...@@ -46,6 +46,12 @@ from .iptables import IptRule ...@@ -46,6 +46,12 @@ from .iptables import IptRule
from acl.models import AclBase from acl.models import AclBase
try:
# Python 2: "unicode" is built-in
unicode
except NameError:
unicode = str
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
settings = django.conf.settings.FIREWALL_SETTINGS settings = django.conf.settings.FIREWALL_SETTINGS
...@@ -178,10 +184,10 @@ class Rule(models.Model): ...@@ -178,10 +184,10 @@ class Rule(models.Model):
""" """
return '[%(type)s] %(src)s ▸ %(dst)s %(para)s %(desc)s' % { return '[%(type)s] %(src)s ▸ %(dst)s %(para)s %(desc)s' % {
'type': self.r_type, 'type': self.r_type,
'src': (bytes(self.foreign_network) if self.direction == 'in' 'src': (str(self.foreign_network) if self.direction == 'in'
else self.r_type), else self.r_type),
'dst': (self.r_type if self.direction == 'out' 'dst': (self.r_type if self.direction == 'out'
else bytes(self.foreign_network)), else str(self.foreign_network)),
'para': ((("proto=%s " % self.proto) if self.proto else '') + 'para': ((("proto=%s " % self.proto) if self.proto else '') +
(("sport=%s " % self.sport) if self.sport else '') + (("sport=%s " % self.sport) if self.sport else '') +
(("dport=%s " % self.dport) if self.dport else '')), (("dport=%s " % self.dport) if self.dport else '')),
...@@ -363,7 +369,7 @@ class Vlan(AclBase, models.Model): ...@@ -363,7 +369,7 @@ class Vlan(AclBase, models.Model):
help_text=_('Template of the IPv4 reverse domain name that ' help_text=_('Template of the IPv4 reverse domain name that '
'should be generated for each host. The template ' 'should be generated for each host. The template '
'should contain four tokens: "%(a)d", "%(b)d", ' 'should contain four tokens: "%(a)d", "%(b)d", '
'"%(c)d", and "%(d)d", representing the four bytes ' '"%(c)d", and "%(d)d", representing the four unicode '
'of the address, respectively, in decimal notation. ' 'of the address, respectively, in decimal notation. '
'For example, the template for the standard reverse ' 'For example, the template for the standard reverse '
'address is: "%(d)d.%(c)d.%(b)d.%(a)d.in-addr.arpa".'), 'address is: "%(d)d.%(c)d.%(b)d.%(a)d.in-addr.arpa".'),
...@@ -374,7 +380,7 @@ class Vlan(AclBase, models.Model): ...@@ -374,7 +380,7 @@ class Vlan(AclBase, models.Model):
'Automatically generated hosts in dual-stack networks ' 'Automatically generated hosts in dual-stack networks '
'will get this address. The template ' 'will get this address. The template '
'can contain four tokens: "%(a)d", "%(b)d", ' 'can contain four tokens: "%(a)d", "%(b)d", '
'"%(c)d", and "%(d)d", representing the four bytes ' '"%(c)d", and "%(d)d", representing the four unicode '
'of the IPv4 address, respectively, in decimal notation. ' 'of the IPv4 address, respectively, in decimal notation. '
'Moreover you can use any standard printf format ' 'Moreover you can use any standard printf format '
'specification like %(a)02x to get the first byte as two ' 'specification like %(a)02x to get the first byte as two '
...@@ -424,8 +430,8 @@ class Vlan(AclBase, models.Model): ...@@ -424,8 +430,8 @@ class Vlan(AclBase, models.Model):
self.host_ipv6_prefixlen = prefixlen self.host_ipv6_prefixlen = prefixlen
@staticmethod @staticmethod
def _host_bytes(prefixlen, maxbytes): def _host_unicode(prefixlen, maxunicode):
return int(ceil((maxbytes - prefixlen / 8.0))) return int(ceil((maxunicode - prefixlen / 8.0)))
@staticmethod @staticmethod
def _append_hexa(s, v, lasthalf): def _append_hexa(s, v, lasthalf):
...@@ -453,26 +459,26 @@ class Vlan(AclBase, models.Model): ...@@ -453,26 +459,26 @@ class Vlan(AclBase, models.Model):
... IPNetwork("2001:0DB8:1:1::/64"), False) ... IPNetwork("2001:0DB8:1:1::/64"), False)
('2001:db8:1:1:%(d)02x00::', 72) ('2001:db8:1:1:%(d)02x00::', 72)
""" """
host4_bytes = cls._host_bytes(network4.prefixlen, 4) host4_unicode = cls._host_unicode(network4.prefixlen, 4)
host6_bytes = cls._host_bytes(network6.prefixlen, 16) host6_unicode = cls._host_unicode(network6.prefixlen, 16)
if host4_bytes > host6_bytes: if host4_unicode > host6_unicode:
raise ValidationError( raise ValidationError(
_("IPv6 network is too small to map IPv4 addresses to it.")) _("IPv6 network is too small to map IPv4 addresses to it."))
letters = ascii_letters[4-host4_bytes:4] letters = ascii_letters[4-host4_unicode:4]
remove = host6_bytes // 2 remove = host6_unicode // 2
ipstr = network6.network.format(ipv6_full) ipstr = network6.network.format(ipv6_full)
s = ipstr.split(":")[0:-remove] s = ipstr.split(":")[0:-remove]
if verbose is None: # use verbose format if net6 much wider if verbose is None: # use verbose format if net6 much wider
verbose = 2 * (host4_bytes + 1) < host6_bytes verbose = 2 * (host4_unicode + 1) < host6_unicode
if verbose: if verbose:
for i in letters: for i in letters:
s.append("%({})d".format(i)) s.append("%({})d".format(i))
else: else:
remain = host6_bytes remain = host6_unicode
for i in letters: for i in letters:
cls._append_hexa(s, i, remain % 2 == 1) cls._append_hexa(s, i, remain % 2 == 1)
remain -= 1 remain -= 1
if host6_bytes > host4_bytes: if host6_unicode > host4_unicode:
s.append(":") s.append(":")
tpl = ":".join(s) tpl = ":".join(s)
# compute prefix length # compute prefix length
...@@ -886,11 +892,11 @@ class Host(models.Model): ...@@ -886,11 +892,11 @@ class Host(models.Model):
res = Record.objects.filter( res = Record.objects.filter(
type='A', address=self.get_external_ipv4()) type='A', address=self.get_external_ipv4())
if res.count() < 1: if res.count() < 1:
return bytes(self.get_external_ipv4()) return unicode(self.get_external_ipv4())
else: else:
res = self.record_set.filter(type='A', res = self.record_set.filter(type='A',
address=self.ipv4) address=self.ipv4)
return bytes(res[0].fqdn) return unicode(res[0].fqdn)
except: except:
return None return None
......
...@@ -63,15 +63,15 @@ def get_firewall_queues(): ...@@ -63,15 +63,15 @@ def get_firewall_queues():
@celery.task @celery.task
def reloadtask_worker(): def reloadtask_worker():
from firewall.fw import BuildFirewall, dhcp, dns, ipset, vlan from firewall.fw import BuildFirewall, dhcp, dns, ipset, vlan
from remote_tasks import (reload_dns, reload_dhcp, reload_firewall, from firewall.tasks.remote_tasks import (reload_dns, reload_dhcp, reload_firewall,
reload_firewall_vlan, reload_blacklist) reload_firewall_vlan, reload_blacklist)
tasks = [] tasks = []
for i in ('dns', 'dhcp', 'firewall', 'firewall_vlan', 'blacklist'): for i in ('dns', 'dhcp', 'firewall', 'firewall_vlan', 'blacklist'):
lockname = "%s_lock" % i lockname = "%s_lock" % i
if cache.get(lockname): # if cache.get(lockname):
tasks.append(i) tasks.append(i)
cache.delete(lockname) # cache.delete(lockname)
logger.info("reloadtask_worker: Reload %s", ", ".join(tasks)) logger.info("reloadtask_worker: Reload %s", ", ".join(tasks))
......
...@@ -36,6 +36,13 @@ from .models import BlacklistItem, Host ...@@ -36,6 +36,13 @@ from .models import BlacklistItem, Host
from django.conf import settings from django.conf import settings
try:
# Python 2: "unicode" is built-in
unicode
except NameError:
unicode = str
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -108,4 +115,4 @@ def add_blacklist_item(request): ...@@ -108,4 +115,4 @@ def add_blacklist_item(request):
if is_new and settings.BLACKLIST_HOOK_URL: if is_new and settings.BLACKLIST_HOOK_URL:
send_request(obj) send_request(obj)
return HttpResponse(bytes(_("OK"))) return HttpResponse(unicode(_("OK")))
...@@ -6,7 +6,7 @@ msgid "" ...@@ -6,7 +6,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-12-20 08:40+0000\n" "POT-Creation-Date: 2022-01-05 21:47+0000\n"
"PO-Revision-Date: 2015-09-04 11:15+0116\n" "PO-Revision-Date: 2015-09-04 11:15+0116\n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: Hungarian <cloud@ik.bme.hu>\n" "Language-Team: Hungarian <cloud@ik.bme.hu>\n"
...@@ -26,38 +26,38 @@ msgstr "Angol" ...@@ -26,38 +26,38 @@ msgstr "Angol"
msgid "Hungarian" msgid "Hungarian"
msgstr "Magyar" msgstr "Magyar"
#: common/models.py:80 #: common/models.py:81
msgid "Failure." msgid "Failure."
msgstr "Hiba." msgstr "Hiba."
#: common/models.py:81 #: common/models.py:82
#, python-format #, python-format
msgid "Unhandled exception: %(e)s: %(error)s" msgid "Unhandled exception: %(e)s: %(error)s"
msgstr "Kezeletlen kivétel: %(e)s: %(error)s" msgstr "Kezeletlen kivétel: %(e)s: %(error)s"
#: common/models.py:157 #: common/models.py:158
#: dashboard/templates/dashboard/instanceactivity_detail.html:28 #: dashboard/templates/dashboard/instanceactivity_detail.html:28
#: dashboard/templates/dashboard/nodeactivity_detail.html:26 #: dashboard/templates/dashboard/nodeactivity_detail.html:26
msgid "activity code" msgid "activity code"
msgstr "tevékenységkód" msgstr "tevékenységkód"
#: common/models.py:160 #: common/models.py:161
msgid "human readable name" msgid "human readable name"
msgstr "olvasható név" msgstr "olvasható név"
#: common/models.py:161 #: common/models.py:162
msgid "Human readable name of activity." msgid "Human readable name of activity."
msgstr "A tevékenység neve olvasható formában." msgstr "A tevékenység neve olvasható formában."
#: common/models.py:165 #: common/models.py:166
msgid "Celery task unique identifier." msgid "Celery task unique identifier."
msgstr "Celery feladat egyedi azonosítója." msgstr "Celery feladat egyedi azonosítója."
#: common/models.py:166 #: common/models.py:167
msgid "task_uuid" msgid "task_uuid"
msgstr "feladat uuid" msgstr "feladat uuid"
#: common/models.py:167 #: common/models.py:168
#: dashboard/templates/dashboard/instanceactivity_detail.html:37 #: dashboard/templates/dashboard/instanceactivity_detail.html:37
#: dashboard/templates/dashboard/nodeactivity_detail.html:35 #: dashboard/templates/dashboard/nodeactivity_detail.html:35
#: firewall/models.py:289 request/models.py:265 vm/models/common.py:85 #: firewall/models.py:289 request/models.py:265 vm/models/common.py:85
...@@ -65,49 +65,49 @@ msgstr "feladat uuid" ...@@ -65,49 +65,49 @@ msgstr "feladat uuid"
msgid "user" msgid "user"
msgstr "felhasználó" msgstr "felhasználó"
#: common/models.py:168 #: common/models.py:169
msgid "The person who started this activity." msgid "The person who started this activity."
msgstr "A tevékenységet indító felhasználó." msgstr "A tevékenységet indító felhasználó."
#: common/models.py:169 #: common/models.py:170
msgid "started at" msgid "started at"
msgstr "indítás ideje" msgstr "indítás ideje"
#: common/models.py:171 #: common/models.py:172
msgid "Time of activity initiation." msgid "Time of activity initiation."
msgstr "A tevékenység megkezdésének időpontja." msgstr "A tevékenység megkezdésének időpontja."
#: common/models.py:172 #: common/models.py:173
msgid "finished at" msgid "finished at"
msgstr "befejezés ideje" msgstr "befejezés ideje"
#: common/models.py:174 #: common/models.py:175
msgid "Time of activity finalization." msgid "Time of activity finalization."
msgstr "A tevékenység befejeztének ideje." msgstr "A tevékenység befejeztének ideje."
#: common/models.py:176 #: common/models.py:177
msgid "True, if the activity has finished successfully." msgid "True, if the activity has finished successfully."
msgstr "Igaz, ha a tevékenység sikeresen befejeződött." msgstr "Igaz, ha a tevékenység sikeresen befejeződött."
#: common/models.py:178 #: common/models.py:179
#: dashboard/templates/dashboard/instanceactivity_detail.html:56 #: dashboard/templates/dashboard/instanceactivity_detail.html:56
#: dashboard/templates/dashboard/nodeactivity_detail.html:55 #: dashboard/templates/dashboard/nodeactivity_detail.html:55
msgid "result" msgid "result"
msgstr "eredmény" msgstr "eredmény"
#: common/models.py:180 #: common/models.py:181
msgid "Human readable result of activity." msgid "Human readable result of activity."
msgstr "A tevékenység eredménye olvasható formában." msgstr "A tevékenység eredménye olvasható formában."
#: common/models.py:552 #: common/models.py:553
msgid "Permission Denied" msgid "Permission Denied"
msgstr "Hozzáférés megtagadva" msgstr "Hozzáférés megtagadva"
#: common/models.py:554 #: common/models.py:555
msgid "Unknown error" msgid "Unknown error"
msgstr "Ismeretlen hiba" msgstr "Ismeretlen hiba"
#: common/models.py:555 #: common/models.py:556
#, python-format #, python-format
msgid "Unknown error: %(ex)s" msgid "Unknown error: %(ex)s"
msgstr "Ismeretlen hiba: %(ex)s" msgstr "Ismeretlen hiba: %(ex)s"
...@@ -138,8 +138,8 @@ msgstr "szerver" ...@@ -138,8 +138,8 @@ msgstr "szerver"
msgid "realtime" msgid "realtime"
msgstr "valós idejű" msgstr "valós idejű"
#: dashboard/forms.py:90 dashboard/forms.py:847 dashboard/forms.py:982 #: dashboard/forms.py:91 dashboard/forms.py:848 dashboard/forms.py:983
#: dashboard/forms.py:988 dashboard/forms.py:1456 dashboard/tables.py:270 #: dashboard/forms.py:989 dashboard/forms.py:1457 dashboard/tables.py:270
#: dashboard/templates/dashboard/_vm-create-2.html:20 #: dashboard/templates/dashboard/_vm-create-2.html:20
#: dashboard/templates/dashboard/vm-detail/home.html:9 #: dashboard/templates/dashboard/vm-detail/home.html:9
#: dashboard/templates/dashboard/vm-list.html:63 firewall/models.py:301 #: dashboard/templates/dashboard/vm-list.html:63 firewall/models.py:301
...@@ -148,31 +148,31 @@ msgstr "valós idejű" ...@@ -148,31 +148,31 @@ msgstr "valós idejű"
msgid "Name" msgid "Name"
msgstr "Név" msgstr "Név"
#: dashboard/forms.py:91 vm/models/instance.py:137 #: dashboard/forms.py:92 vm/models/instance.py:137
msgid "Human readable name of template." msgid "Human readable name of template."
msgstr "A sablon olvasható neve." msgstr "A sablon olvasható neve."
#: dashboard/forms.py:101 #: dashboard/forms.py:102
msgid "Clone template permissions" msgid "Clone template permissions"
msgstr "Sablon jogosultságainak klónozása" msgstr "Sablon jogosultságainak klónozása"
#: dashboard/forms.py:102 #: dashboard/forms.py:103
msgid "" msgid ""
"Clone the access list of parent template. Useful for updating a template." "Clone the access list of parent template. Useful for updating a template."
msgstr "" msgstr ""
"A szülősablon hozzáférési listájának másolása. Sablonok frissítéséhez " "A szülősablon hozzáférési listájának másolása. Sablonok frissítéséhez "
"ajánlott." "ajánlott."
#: dashboard/forms.py:212 dashboard/templates/dashboard/_vm-create-1.html:59 #: dashboard/forms.py:213 dashboard/templates/dashboard/_vm-create-1.html:59
#: dashboard/templates/dashboard/vm-detail/home.html:34 #: dashboard/templates/dashboard/vm-detail/home.html:34
msgid "Description" msgid "Description"
msgstr "Leírás" msgstr "Leírás"
#: dashboard/forms.py:223 dashboard/forms.py:308 #: dashboard/forms.py:224 dashboard/forms.py:309
msgid "Directory identifier" msgid "Directory identifier"
msgstr "Címtári azonosító" msgstr "Címtári azonosító"
#: dashboard/forms.py:226 #: dashboard/forms.py:227
msgid "" msgid ""
"If you select an item here, the members of this directory group will be " "If you select an item here, the members of this directory group will be "
"automatically added to the group at the time they log in. Please note that " "automatically added to the group at the time they log in. Please note that "
...@@ -183,7 +183,7 @@ msgstr "" ...@@ -183,7 +183,7 @@ msgstr ""
"kerülnek, ha bejelentkeznek. Vegye figyelembe, hogy más, az önhöz hasonló " "kerülnek, ha bejelentkeznek. Vegye figyelembe, hogy más, az önhöz hasonló "
"jogosultságú felhasználók is csoportadminisztrátorrá válhatnak." "jogosultságú felhasználók is csoportadminisztrátorrá válhatnak."
#: dashboard/forms.py:250 dashboard/templates/dashboard/store/_list-box.html:57 #: dashboard/forms.py:251 dashboard/templates/dashboard/store/_list-box.html:57
#: network/templates/network/blacklist-create.html:8 #: network/templates/network/blacklist-create.html:8
#: network/templates/network/domain-create.html:8 #: network/templates/network/domain-create.html:8
#: network/templates/network/firewall-create.html:6 #: network/templates/network/firewall-create.html:6
...@@ -199,24 +199,24 @@ msgstr "" ...@@ -199,24 +199,24 @@ msgstr ""
msgid "Create" msgid "Create"
msgstr "Létrehozás" msgstr "Létrehozás"
#: dashboard/forms.py:270 #: dashboard/forms.py:271
#, fuzzy #, fuzzy
#| msgid "Group actions" #| msgid "Group actions"
msgid "Group to import" msgid "Group to import"
msgstr "Csoportos műveletek" msgstr "Csoportos műveletek"
#: dashboard/forms.py:277 #: dashboard/forms.py:278
#, fuzzy #, fuzzy
#| msgid "Support" #| msgid "Support"
msgid "Import" msgid "Import"
msgstr "Támogatás" msgstr "Támogatás"
#: dashboard/forms.py:286 dashboard/forms.py:868 #: dashboard/forms.py:287 dashboard/forms.py:869
#: dashboard/templates/dashboard/store/_list-box.html:114 #: dashboard/templates/dashboard/store/_list-box.html:114
msgid "Filename" msgid "Filename"
msgstr "Fájlnév" msgstr "Fájlnév"
#: dashboard/forms.py:292 #: dashboard/forms.py:293
#: dashboard/templates/dashboard/_disk-list-element.html:14 #: dashboard/templates/dashboard/_disk-list-element.html:14
#: dashboard/templates/dashboard/group-detail.html:15 #: dashboard/templates/dashboard/group-detail.html:15
#, fuzzy #, fuzzy
...@@ -224,10 +224,10 @@ msgstr "Fájlnév" ...@@ -224,10 +224,10 @@ msgstr "Fájlnév"
msgid "Export" msgid "Export"
msgstr "Támogatás" msgstr "Támogatás"
#: dashboard/forms.py:319 dashboard/forms.py:1317 dashboard/forms.py:1333 #: dashboard/forms.py:320 dashboard/forms.py:1318 dashboard/forms.py:1334
#: dashboard/forms.py:1368 dashboard/forms.py:1422 dashboard/forms.py:1469 #: dashboard/forms.py:1369 dashboard/forms.py:1423 dashboard/forms.py:1470
#: dashboard/forms.py:1509 dashboard/forms.py:1529 dashboard/forms.py:1592 #: dashboard/forms.py:1510 dashboard/forms.py:1530 dashboard/forms.py:1593
#: dashboard/forms.py:1715 dashboard/forms.py:1765 #: dashboard/forms.py:1716 dashboard/forms.py:1766
#: dashboard/templates/dashboard/_manage_access.html:73 #: dashboard/templates/dashboard/_manage_access.html:73
#: dashboard/templates/dashboard/connect-command-create.html:37 #: dashboard/templates/dashboard/connect-command-create.html:37
#: dashboard/templates/dashboard/connect-command-edit.html:37 #: dashboard/templates/dashboard/connect-command-edit.html:37
...@@ -242,62 +242,62 @@ msgstr "Támogatás" ...@@ -242,62 +242,62 @@ msgstr "Támogatás"
msgid "Save" msgid "Save"
msgstr "Mentés" msgstr "Mentés"
#: dashboard/forms.py:350 dashboard/forms.py:1116 #: dashboard/forms.py:351 dashboard/forms.py:1117
#: dashboard/templates/dashboard/_vm-remove-port.html:15 #: dashboard/templates/dashboard/_vm-remove-port.html:15
#: dashboard/templates/dashboard/vm-detail.html:113 network/views.py:659 #: dashboard/templates/dashboard/vm-detail.html:113 network/views.py:659
msgid "Host" msgid "Host"
msgstr "Gép" msgstr "Gép"
#: dashboard/forms.py:421 dashboard/forms.py:819 dashboard/forms.py:1079 #: dashboard/forms.py:422 dashboard/forms.py:820 dashboard/forms.py:1080
#: dashboard/templates/dashboard/node-detail.html:5 #: dashboard/templates/dashboard/node-detail.html:5
#: dashboard/templates/dashboard/vm-detail/home.html:118 #: dashboard/templates/dashboard/vm-detail/home.html:118
#: dashboard/templates/dashboard/vm-list.html:88 #: dashboard/templates/dashboard/vm-list.html:88
msgid "Node" msgid "Node"
msgstr "Csomópont" msgstr "Csomópont"
#: dashboard/forms.py:500 #: dashboard/forms.py:501
msgid "Networks" msgid "Networks"
msgstr "Hálózatok" msgstr "Hálózatok"
#: dashboard/forms.py:730 dashboard/forms.py:754 #: dashboard/forms.py:731 dashboard/forms.py:755
msgid "hours" msgid "hours"
msgstr "óra" msgstr "óra"
#: dashboard/forms.py:735 dashboard/forms.py:759 #: dashboard/forms.py:736 dashboard/forms.py:760
msgid "days" msgid "days"
msgstr "nap" msgstr "nap"
#: dashboard/forms.py:740 dashboard/forms.py:764 #: dashboard/forms.py:741 dashboard/forms.py:765
msgid "weeks" msgid "weeks"
msgstr "hét" msgstr "hét"
#: dashboard/forms.py:745 dashboard/forms.py:769 #: dashboard/forms.py:746 dashboard/forms.py:770
msgid "months" msgid "months"
msgstr "hónap" msgstr "hónap"
#: dashboard/forms.py:775 dashboard/templates/dashboard/template-edit.html:64 #: dashboard/forms.py:776 dashboard/templates/dashboard/template-edit.html:64
#: network/forms.py:64 #: network/forms.py:64
msgid "Save changes" msgid "Save changes"
msgstr "Változások mentése" msgstr "Változások mentése"
#: dashboard/forms.py:785 #: dashboard/forms.py:786
msgid "Set expiration times even if they are shorter than the current value." msgid "Set expiration times even if they are shorter than the current value."
msgstr "" msgstr ""
"Akkor is állítsa át a lejárati időket, ha rövidebbek lesznek a jelenleginél." "Akkor is állítsa át a lejárati időket, ha rövidebbek lesznek a jelenleginél."
#: dashboard/forms.py:788 #: dashboard/forms.py:789
msgid "Save selected lease." msgid "Save selected lease."
msgstr "Kiválasztott bérlet mentése." msgstr "Kiválasztott bérlet mentése."
#: dashboard/forms.py:797 #: dashboard/forms.py:798
msgid "Length" msgid "Length"
msgstr "Hossz" msgstr "Hossz"
#: dashboard/forms.py:805 #: dashboard/forms.py:806
msgid "Live migration" msgid "Live migration"
msgstr "Live migration" msgstr "Live migration"
#: dashboard/forms.py:807 #: dashboard/forms.py:808
msgid "" msgid ""
"Live migration is a way of moving virtual machines between hosts with a " "Live migration is a way of moving virtual machines between hosts with a "
"service interruption of at most some seconds. Please note that it can take " "service interruption of at most some seconds. Please note that it can take "
...@@ -307,47 +307,47 @@ msgstr "" ...@@ -307,47 +307,47 @@ msgstr ""
"legfeljebb néhány másodperces szolgáltatáskimaradással. Vegye figyelembe, " "legfeljebb néhány másodperces szolgáltatáskimaradással. Vegye figyelembe, "
"hogy ez terhelt gépek esetén sokáig tarthat és nagy hálózati forgalommal jár." "hogy ez terhelt gépek esetén sokáig tarthat és nagy hálózati forgalommal jár."
#: dashboard/forms.py:824 #: dashboard/forms.py:825
msgid "Forcibly interrupt all running activities." msgid "Forcibly interrupt all running activities."
msgstr "Futó tevékenységek erőltetett befejezése." msgstr "Futó tevékenységek erőltetett befejezése."
#: dashboard/forms.py:825 #: dashboard/forms.py:826
msgid "Set all activities to finished state, but don't interrupt any tasks." msgid "Set all activities to finished state, but don't interrupt any tasks."
msgstr "" msgstr ""
"Minden tevékenység befejezettre állítása (a feladatok megszakítása nélkül)." "Minden tevékenység befejezettre állítása (a feladatok megszakítása nélkül)."
#: dashboard/forms.py:828 #: dashboard/forms.py:829
msgid "New status" msgid "New status"
msgstr "Új állapot" msgstr "Új állapot"
#: dashboard/forms.py:829 #: dashboard/forms.py:830
msgid "Reset node" msgid "Reset node"
msgstr "Csomópont visszaállítása" msgstr "Csomópont visszaállítása"
#: dashboard/forms.py:843 #: dashboard/forms.py:844
msgid "use emergency state change" msgid "use emergency state change"
msgstr "vész-állapotváltás használata" msgstr "vész-állapotváltás használata"
#: dashboard/forms.py:849 dashboard/forms.py:904 #: dashboard/forms.py:850 dashboard/forms.py:905
#: dashboard/templates/dashboard/store/_list-box.html:117 request/forms.py:176 #: dashboard/templates/dashboard/store/_list-box.html:117 request/forms.py:176
msgid "Size" msgid "Size"
msgstr "Méret" msgstr "Méret"
#: dashboard/forms.py:850 #: dashboard/forms.py:851
msgid "Size of disk to create in bytes or with units like MB or GB." msgid "Size of disk to create in bytes or with units like MB or GB."
msgstr "Létrehozandó lemez mérete byte-okban vagy mértékegységgel (MB, GB)." msgstr "Létrehozandó lemez mérete byte-okban vagy mértékegységgel (MB, GB)."
#: dashboard/forms.py:862 dashboard/forms.py:926 #: dashboard/forms.py:863 dashboard/forms.py:927
msgid "Invalid format, you can use GB or MB!" msgid "Invalid format, you can use GB or MB!"
msgstr "Érvénytelen formátum. „GB” és „MB” is használható." msgstr "Érvénytelen formátum. „GB” és „MB” is használható."
#: dashboard/forms.py:871 #: dashboard/forms.py:872
#, fuzzy #, fuzzy
#| msgid "normal" #| msgid "normal"
msgid "Format" msgid "Format"
msgstr "normál" msgstr "normál"
#: dashboard/forms.py:881 dashboard/forms.py:916 dashboard/forms.py:952 #: dashboard/forms.py:882 dashboard/forms.py:917 dashboard/forms.py:953
#: dashboard/templates/dashboard/storage/disk.html:7 #: dashboard/templates/dashboard/storage/disk.html:7
#: dashboard/templates/dashboard/storage/disk.html:24 #: dashboard/templates/dashboard/storage/disk.html:24
#: request/templates/request/_request-resize-form.html:9 #: request/templates/request/_request-resize-form.html:9
...@@ -355,113 +355,113 @@ msgstr "normál" ...@@ -355,113 +355,113 @@ msgstr "normál"
msgid "Disk" msgid "Disk"
msgstr "Lemez" msgstr "Lemez"
#: dashboard/forms.py:892 dashboard/forms.py:938 dashboard/forms.py:963 #: dashboard/forms.py:893 dashboard/forms.py:939 dashboard/forms.py:964
#, python-format #, python-format
msgid "<label>Disk:</label> %s" msgid "<label>Disk:</label> %s"
msgstr "<label>Lemez:</label> %s" msgstr "<label>Lemez:</label> %s"
#: dashboard/forms.py:905 request/forms.py:177 #: dashboard/forms.py:906 request/forms.py:177
msgid "Size to resize the disk in bytes or with units like MB or GB." msgid "Size to resize the disk in bytes or with units like MB or GB."
msgstr "A lemez kívánt mérete byte-okban vagy mértékegységgel (MB, GB)." msgstr "A lemez kívánt mérete byte-okban vagy mértékegységgel (MB, GB)."
#: dashboard/forms.py:929 #: dashboard/forms.py:930
msgid "Disk size must be greater than the actual size." msgid "Disk size must be greater than the actual size."
msgstr "A lemez mérete nagyobb kell legyen a jelenleginél." msgstr "A lemez mérete nagyobb kell legyen a jelenleginél."
#: dashboard/forms.py:983 #: dashboard/forms.py:984
#, fuzzy #, fuzzy
#| msgid "Disk list" #| msgid "Disk list"
msgid "Disk image" msgid "Disk image"
msgstr "Lemezek" msgstr "Lemezek"
#: dashboard/forms.py:989 #: dashboard/forms.py:990
msgid "URL" msgid "URL"
msgstr "URL" msgstr "URL"
#: dashboard/forms.py:999 #: dashboard/forms.py:1000
msgid "Could not find filename in URL, please specify a name explicitly." msgid "Could not find filename in URL, please specify a name explicitly."
msgstr "Az URL-ben nem található fájlnév. Kérem adja meg explicite." msgstr "Az URL-ben nem található fájlnév. Kérem adja meg explicite."
#: dashboard/forms.py:1013 #: dashboard/forms.py:1014
msgid "Interface" msgid "Interface"
msgstr "Interfészek" msgstr "Interfészek"
#: dashboard/forms.py:1025 #: dashboard/forms.py:1026
#, python-brace-format #, python-brace-format
msgid "<label>Vlan:</label> {0}" msgid "<label>Vlan:</label> {0}"
msgstr "<label>Vlan:</label> {0}" msgstr "<label>Vlan:</label> {0}"
#: dashboard/forms.py:1040 #: dashboard/forms.py:1041
#: dashboard/templates/dashboard/_vm-remove-port.html:17 #: dashboard/templates/dashboard/_vm-remove-port.html:17
#: dashboard/templates/dashboard/node-detail/resources.html:28 #: dashboard/templates/dashboard/node-detail/resources.html:28
#: network/views.py:658 #: network/views.py:658
msgid "Vlan" msgid "Vlan"
msgstr "Vlan" msgstr "Vlan"
#: dashboard/forms.py:1043 #: dashboard/forms.py:1044
msgid "No more networks." msgid "No more networks."
msgstr "Nincs több hálózat." msgstr "Nincs több hálózat."
#: dashboard/forms.py:1064 #: dashboard/forms.py:1065
#, python-format #, python-format
msgid " (missing_traits: %s)" msgid " (missing_traits: %s)"
msgstr "(hiányzó jellemzők: %s)" msgstr "(hiányzó jellemzők: %s)"
#: dashboard/forms.py:1080 #: dashboard/forms.py:1081
msgid "" msgid ""
"Deploy virtual machine to this node (blank allows scheduling automatically)." "Deploy virtual machine to this node (blank allows scheduling automatically)."
msgstr "" msgstr ""
"A virtuális gép elindítása ezen a csomóponton (üresen hagyva automatikus " "A virtuális gép elindítása ezen a csomóponton (üresen hagyva automatikus "
"ütemezés)." "ütemezés)."
#: dashboard/forms.py:1097 dashboard/forms.py:1103 #: dashboard/forms.py:1098 dashboard/forms.py:1104
#: dashboard/templates/dashboard/_vm-remove-port.html:13 #: dashboard/templates/dashboard/_vm-remove-port.html:13
msgid "Port" msgid "Port"
msgstr "Port" msgstr "Port"
#: dashboard/forms.py:1106 dashboard/templates/dashboard/vm-detail.html:111 #: dashboard/forms.py:1107 dashboard/templates/dashboard/vm-detail.html:111
msgid "Protocol" msgid "Protocol"
msgstr "Protokoll" msgstr "Protokoll"
#: dashboard/forms.py:1128 #: dashboard/forms.py:1129
#, python-brace-format #, python-brace-format
msgid "<label>Host:</label> {0}" msgid "<label>Host:</label> {0}"
msgstr "<label>Gép:</label> {0}" msgstr "<label>Gép:</label> {0}"
#: dashboard/forms.py:1156 dashboard/templates/dashboard/profile.html:36 #: dashboard/forms.py:1157 dashboard/templates/dashboard/profile.html:36
#: dashboard/templates/dashboard/vm-detail.html:129 #: dashboard/templates/dashboard/vm-detail.html:129
msgid "Username" msgid "Username"
msgstr "Felhasználónév" msgstr "Felhasználónév"
#: dashboard/forms.py:1170 dashboard/templates/dashboard/vm-detail.html:131 #: dashboard/forms.py:1171 dashboard/templates/dashboard/vm-detail.html:131
msgid "Password" msgid "Password"
msgstr "Jelszó" msgstr "Jelszó"
#: dashboard/forms.py:1175 #: dashboard/forms.py:1176
msgid "Sign in" msgid "Sign in"
msgstr "Bejelentkezés" msgstr "Bejelentkezés"
#: dashboard/forms.py:1198 dashboard/templates/dashboard/profile.html:42 #: dashboard/forms.py:1199 dashboard/templates/dashboard/profile.html:42
msgid "Email address" msgid "Email address"
msgstr "E-mail cím" msgstr "E-mail cím"
#: dashboard/forms.py:1203 #: dashboard/forms.py:1204
msgid "Reset password" msgid "Reset password"
msgstr "Új jelszó" msgstr "Új jelszó"
#: dashboard/forms.py:1219 dashboard/forms.py:1342 #: dashboard/forms.py:1220 dashboard/forms.py:1343
msgid "Change password" msgid "Change password"
msgstr "Jelszóváltoztatás" msgstr "Jelszóváltoztatás"
#: dashboard/forms.py:1289 #: dashboard/forms.py:1290
msgid "Add trait" msgid "Add trait"
msgstr "Jellemző hozzáadása" msgstr "Jellemző hozzáadása"
#: dashboard/forms.py:1306 #: dashboard/forms.py:1307
msgid "Preferred language" msgid "Preferred language"
msgstr "Választott nyelv" msgstr "Választott nyelv"
#: dashboard/forms.py:1357 dashboard/templates/dashboard/group-list.html:14 #: dashboard/forms.py:1358 dashboard/templates/dashboard/group-list.html:14
#: dashboard/templates/dashboard/index-groups.html:7 #: dashboard/templates/dashboard/index-groups.html:7
#: dashboard/templates/dashboard/profile.html:61 #: dashboard/templates/dashboard/profile.html:61
#: dashboard/templates/dashboard/vm-detail/network.html:44 #: dashboard/templates/dashboard/vm-detail/network.html:44
...@@ -471,68 +471,68 @@ msgstr "Választott nyelv" ...@@ -471,68 +471,68 @@ msgstr "Választott nyelv"
msgid "Groups" msgid "Groups"
msgstr "Csoportok" msgstr "Csoportok"
#: dashboard/forms.py:1383 #: dashboard/forms.py:1384
msgid "Instance limit" msgid "Instance limit"
msgstr "Példány limit" msgstr "Példány limit"
#: dashboard/forms.py:1386 #: dashboard/forms.py:1387
#, fuzzy #, fuzzy
#| msgid "Instance limit" #| msgid "Instance limit"
msgid "Template instance limit" msgid "Template instance limit"
msgstr "Példány limit" msgstr "Példány limit"
#: dashboard/forms.py:1389 #: dashboard/forms.py:1390
msgid "Two-factor authentication secret" msgid "Two-factor authentication secret"
msgstr "" msgstr ""
#: dashboard/forms.py:1390 #: dashboard/forms.py:1391
msgid "" msgid ""
"Remove the secret key to disable two-factor authentication for this user." "Remove the secret key to disable two-factor authentication for this user."
msgstr "" msgstr ""
#: dashboard/forms.py:1432 dashboard/templates/dashboard/lease-edit.html:86 #: dashboard/forms.py:1433 dashboard/templates/dashboard/lease-edit.html:86
msgid "Name of group or user" msgid "Name of group or user"
msgstr "Csoport vagy felhasználó neve" msgstr "Csoport vagy felhasználó neve"
#: dashboard/forms.py:1441 dashboard/forms.py:1451 #: dashboard/forms.py:1442 dashboard/forms.py:1452
msgid "Name of user" msgid "Name of user"
msgstr "Felhasználó neve" msgstr "Felhasználó neve"
#: dashboard/forms.py:1442 dashboard/forms.py:1452 #: dashboard/forms.py:1443 dashboard/forms.py:1453
msgid "E-mail address or identifier of user" msgid "E-mail address or identifier of user"
msgstr "A felhasználó e-mail címe vagy azonosítója" msgstr "A felhasználó e-mail címe vagy azonosítója"
#: dashboard/forms.py:1458 #: dashboard/forms.py:1459
msgid "Key" msgid "Key"
msgstr "Kulcs" msgstr "Kulcs"
#: dashboard/forms.py:1459 #: dashboard/forms.py:1460
msgid "For example: ssh-rsa AAAAB3NzaC1yc2ED..." msgid "For example: ssh-rsa AAAAB3NzaC1yc2ED..."
msgstr "Például: ssh-rsa AAAAB3NzaC1yc2ED…" msgstr "Például: ssh-rsa AAAAB3NzaC1yc2ED…"
#: dashboard/forms.py:1538 #: dashboard/forms.py:1539
msgid "permissions" msgid "permissions"
msgstr "jogosultságok" msgstr "jogosultságok"
#: dashboard/forms.py:1639 #: dashboard/forms.py:1640
msgid "owned" msgid "owned"
msgstr "saját" msgstr "saját"
#: dashboard/forms.py:1640 #: dashboard/forms.py:1641
msgid "shared" msgid "shared"
msgstr "osztott" msgstr "osztott"
#: dashboard/forms.py:1641 #: dashboard/forms.py:1642
#, fuzzy #, fuzzy
#| msgid "shared IP" #| msgid "shared IP"
msgid "shared with me" msgid "shared with me"
msgstr "osztott IP" msgstr "osztott IP"
#: dashboard/forms.py:1642 #: dashboard/forms.py:1643
msgid "all" msgid "all"
msgstr "összes" msgstr "összes"
#: dashboard/forms.py:1651 dashboard/forms.py:1677 dashboard/forms.py:1698 #: dashboard/forms.py:1652 dashboard/forms.py:1678 dashboard/forms.py:1699
#: dashboard/templates/dashboard/index-groups.html:23 #: dashboard/templates/dashboard/index-groups.html:23
#: dashboard/templates/dashboard/index-nodes.html:40 #: dashboard/templates/dashboard/index-nodes.html:40
#: dashboard/templates/dashboard/index-templates.html:40 #: dashboard/templates/dashboard/index-templates.html:40
...@@ -543,19 +543,19 @@ msgstr "összes" ...@@ -543,19 +543,19 @@ msgstr "összes"
msgid "Search..." msgid "Search..."
msgstr "Keresés..." msgstr "Keresés..."
#: dashboard/forms.py:1748 #: dashboard/forms.py:1749
#, fuzzy #, fuzzy
#| msgid "Start time of the message in YYYY.DD.MM. hh.mm.ss format." #| msgid "Start time of the message in YYYY.DD.MM. hh.mm.ss format."
msgid "Start time of the message in YYYY-MM-DD hh:mm:ss format." msgid "Start time of the message in YYYY-MM-DD hh:mm:ss format."
msgstr "Az üzenet kezdési időpontja YYYY.DD.MM. hh.mm.ss formátumban." msgstr "Az üzenet kezdési időpontja YYYY.DD.MM. hh.mm.ss formátumban."
#: dashboard/forms.py:1750 #: dashboard/forms.py:1751
#, fuzzy #, fuzzy
#| msgid "End time of the message in YYYY.DD.MM. hh.mm.ss format." #| msgid "End time of the message in YYYY.DD.MM. hh.mm.ss format."
msgid "End time of the message in YYYY-MM-DD hh:mm:ss format." msgid "End time of the message in YYYY-MM-DD hh:mm:ss format."
msgstr "Az üzenet befejezési időpontja YYYY.DD.MM. hh.mm.ss formátumban." msgstr "Az üzenet befejezési időpontja YYYY.DD.MM. hh.mm.ss formátumban."
#: dashboard/forms.py:1752 #: dashboard/forms.py:1753
msgid "" msgid ""
"The color of the message box defined by the respective <a href=\"http://" "The color of the message box defined by the respective <a href=\"http://"
"getbootstrap.com/components/#alerts\">Bootstrap class</a>." "getbootstrap.com/components/#alerts\">Bootstrap class</a>."
...@@ -563,23 +563,23 @@ msgstr "" ...@@ -563,23 +563,23 @@ msgstr ""
"Az üzenet doboz színe a megfelelő <a href=\"http://getbootstrap.com/" "Az üzenet doboz színe a megfelelő <a href=\"http://getbootstrap.com/"
"components/#alerts\">Bootstrap osztály</a> szerint meghatározva." "components/#alerts\">Bootstrap osztály</a> szerint meghatározva."
#: dashboard/forms.py:1758 #: dashboard/forms.py:1759
msgid "Start time" msgid "Start time"
msgstr "Kezdési időpont" msgstr "Kezdési időpont"
#: dashboard/forms.py:1759 #: dashboard/forms.py:1760
msgid "End time" msgid "End time"
msgstr "Befejezési időpont" msgstr "Befejezési időpont"
#: dashboard/forms.py:1777 #: dashboard/forms.py:1778
msgid "Two-factor authentication passcode" msgid "Two-factor authentication passcode"
msgstr "" msgstr ""
#: dashboard/forms.py:1778 #: dashboard/forms.py:1779
msgid "Get the code from your authenticator." msgid "Get the code from your authenticator."
msgstr "" msgstr ""
#: dashboard/forms.py:1789 #: dashboard/forms.py:1790
#, fuzzy #, fuzzy
#| msgid "File removal confirmation" #| msgid "File removal confirmation"
msgid "Invalid confirmation code." msgid "Invalid confirmation code."
...@@ -752,7 +752,7 @@ msgid "Unique identifier of the group at the organization." ...@@ -752,7 +752,7 @@ msgid "Unique identifier of the group at the organization."
msgstr "A csoport egyedi szervezeti azonosítója." msgstr "A csoport egyedi szervezeti azonosítója."
#. Translators: [T] as Template #. Translators: [T] as Template
#: dashboard/tables.py:53 dashboard/tables.py:310 #: dashboard/tables.py:53 dashboard/tables.py:313
#: dashboard/templates/dashboard/vm-detail/home.html:131 #: dashboard/templates/dashboard/vm-detail/home.html:131
msgid "Template" msgid "Template"
msgstr "Sablon" msgstr "Sablon"
...@@ -804,7 +804,7 @@ msgid "Admin" ...@@ -804,7 +804,7 @@ msgid "Admin"
msgstr "Adminisztráció" msgstr "Adminisztráció"
#: dashboard/tables.py:141 dashboard/tables.py:220 dashboard/tables.py:251 #: dashboard/tables.py:141 dashboard/tables.py:220 dashboard/tables.py:251
#: dashboard/tables.py:285 dashboard/tables.py:314 network/tables.py:272 #: dashboard/tables.py:285 dashboard/tables.py:317 network/tables.py:272
msgid "Actions" msgid "Actions"
msgstr "Műveletek" msgstr "Műveletek"
...@@ -855,15 +855,15 @@ msgstr "Nincs elérhető bérlési mód." ...@@ -855,15 +855,15 @@ msgstr "Nincs elérhető bérlési mód."
msgid "Fingerprint" msgid "Fingerprint"
msgstr "Ujjlenyomat" msgstr "Ujjlenyomat"
#: dashboard/tables.py:296 #: dashboard/tables.py:299
msgid "You haven't added any public keys yet." msgid "You haven't added any public keys yet."
msgstr "Még nem adott meg publikus kulcsot." msgstr "Még nem adott meg publikus kulcsot."
#: dashboard/tables.py:306 templates/info/help/overview.html:354 #: dashboard/tables.py:309 templates/info/help/overview.html:354
msgid "Access method" msgid "Access method"
msgstr "Elérés módja" msgstr "Elérés módja"
#: dashboard/tables.py:327 #: dashboard/tables.py:330
msgid "" msgid ""
"You don't have any custom connection commands yet. You can specify commands " "You don't have any custom connection commands yet. You can specify commands "
"to be displayed on VM detail pages instead of the defaults." "to be displayed on VM detail pages instead of the defaults."
...@@ -871,24 +871,24 @@ msgstr "" ...@@ -871,24 +871,24 @@ msgstr ""
"Még nincs egyedi csatlakozási parancsa. Az itt megadott parancsok fognak " "Még nincs egyedi csatlakozási parancsa. Az itt megadott parancsok fognak "
"megjelenni a VM-részletező oldalon az alapértelmezettek helyett." "megjelenni a VM-részletező oldalon az alapértelmezettek helyett."
#: dashboard/tables.py:336 dashboard/templates/dashboard/vm-list.html:59 #: dashboard/tables.py:339 dashboard/templates/dashboard/vm-list.html:59
#: request/tables.py:31 request/tables.py:62 request/tables.py:78 #: request/tables.py:31 request/tables.py:62 request/tables.py:78
msgid "ID" msgid "ID"
msgstr "ID" msgstr "ID"
#: dashboard/tables.py:341 dashboard/templates/dashboard/storage/disk.html:18 #: dashboard/tables.py:344 dashboard/templates/dashboard/storage/disk.html:18
msgid "Appliance" msgid "Appliance"
msgstr "Felhasználás" msgstr "Felhasználás"
#: dashboard/tables.py:345 #: dashboard/tables.py:348
msgid "ready" msgid "ready"
msgstr "kész" msgstr "kész"
#: dashboard/tables.py:356 #: dashboard/tables.py:359
msgid "No disk found." msgid "No disk found."
msgstr "Nem található lemez." msgstr "Nem található lemez."
#: dashboard/tables.py:373 #: dashboard/tables.py:376
msgid "No messages." msgid "No messages."
msgstr "Nincsenek üzenetek." msgstr "Nincsenek üzenetek."
...@@ -3502,112 +3502,112 @@ msgstr "A művelet sikeresen végrehajtásra került." ...@@ -3502,112 +3502,112 @@ msgstr "A művelet sikeresen végrehajtásra került."
msgid "Operation is started." msgid "Operation is started."
msgstr "A művelet megkezdődött." msgstr "A művelet megkezdődött."
#: dashboard/views/util.py:426 #: dashboard/views/util.py:429
#, python-format #, python-format
msgid "Acl user/group %(w)s successfully modified." msgid "Acl user/group %(w)s successfully modified."
msgstr "A(z) %(w)s ACL felhasználó/csoport módosításra került." msgstr "A(z) %(w)s ACL felhasználó/csoport módosításra került."
#: dashboard/views/util.py:428 #: dashboard/views/util.py:431
#, python-format #, python-format
msgid "Acl user/group %(w)s successfully added." msgid "Acl user/group %(w)s successfully added."
msgstr "A(z) %(w)s ACL felhasználó/csoport hozzáadásra került." msgstr "A(z) %(w)s ACL felhasználó/csoport hozzáadásra került."
#: dashboard/views/util.py:430 #: dashboard/views/util.py:433
#, python-format #, python-format
msgid "Acl user/group %(w)s successfully removed." msgid "Acl user/group %(w)s successfully removed."
msgstr "A(z) %(w)s ACL felhasználó/csoport törlésre került." msgstr "A(z) %(w)s ACL felhasználó/csoport törlésre került."
#: dashboard/views/util.py:515 #: dashboard/views/util.py:518
msgid "" msgid ""
"The original owner cannot be removed, however you can transfer ownership." "The original owner cannot be removed, however you can transfer ownership."
msgstr "Az eredeti tulajdonos nem törölhető, azonban a tulajdon átruházható." msgstr "Az eredeti tulajdonos nem törölhető, azonban a tulajdon átruházható."
#: dashboard/views/util.py:551 #: dashboard/views/util.py:554
#, python-format #, python-format
msgid "User \"%s\" has already access to this object." msgid "User \"%s\" has already access to this object."
msgstr "„%s” felhasználó már hozzáfér az objektumhoz." msgstr "„%s” felhasználó már hozzáfér az objektumhoz."
#: dashboard/views/util.py:560 #: dashboard/views/util.py:563
#, python-format #, python-format
msgid "Group \"%s\" has already access to this object." msgid "Group \"%s\" has already access to this object."
msgstr "„%s” csoport már hozzáfér az objektumhoz." msgstr "„%s” csoport már hozzáfér az objektumhoz."
#: dashboard/views/util.py:565 #: dashboard/views/util.py:568
#, python-format #, python-format
msgid "User or group \"%s\" not found." msgid "User or group \"%s\" not found."
msgstr "Nem található „%s” felhasználó vagy csoport." msgstr "Nem található „%s” felhasználó vagy csoport."
#: dashboard/views/util.py:581 #: dashboard/views/util.py:584
msgid "1 hour" msgid "1 hour"
msgstr "1 óra" msgstr "1 óra"
#: dashboard/views/util.py:582 #: dashboard/views/util.py:585
msgid "6 hours" msgid "6 hours"
msgstr "6 óra" msgstr "6 óra"
#: dashboard/views/util.py:583 #: dashboard/views/util.py:586
msgid "1 day" msgid "1 day"
msgstr "1 nap" msgstr "1 nap"
#: dashboard/views/util.py:584 #: dashboard/views/util.py:587
msgid "1 week" msgid "1 week"
msgstr "1 hét" msgstr "1 hét"
#: dashboard/views/util.py:585 #: dashboard/views/util.py:588
msgid "1 month" msgid "1 month"
msgstr "1 hónap" msgstr "1 hónap"
#: dashboard/views/util.py:586 #: dashboard/views/util.py:589
msgid "6 months" msgid "6 months"
msgstr "6 hónap" msgstr "6 hónap"
#: dashboard/views/util.py:595 #: dashboard/views/util.py:598
msgid "Bad graph time format, available periods are: h, d, w, and y." msgid "Bad graph time format, available periods are: h, d, w, and y."
msgstr "Hibás grafikon időformátum. Lehetséges egységek: h, d, w és y." msgstr "Hibás grafikon időformátum. Lehetséges egységek: h, d, w és y."
#: dashboard/views/util.py:620 #: dashboard/views/util.py:623
msgid "Transfer ownership" msgid "Transfer ownership"
msgstr "Tulajdon átruházása" msgstr "Tulajdon átruházása"
#: dashboard/views/util.py:633 #: dashboard/views/util.py:636
msgid "Can not find specified user." msgid "Can not find specified user."
msgstr "Nem található a megadott felhasználó." msgstr "Nem található a megadott felhasználó."
#: dashboard/views/util.py:649 #: dashboard/views/util.py:652
msgid "Ownership offer" msgid "Ownership offer"
msgstr "Átruházási ajánlat" msgstr "Átruházási ajánlat"
#: dashboard/views/util.py:653 #: dashboard/views/util.py:656
msgid "Can not notify selected user." msgid "Can not notify selected user."
msgstr "A kiválaszott felhasználó értesítése sikertelen." msgstr "A kiválaszott felhasználó értesítése sikertelen."
#: dashboard/views/util.py:656 #: dashboard/views/util.py:659
#, python-format #, python-format
msgid "User %s is notified about the offer." msgid "User %s is notified about the offer."
msgstr "%s felhasználó értesítésre került az ajánlatról." msgstr "%s felhasználó értesítésre került az ajánlatról."
#: dashboard/views/util.py:666 #: dashboard/views/util.py:669
msgid "Ownership successfully transferred to you." msgid "Ownership successfully transferred to you."
msgstr "A tulajdon átruházásra került." msgstr "A tulajdon átruházásra került."
#: dashboard/views/util.py:679 #: dashboard/views/util.py:682
msgid "This token is for an other user." msgid "This token is for an other user."
msgstr "A token más felhasználó nevére szól." msgstr "A token más felhasználó nevére szól."
#: dashboard/views/util.py:682 #: dashboard/views/util.py:685
msgid "This token is invalid or has expired." msgid "This token is invalid or has expired."
msgstr "A token érvénytelen vagy lejárt." msgstr "A token érvénytelen vagy lejárt."
#: dashboard/views/util.py:704 #: dashboard/views/util.py:707
msgid "Ownership accepted" msgid "Ownership accepted"
msgstr "Átruházás elfogadva" msgstr "Átruházás elfogadva"
#: dashboard/views/util.py:705 #: dashboard/views/util.py:708
#, python-format #, python-format
msgid "Your ownership offer of %(instance)s has been accepted by %(owner)s." msgid "Your ownership offer of %(instance)s has been accepted by %(owner)s."
msgstr "%(instance)s gépre vonatkozó átruházási ajánlatát elfogadta %(owner)s." msgstr "%(instance)s gépre vonatkozó átruházási ajánlatát elfogadta %(owner)s."
#: dashboard/views/util.py:754 #: dashboard/views/util.py:757
msgid "Only the owners can delete the selected object." msgid "Only the owners can delete the selected object."
msgstr "Csak a tulajdonos törölheti a kiválasztott objektumot." msgstr "Csak a tulajdonos törölheti a kiválasztott objektumot."
......
...@@ -39,7 +39,6 @@ def crontab_parser(crontab): ...@@ -39,7 +39,6 @@ def crontab_parser(crontab):
day_of_week=fields[4], day_of_week=fields[4],
) )
celery = Celery('manager', celery = Celery('manager',
broker=getenv("AMQP_URI"), broker=getenv("AMQP_URI"),
include=['vm.tasks.local_tasks', include=['vm.tasks.local_tasks',
...@@ -51,9 +50,10 @@ celery = Celery('manager', ...@@ -51,9 +50,10 @@ celery = Celery('manager',
'dashboard.tasks.local_periodic_tasks', 'dashboard.tasks.local_periodic_tasks',
]) ])
celery.config_from_object('celeryconfig')
celery.conf.update( celery.conf.update(
CELERY_RESULT_BACKEND='amqp', # CELERY_RESULT_BACKEND='amqp',
CELERY_TASK_RESULT_EXPIRES=30000,
CELERY_QUEUES=( CELERY_QUEUES=(
Queue(HOSTNAME + '.man', Exchange('manager', type='direct'), Queue(HOSTNAME + '.man', Exchange('manager', type='direct'),
routing_key="manager"), routing_key="manager"),
......
...@@ -24,15 +24,17 @@ from os import getenv ...@@ -24,15 +24,17 @@ from os import getenv
HOSTNAME = "localhost" HOSTNAME = "localhost"
QUEUE_NAME = HOSTNAME + '.monitor' QUEUE_NAME = HOSTNAME + '.monitor'
celery = Celery('monitor', celery = Celery('monitor',
broker=getenv("AMQP_URI"), broker=getenv("AMQP_URI"),
include=['vm.tasks.local_periodic_tasks', include=['vm.tasks.local_periodic_tasks',
'monitor.tasks.local_periodic_tasks', 'monitor.tasks.local_periodic_tasks',
]) ])
celery.config_from_object('celeryconfig')
celery.conf.update( celery.conf.update(
CELERY_RESULT_BACKEND='amqp', # CELERY_RESULT_BACKEND='amqp',
CELERY_TASK_RESULT_EXPIRES=30000,
CELERY_QUEUES=( CELERY_QUEUES=(
Queue(QUEUE_NAME, Exchange('monitor', type='direct'), Queue(QUEUE_NAME, Exchange('monitor', type='direct'),
routing_key="monitor"), routing_key="monitor"),
......
...@@ -24,6 +24,7 @@ from os import getenv ...@@ -24,6 +24,7 @@ from os import getenv
HOSTNAME = "localhost" HOSTNAME = "localhost"
QUEUE_NAME = HOSTNAME + '.man.slow' QUEUE_NAME = HOSTNAME + '.man.slow'
celery = Celery('manager.slow', celery = Celery('manager.slow',
broker=getenv("AMQP_URI"), broker=getenv("AMQP_URI"),
include=['vm.tasks.local_tasks', include=['vm.tasks.local_tasks',
...@@ -31,10 +32,10 @@ celery = Celery('manager.slow', ...@@ -31,10 +32,10 @@ celery = Celery('manager.slow',
'storage.tasks.local_tasks', 'storage.tasks.local_tasks',
'storage.tasks.periodic_tasks', 'storage.tasks.periodic_tasks',
]) ])
celery.config_from_object('celeryconfig')
celery.conf.update( celery.conf.update(
CELERY_RESULT_BACKEND='amqp', # CELERY_RESULT_BACKEND='amqp',
CELERY_TASK_RESULT_EXPIRES=30000,
CELERY_QUEUES=( CELERY_QUEUES=(
Queue(QUEUE_NAME, Exchange('manager.slow', type='direct'), Queue(QUEUE_NAME, Exchange('manager.slow', type='direct'),
routing_key="manager.slow"), routing_key="manager.slow"),
......
...@@ -67,6 +67,12 @@ ACCESS_METHODS = [(key, name) for key, (name, port, transport) ...@@ -67,6 +67,12 @@ ACCESS_METHODS = [(key, name) for key, (name, port, transport)
in list(ACCESS_PROTOCOLS.items())] in list(ACCESS_PROTOCOLS.items())]
try:
# Python 2: "unicode" is built-in
unicode
except NameError:
unicode = str
def find_unused_port(port_range, used_ports=[]): def find_unused_port(port_range, used_ports=[]):
"""Find an unused port in the specified range. """Find an unused port in the specified range.
...@@ -699,7 +705,7 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin, ...@@ -699,7 +705,7 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
" Failed ones are: %(faileds_ex)s."), " Failed ones are: %(faileds_ex)s."),
failed=len(failed), success=len(success), failed=len(failed), success=len(success),
faileds=", ".join(a for a, e in failed), faileds=", ".join(a for a, e in failed),
faileds_ex=", ".join("%s (%s)" % (a, bytes(e)) faileds_ex=", ".join("%s (%s)" % (a, unicode(e))
for a, e in failed)) for a, e in failed))
else: else:
act.result = create_readable(ugettext_noop( act.result = create_readable(ugettext_noop(
......
...@@ -57,6 +57,13 @@ from .tasks.local_tasks import ( ...@@ -57,6 +57,13 @@ from .tasks.local_tasks import (
abortable_async_instance_operation, abortable_async_node_operation, abortable_async_instance_operation, abortable_async_node_operation,
) )
try:
# Python 2: "unicode" is built-in
unicode
except NameError:
unicode = str
logger = getLogger(__name__) logger = getLogger(__name__)
...@@ -111,16 +118,16 @@ class InstanceOperation(Operation): ...@@ -111,16 +118,16 @@ class InstanceOperation(Operation):
if self.accept_states: if self.accept_states:
if self.instance.status not in self.accept_states: if self.instance.status not in self.accept_states:
logger.debug("precond failed for %s: %s not in %s", logger.debug("precond failed for %s: %s not in %s",
bytes(self.__class__), unicode(self.__class__),
bytes(self.instance.status), unicode(self.instance.status),
bytes(self.accept_states)) unicode(self.accept_states))
raise self.instance.WrongStateError(self.instance) raise self.instance.WrongStateError(self.instance)
if self.deny_states: if self.deny_states:
if self.instance.status in self.deny_states: if self.instance.status in self.deny_states:
logger.debug("precond failed for %s: %s in %s", logger.debug("precond failed for %s: %s in %s",
bytes(self.__class__), unicode(self.__class__),
bytes(self.instance.status), unicode(self.instance.status),
bytes(self.accept_states)) unicode(self.accept_states))
raise self.instance.WrongStateError(self.instance) raise self.instance.WrongStateError(self.instance)
def check_auth(self, user): def check_auth(self, user):
...@@ -1310,7 +1317,7 @@ class UpdateNodeOperation(NodeOperation): ...@@ -1310,7 +1317,7 @@ class UpdateNodeOperation(NodeOperation):
if not isinstance(data, dict): if not isinstance(data, dict):
raise HumanReadableException.create(ugettext_noop( raise HumanReadableException.create(ugettext_noop(
"Unhandled exception: %(msg)s"), msg=bytes(data)) "Unhandled exception: %(msg)s"), msg=unicode(data))
return data return data
...@@ -1321,7 +1328,7 @@ class UpdateNodeOperation(NodeOperation): ...@@ -1321,7 +1328,7 @@ class UpdateNodeOperation(NodeOperation):
data = self.minion_cmd('pkg.upgrade', []) data = self.minion_cmd('pkg.upgrade', [])
if not data.get('result'): if not data.get('result'):
raise HumanReadableException.create(ugettext_noop( raise HumanReadableException.create(ugettext_noop(
"Unhandled exception: %(msg)s"), msg=bytes(data)) "Unhandled exception: %(msg)s"), msg=unicode(data))
# data = {'vim': {'new': '1.2.7', 'old': '1.3.7'}} # data = {'vim': {'new': '1.2.7', 'old': '1.3.7'}}
data = [v for v in list(data.values()) if isinstance(v, dict)] data = [v for v in list(data.values()) if isinstance(v, dict)]
...@@ -1786,11 +1793,11 @@ class DetachMixin(object): ...@@ -1786,11 +1793,11 @@ class DetachMixin(object):
try: try:
super(DetachMixin, self)._operation(**kwargs) super(DetachMixin, self)._operation(**kwargs)
except Exception as e: except Exception as e:
if hasattr(e, "libvirtError") and "not found" in bytes(e): if hasattr(e, "libvirtError") and "not found" in unicode(e):
activity.result = create_readable( activity.result = create_readable(
ugettext_noop("Resource was not found."), ugettext_noop("Resource was not found."),
ugettext_noop("Resource was not found. %(exception)s"), ugettext_noop("Resource was not found. %(exception)s"),
exception=bytes(e)) exception=unicode(e))
else: else:
raise raise
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment