Removed support for migration mode
This commit is contained in:
parent
f1e2fca584
commit
01842f224b
|
@ -38,7 +38,7 @@ class MySQLBackend(ServiceController):
|
||||||
return
|
return
|
||||||
context = self.get_context(database)
|
context = self.get_context(database)
|
||||||
self.append("mysql -e 'DROP DATABASE `%(database)s`;'" % context)
|
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):
|
def commit(self):
|
||||||
self.append("mysql -e 'FLUSH PRIVILEGES;'")
|
self.append("mysql -e 'FLUSH PRIVILEGES;'")
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from orchestra import settings as orchestra_settings
|
|
||||||
from orchestra.core.validators import validate_password
|
from orchestra.core.validators import validate_password
|
||||||
from orchestra.forms.widgets import ReadOnlyWidget
|
from orchestra.forms.widgets import ReadOnlyWidget
|
||||||
|
|
||||||
|
@ -23,16 +22,6 @@ class ListCreationForm(CleanAddressMixin, forms.ModelForm):
|
||||||
widget=forms.PasswordInput,
|
widget=forms.PasswordInput,
|
||||||
help_text=_("Enter the same password as above, for verification."))
|
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):
|
def clean_password2(self):
|
||||||
password1 = self.cleaned_data.get("password1")
|
password1 = self.cleaned_data.get("password1")
|
||||||
password2 = self.cleaned_data.get("password2")
|
password2 = self.cleaned_data.get("password2")
|
||||||
|
@ -41,12 +30,6 @@ class ListCreationForm(CleanAddressMixin, forms.ModelForm):
|
||||||
raise forms.ValidationError(msg)
|
raise forms.ValidationError(msg)
|
||||||
return password2
|
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):
|
class ListChangeForm(CleanAddressMixin, forms.ModelForm):
|
||||||
password = forms.CharField(label=_("Password"),
|
password = forms.CharField(label=_("Password"),
|
||||||
|
|
|
@ -67,6 +67,8 @@ def execute(operations, async=False):
|
||||||
backend.commit()
|
backend.commit()
|
||||||
execute = as_task(backend.execute)
|
execute = as_task(backend.execute)
|
||||||
execute = close_connection(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 = threading.Thread(target=execute, args=(server,), kwargs={'async': async})
|
||||||
thread.start()
|
thread.start()
|
||||||
threads.append(thread)
|
threads.append(thread)
|
||||||
|
|
|
@ -98,7 +98,7 @@ class SystemUser(models.Model):
|
||||||
def validate_home(self, data, account):
|
def validate_home(self, data, account):
|
||||||
""" validates home based on account and data['shell'] """
|
""" validates home based on account and data['shell'] """
|
||||||
if not 'username' in data and not self.pk:
|
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
|
return
|
||||||
user = type(self)(
|
user = type(self)(
|
||||||
username=data.get('username') or self.username,
|
username=data.get('username') or self.username,
|
||||||
|
@ -106,7 +106,7 @@ class SystemUser(models.Model):
|
||||||
)
|
)
|
||||||
if 'home' in data and data['home']:
|
if 'home' in data and data['home']:
|
||||||
home = data['home'].rstrip('/')
|
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('/')
|
account_home = account.main_systemuser.get_home().rstrip('/')
|
||||||
if user.has_shell:
|
if user.has_shell:
|
||||||
if home != user_home:
|
if home != user_home:
|
||||||
|
|
|
@ -2,7 +2,6 @@ from django import forms
|
||||||
from django.contrib.auth import forms as auth_forms
|
from django.contrib.auth import forms as auth_forms
|
||||||
from django.utils.translation import ugettext, ugettext_lazy as _
|
from django.utils.translation import ugettext, ugettext_lazy as _
|
||||||
|
|
||||||
from .. import settings
|
|
||||||
from ..core.validators import validate_password
|
from ..core.validators import validate_password
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,17 +20,7 @@ class UserCreationForm(forms.ModelForm):
|
||||||
widget=forms.PasswordInput,
|
widget=forms.PasswordInput,
|
||||||
help_text=_("Enter the same password as above, for verification."))
|
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):
|
def clean_password2(self):
|
||||||
if settings.ORCHESTRA_MIGRATION_MODE:
|
|
||||||
return self.cleaned_data.get('password1')
|
|
||||||
password1 = self.cleaned_data.get('password1')
|
password1 = self.cleaned_data.get('password1')
|
||||||
password2 = self.cleaned_data.get('password2')
|
password2 = self.cleaned_data.get('password2')
|
||||||
if password1 and password2 and password1 != password2:
|
if password1 and password2 and password1 != password2:
|
||||||
|
@ -53,10 +42,7 @@ class UserCreationForm(forms.ModelForm):
|
||||||
|
|
||||||
def save(self, commit=True):
|
def save(self, commit=True):
|
||||||
user = super(UserCreationForm, self).save(commit=False)
|
user = super(UserCreationForm, self).save(commit=False)
|
||||||
if settings.ORCHESTRA_MIGRATION_MODE:
|
user.set_password(self.cleaned_data['password1'])
|
||||||
user.password = self.cleaned_data['password1']
|
|
||||||
else:
|
|
||||||
user.set_password(self.cleaned_data['password1'])
|
|
||||||
if commit:
|
if commit:
|
||||||
user.save()
|
user.save()
|
||||||
return user
|
return user
|
||||||
|
|
|
@ -30,9 +30,6 @@ STOP_SERVICES = getattr(settings, 'STOP_SERVICES',
|
||||||
API_ROOT_VIEW = getattr(settings, 'API_ROOT_VIEW', 'orchestra.api.root.APIRoot')
|
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',
|
ORCHESTRA_DEFAULT_SUPPORT_FROM_EMAIL = getattr(settings, 'ORCHESTRA_DEFAULT_SUPPORT_FROM_EMAIL',
|
||||||
'support@orchestra.lan'
|
'support@orchestra.lan'
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue