random fixes¡

This commit is contained in:
Marc 2014-10-17 13:09:56 +00:00
parent 1e8e57c979
commit b6a168390f
6 changed files with 27 additions and 8 deletions

View File

@ -76,3 +76,14 @@ Additionally the following command can be used in order to determine the current
python manage.py orchestraversion python manage.py orchestraversion
``` ```
Extra
=====
1. Generate a passwordless ssh key for orchestra user
ssh-keygen
2. Copy this key to all servers orchestra will manage, including itself is neccessary
ssh-copy-id root@<server-address>

View File

@ -45,10 +45,13 @@ class Bind9MasterDomainBackend(ServiceController):
self.delete_conf(context) self.delete_conf(context)
def delete_conf(self, context): def delete_conf(self, context):
if context['name'][0] in ('*', '_'):
# These can never be top level domains
return
self.append(textwrap.dedent(""" self.append(textwrap.dedent("""
awk -v s=%(name)s 'BEGIN { cat -s <(sed -e 's/^};/};\n/' named.conf.local) | \
RS=""; s="zone \\""s"\\"" awk -v s="%(name)s" 'BEGIN { RS=""; s="zone \""s"\"" } $0!~s{ print $0"\n" }' \
} $0!~s{ print $0"\\n" }' %(conf_path)s > %(conf_path)s.tmp""" % context > %(conf_path)s.tmp""" % context
)) ))
self.append('diff -I"^\s*//" %(conf_path)s.tmp %(conf_path)s || UPDATED=1' % context) self.append('diff -I"^\s*//" %(conf_path)s.tmp %(conf_path)s || UPDATED=1' % context)
self.append('mv %(conf_path)s.tmp %(conf_path)s' % context) self.append('mv %(conf_path)s.tmp %(conf_path)s' % context)

View File

@ -67,6 +67,7 @@ class SystemUser(models.Model):
basehome = basehome.replace('/./', '/') basehome = basehome.replace('/./', '/')
home = os.path.join(basehome, self.home) home = os.path.join(basehome, self.home)
# Chrooting # Chrooting
# TODO option for disabling chrooting
home = home.split('/') home = home.split('/')
home.insert(-2, '.') home.insert(-2, '.')
return '/'.join(home) return '/'.join(home)

View File

@ -33,7 +33,7 @@ class PHPFcgidBackend(WebAppServiceMixin, ServiceController):
def commit(self): def commit(self):
super(PHPFcgidBackend, self).commit() super(PHPFcgidBackend, self).commit()
self.append("[[ $UPDATED_APACHE == 1 ]] && { /etc/init.d/apache reload; }") self.append("[[ $UPDATED_APACHE == 1 ]] && { service apache2 reload; }")
def get_context(self, webapp): def get_context(self, webapp):
context = super(PHPFcgidBackend, self).get_context(webapp) context = super(PHPFcgidBackend, self).get_context(webapp)
@ -50,8 +50,7 @@ class PHPFcgidBackend(WebAppServiceMixin, ServiceController):
#!/bin/sh #!/bin/sh
# %(banner)s # %(banner)s
export PHPRC=/etc/%(type)s/cgi/ export PHPRC=/etc/%(type)s/cgi/
exec /usr/bin/%(type)s-cgi %(init_vars)s exec /usr/bin/%(type)s-cgi %(init_vars)s""" % context),
""" % context),
'wrapper_path': wrapper_path, 'wrapper_path': wrapper_path,
'wrapper_dir': os.path.dirname(wrapper_path), 'wrapper_dir': os.path.dirname(wrapper_path),
}) })

View File

@ -2,6 +2,7 @@ from django.conf import settings
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
# TODO make '%(mainuser_home)s/webapps...
WEBAPPS_BASE_ROOT = getattr(settings, 'WEBAPPS_BASE_ROOT', '/home/%(user)s/webapps/%(app_name)s/') WEBAPPS_BASE_ROOT = getattr(settings, 'WEBAPPS_BASE_ROOT', '/home/%(user)s/webapps/%(app_name)s/')
@ -30,8 +31,8 @@ WEBAPPS_TYPES = getattr(settings, 'WEBAPPS_TYPES', {
_("This creates a PHP5.5 application under ~/webapps/<app_name>\n" _("This creates a PHP5.5 application under ~/webapps/<app_name>\n"
"PHP-FPM will be used to execute PHP files.") "PHP-FPM will be used to execute PHP files.")
), ),
'php5': ( 'php5.2': (
_("PHP 5"), _("PHP 5.2"),
'fcgid', (WEBAPPS_FCGID_PATH,), 'fcgid', (WEBAPPS_FCGID_PATH,),
_("This creates a PHP5.2 application under ~/webapps/<app_name>\n" _("This creates a PHP5.2 application under ~/webapps/<app_name>\n"
"Apache-mod-fcgid will be used to execute PHP files.") "Apache-mod-fcgid will be used to execute PHP files.")

View File

@ -18,6 +18,10 @@ echo "from orchestra.apps.accounts.models import Account"
echo "account = Account.objects.get(pk=1)" echo "account = Account.objects.get(pk=1)"
ERRORS="" ERRORS=""
while read name; do while read name; do
[[ -f $name ]] && {
ZONE_PATH=${name%/*}
name=${name##*/}
}
ZONE=$(named-checkzone -D $name ${ZONE_PATH}/$name) ZONE=$(named-checkzone -D $name ${ZONE_PATH}/$name)
if [[ $? != 0 ]]; then if [[ $? != 0 ]]; then
ERRORS="${ERRORS} $name" ERRORS="${ERRORS} $name"