From 7c5165f753befcb29222e5655dcf44e2fd40ec9e Mon Sep 17 00:00:00 2001 From: Marc Aymerich Date: Mon, 2 Mar 2015 12:07:27 +0000 Subject: [PATCH] Fixed ftp traffic backend --- orchestra/apps/accounts/models.py | 3 ++- orchestra/apps/resources/admin.py | 4 ++-- orchestra/apps/systemusers/backends.py | 15 +++++++++------ orchestra/apps/systemusers/models.py | 2 +- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/orchestra/apps/accounts/models.py b/orchestra/apps/accounts/models.py index e9bfa914..14d472ab 100644 --- a/orchestra/apps/accounts/models.py +++ b/orchestra/apps/accounts/models.py @@ -13,7 +13,8 @@ from . import settings class Account(auth.AbstractBaseUser): - username = models.CharField(_("username"), max_length=64, unique=True, + # Username max_length determined by LINUX system user lentgh: 32 + username = models.CharField(_("username"), max_length=32, unique=True, help_text=_("Required. 64 characters or fewer. Letters, digits and ./-/_ only."), validators=[validators.RegexValidator(r'^[\w.-]+$', _("Enter a valid username."), 'invalid')]) diff --git a/orchestra/apps/resources/admin.py b/orchestra/apps/resources/admin.py index ed050e0e..5ab17e88 100644 --- a/orchestra/apps/resources/admin.py +++ b/orchestra/apps/resources/admin.py @@ -87,12 +87,12 @@ class ResourceAdmin(ExtendedModelAdmin): class ResourceDataAdmin(ExtendedModelAdmin): list_display = ( - 'id', 'resource_link', 'content_object_link', 'display_used', 'allocated', 'display_unit', + 'id', 'resource_link', 'content_object_link', 'allocated', 'display_used', 'display_unit', 'display_updated' ) list_filter = ('resource',) fields = ( - 'resource_link', 'content_type', 'content_object_link', 'display_used', 'display_updated', + 'resource_link', 'content_type', 'content_object_link', 'display_updated', 'display_used', 'allocated', 'display_unit' ) search_fields = ('object_id',) diff --git a/orchestra/apps/systemusers/backends.py b/orchestra/apps/systemusers/backends.py index 7d5045f2..158d5614 100644 --- a/orchestra/apps/systemusers/backends.py +++ b/orchestra/apps/systemusers/backends.py @@ -36,10 +36,12 @@ class SystemUserBackend(ServiceController): def delete(self, user): context = self.get_context(user) - self.append("{ sleep 2 && killall -u %(username)s -s KILL; } &" % context) - self.append("killall -u %(username)s || true" % context) - self.append("userdel %(username)s || true" % context) - self.append("groupdel %(username)s || true" % context) + self.append(textwrap.dedent("""\ + { sleep 2 && killall -u %(username)s -s KILL; } & + killall -u %(username)s || true + userdel %(username)s || true + groupdel %(username)s || true""" % context + )) self.delete_home(context, user) def grant_permission(self, user): @@ -131,10 +133,11 @@ class FTPTraffic(ServiceMonitor): months["Nov"] = "11" months["Dec"] = "12" } { - # Fri Jul 11 13:23:17 2014 + # Fri Jul 1 13:23:17 2014 split($4, time, ":") + day = sprintf("%02d", $3) # line_date = year month day hour minute second - line_date = $5 months[$2] $3 time[1] time[2] time[3] + line_date = $5 months[$2] day time[1] time[2] time[3] if ( line_date > ini && line_date < end) { sum += $(NF-2) } diff --git a/orchestra/apps/systemusers/models.py b/orchestra/apps/systemusers/models.py index c178054e..d7cace57 100644 --- a/orchestra/apps/systemusers/models.py +++ b/orchestra/apps/systemusers/models.py @@ -24,7 +24,7 @@ class SystemUser(models.Model): """ System users - Username max_length determined by min(user, group) on common LINUX systems; min(32, 16) + Username max_length determined by LINUX system user lentgh: 32 """ # TODO max_length username = models.CharField(_("username"), max_length=32, unique=True,