Small fixes

This commit is contained in:
Marc Aymerich 2015-05-11 14:22:36 +00:00
parent 20ccadf3e1
commit b8c815edf2
8 changed files with 17 additions and 22 deletions

12
TODO.md
View File

@ -354,15 +354,3 @@ make django admin taskstate uncollapse fucking traceback, ( if exists ?)
resorce monitoring more efficient, less mem an better queries for calc current data resorce monitoring more efficient, less mem an better queries for calc current data
# best_price rating method # best_price rating method
# paramiko arcfour cypher
ciphers=['arcfour128', 'aes256']
http://paramiko-docs.readthedocs.org/en/latest/api/transport.html
* Grant and revoke permissions
setfacl: /home/marcay//logs: Operation not permitted

View File

@ -211,7 +211,7 @@ class ServiceBackend(plugins.Plugin, metaclass=ServiceMount):
self.append( self.append(
'set -e\n' 'set -e\n'
'set -o pipefail\n' 'set -o pipefail\n'
'exit_code=0;' 'exit_code=0;\n'
) )
def commit(self): def commit(self):

View File

@ -26,7 +26,8 @@ def set_permission(modeladmin, request, queryset):
messages.error("Users from the same account should be selected.") messages.error("Users from the same account should be selected.")
user = queryset[0] user = queryset[0]
form = PermissionForm(user) form = PermissionForm(user)
if request.method == 'POST': action_value = 'set_permission'
if request.POST.get('action') == action_value:
form = PermissionForm(user, request.POST) form = PermissionForm(user, request.POST)
if form.is_valid(): if form.is_valid():
cleaned_data = form.cleaned_data cleaned_data = form.cleaned_data
@ -56,7 +57,7 @@ def set_permission(modeladmin, request, queryset):
context = { context = {
'title': _("Set permission"), 'title': _("Set permission"),
'action_name': _("Set permission"), 'action_name': _("Set permission"),
'action_value': 'set_permission', 'action_value': action_value,
'queryset': queryset, 'queryset': queryset,
'opts': opts, 'opts': opts,
'obj': user, 'obj': user,

View File

@ -80,7 +80,6 @@ class UNIXUserBackend(ServiceController):
exclude_acl.append('-not -path "%(perm_home)s/%(exclude)s"' % context) exclude_acl.append('-not -path "%(perm_home)s/%(exclude)s"' % context)
if exclude_acl: if exclude_acl:
context['exclude'] = ' \\\n -a '.join(exclude_acl) context['exclude'] = ' \\\n -a '.join(exclude_acl)
if user.set_perm_perms == 'read-write': if user.set_perm_perms == 'read-write':
context['perm_perms'] = 'rwx' if user.set_perm_action == 'grant' else '---' context['perm_perms'] = 'rwx' if user.set_perm_action == 'grant' else '---'
elif user.set_perm_perms == 'read-only': elif user.set_perm_perms == 'read-only':

View File

@ -62,6 +62,6 @@ SYSTEMUSERS_MOVE_ON_DELETE_PATH = Setting('SYSTEMUSERS_MOVE_ON_DELETE_PATH',
SYSTEMUSERS_EXLUDE_ACL_PATHS = Setting('SYSTEMUSERS_EXLUDE_ACL_PATHS', SYSTEMUSERS_EXLUDE_ACL_PATHS = Setting('SYSTEMUSERS_EXLUDE_ACL_PATHS',
(), (),
help_text=("Relative to user's home.<br>" help_text=("Exlude ACL operations on provided globs, relative to user's home.<br>"
"e.g. ('logs', 'logs/apache*', 'webapps')"), "e.g. ('logs', 'logs/apache*', 'webapps')"),
) )

View File

@ -106,27 +106,27 @@ class Apache2Backend(ServiceController):
echo -e "${apache_conf}" | diff -N -I'^\s*#' %(sites_available)s - echo -e "${apache_conf}" | diff -N -I'^\s*#' %(sites_available)s -
} || { } || {
echo -e "${apache_conf}" > %(sites_available)s echo -e "${apache_conf}" > %(sites_available)s
UPDATED=1 UPDATED_APACHE=1
}""") % context }""") % context
) )
if context['server_name'] and site.active: if context['server_name'] and site.active:
self.append(textwrap.dedent("""\ self.append(textwrap.dedent("""\
if [[ ! -f %(sites_enabled)s ]]; then if [[ ! -f %(sites_enabled)s ]]; then
a2ensite %(site_unique_name)s.conf a2ensite %(site_unique_name)s.conf
UPDATED=1 UPDATED_APACHE=1
fi""") % context fi""") % context
) )
else: else:
self.append(textwrap.dedent("""\ self.append(textwrap.dedent("""\
if [[ -f %(sites_enabled)s ]]; then if [[ -f %(sites_enabled)s ]]; then
a2dissite %(site_unique_name)s.conf; a2dissite %(site_unique_name)s.conf;
UPDATED=1 UPDATED_APACHE=1
fi""") % context fi""") % context
) )
def delete(self, site): def delete(self, site):
context = self.get_context(site) context = self.get_context(site)
self.append("a2dissite %(site_unique_name)s.conf && UPDATED=1" % context) self.append("a2dissite %(site_unique_name)s.conf && UPDATED_APACHE=1" % context)
self.append("rm -f %(sites_available)s" % context) self.append("rm -f %(sites_available)s" % context)
def prepare(self): def prepare(self):

View File

@ -79,3 +79,9 @@ ORCHESTRA_DEFAULT_SUPPORT_FROM_EMAIL = Setting('ORCHESTRA_DEFAULT_SUPPORT_FROM_E
ORCHESTRA_EDIT_SETTINGS = Setting('ORCHESTRA_EDIT_SETTINGS', ORCHESTRA_EDIT_SETTINGS = Setting('ORCHESTRA_EDIT_SETTINGS',
True True
) )
ORCHESTRA_SSH_CONTROL_PATH = Setting('ORCHESTRA_SSH_CONTROL_PATH',
'~/.ssh/orchestra-%r-%h-%p',
help_text='Location for the control socket used by the multiplexed sessions, used for SSH connection reuse.'
)

View File

@ -141,12 +141,13 @@ def run(command, display=False, valid_codes=(0,), silent=False, stdin=b'', async
def sshrun(addr, command, *args, executable='bash', persist=False, **kwargs): def sshrun(addr, command, *args, executable='bash', persist=False, **kwargs):
from .. import settings
options = ['stricthostkeychecking=no'] options = ['stricthostkeychecking=no']
if persist: if persist:
options.extend(( options.extend((
'ControlMaster=auto', 'ControlMaster=auto',
'ControlPersist=yes', 'ControlPersist=yes',
'ControlPath=~/.ssh/orchestra-%r-%h-%p', 'ControlPath=' + settings.ORCHESTRA_SSH_CONTROL_PATH,
)) ))
options = ' -o '.join(options) options = ' -o '.join(options)
cmd = 'ssh -o {options} -C root@{addr} {executable}'.format(options=options, addr=addr, cmd = 'ssh -o {options} -C root@{addr} {executable}'.format(options=options, addr=addr,