From 01842f224bd7b13701a445eb20850e90b30a35b2 Mon Sep 17 00:00:00 2001 From: Marc Aymerich Date: Wed, 25 Feb 2015 13:24:11 +0000 Subject: [PATCH] Removed support for migration mode --- orchestra/apps/databases/backends.py | 2 +- orchestra/apps/lists/forms.py | 17 ----------------- orchestra/apps/orchestration/manager.py | 2 ++ orchestra/apps/systemusers/models.py | 4 ++-- orchestra/forms/options.py | 16 +--------------- orchestra/settings.py | 3 --- 6 files changed, 6 insertions(+), 38 deletions(-) diff --git a/orchestra/apps/databases/backends.py b/orchestra/apps/databases/backends.py index acdf8ac2..967a6654 100644 --- a/orchestra/apps/databases/backends.py +++ b/orchestra/apps/databases/backends.py @@ -38,7 +38,7 @@ class MySQLBackend(ServiceController): return context = self.get_context(database) self.append("mysql -e 'DROP DATABASE `%(database)s`;'" % context) - self.append("mysql mysql -e 'DELETE FROM db WHERE db = `%(database)s`;'" % context) + self.append("mysql mysql -e 'DELETE FROM db WHERE db = \"%(database)s\";'" % context) def commit(self): self.append("mysql -e 'FLUSH PRIVILEGES;'") diff --git a/orchestra/apps/lists/forms.py b/orchestra/apps/lists/forms.py index 9b01aaa3..4f5fd79f 100644 --- a/orchestra/apps/lists/forms.py +++ b/orchestra/apps/lists/forms.py @@ -1,7 +1,6 @@ from django import forms from django.utils.translation import ugettext_lazy as _ -from orchestra import settings as orchestra_settings from orchestra.core.validators import validate_password from orchestra.forms.widgets import ReadOnlyWidget @@ -23,16 +22,6 @@ class ListCreationForm(CleanAddressMixin, forms.ModelForm): widget=forms.PasswordInput, help_text=_("Enter the same password as above, for verification.")) - def __init__(self, *args, **kwargs): - super(ListCreationForm, self).__init__(*args, **kwargs) - if orchestra_settings.ORCHESTRA_MIGRATION_MODE: - self.fields['password1'].widget = forms.HiddenInput() - self.fields['password1'].required = False - self.fields['password2'].widget = forms.HiddenInput() - self.fields['password2'].required = False - self.fields['admin_email'].widget = forms.HiddenInput() - self.fields['admin_email'].required = False - def clean_password2(self): password1 = self.cleaned_data.get("password1") password2 = self.cleaned_data.get("password2") @@ -41,12 +30,6 @@ class ListCreationForm(CleanAddressMixin, forms.ModelForm): raise forms.ValidationError(msg) return password2 - def save(self, commit=True): - obj = super(ListCreationForm, self).save(commit=commit) - if not orchestra_settings.ORCHESTRA_MIGRATION_MODE: - obj.set_password(self.cleaned_data["password1"]) - return obj - class ListChangeForm(CleanAddressMixin, forms.ModelForm): password = forms.CharField(label=_("Password"), diff --git a/orchestra/apps/orchestration/manager.py b/orchestra/apps/orchestration/manager.py index 3451ab37..0ec144cb 100644 --- a/orchestra/apps/orchestration/manager.py +++ b/orchestra/apps/orchestration/manager.py @@ -67,6 +67,8 @@ def execute(operations, async=False): backend.commit() execute = as_task(backend.execute) execute = close_connection(execute) + # DEBUG: substitute all thread related stuff for this function + #execute(server, async=async) thread = threading.Thread(target=execute, args=(server,), kwargs={'async': async}) thread.start() threads.append(thread) diff --git a/orchestra/apps/systemusers/models.py b/orchestra/apps/systemusers/models.py index 029d4d38..90996c1f 100644 --- a/orchestra/apps/systemusers/models.py +++ b/orchestra/apps/systemusers/models.py @@ -98,7 +98,7 @@ class SystemUser(models.Model): def validate_home(self, data, account): """ validates home based on account and data['shell'] """ if not 'username' in data and not self.pk: - # other validation will have raised for required username + # other validation will have been raised for required username return user = type(self)( username=data.get('username') or self.username, @@ -106,7 +106,7 @@ class SystemUser(models.Model): ) if 'home' in data and data['home']: home = data['home'].rstrip('/') - user_home = user.get_home().rstrip('/') + user_home = user.get_base_home().rstrip('/') account_home = account.main_systemuser.get_home().rstrip('/') if user.has_shell: if home != user_home: diff --git a/orchestra/forms/options.py b/orchestra/forms/options.py index 06297d1d..b1b707d0 100644 --- a/orchestra/forms/options.py +++ b/orchestra/forms/options.py @@ -2,7 +2,6 @@ from django import forms from django.contrib.auth import forms as auth_forms from django.utils.translation import ugettext, ugettext_lazy as _ -from .. import settings from ..core.validators import validate_password @@ -21,17 +20,7 @@ class UserCreationForm(forms.ModelForm): widget=forms.PasswordInput, help_text=_("Enter the same password as above, for verification.")) - def __init__(self, *args, **kwargs): - super(UserCreationForm, self).__init__(*args, **kwargs) - if settings.ORCHESTRA_MIGRATION_MODE: - self.fields['password1'].widget = forms.TextInput(attrs={'size':'130'}) - self.fields['password1'].help_text = _("RAW password digest (migration mode is enabled).") - self.fields['password2'].widget = forms.HiddenInput() - self.fields['password2'].required = False - def clean_password2(self): - if settings.ORCHESTRA_MIGRATION_MODE: - return self.cleaned_data.get('password1') password1 = self.cleaned_data.get('password1') password2 = self.cleaned_data.get('password2') if password1 and password2 and password1 != password2: @@ -53,10 +42,7 @@ class UserCreationForm(forms.ModelForm): def save(self, commit=True): user = super(UserCreationForm, self).save(commit=False) - if settings.ORCHESTRA_MIGRATION_MODE: - user.password = self.cleaned_data['password1'] - else: - user.set_password(self.cleaned_data['password1']) + user.set_password(self.cleaned_data['password1']) if commit: user.save() return user diff --git a/orchestra/settings.py b/orchestra/settings.py index b1d588d7..db9403e3 100644 --- a/orchestra/settings.py +++ b/orchestra/settings.py @@ -30,9 +30,6 @@ STOP_SERVICES = getattr(settings, 'STOP_SERVICES', API_ROOT_VIEW = getattr(settings, 'API_ROOT_VIEW', 'orchestra.api.root.APIRoot') -ORCHESTRA_MIGRATION_MODE = getattr(settings, 'ORCHESTRA_MIGRATION_MODE', False) - - ORCHESTRA_DEFAULT_SUPPORT_FROM_EMAIL = getattr(settings, 'ORCHESTRA_DEFAULT_SUPPORT_FROM_EMAIL', 'support@orchestra.lan' )