Merge lp://qastaging/~salgado/offspring/ssh_ui_mods into lp://qastaging/~linaro-automation/offspring/private-builds
Proposed by
Guilherme Salgado
Status: | Merged |
---|---|
Approved by: | James Tunnicliffe |
Approved revision: | 92 |
Merged at revision: | 75 |
Proposed branch: | lp://qastaging/~salgado/offspring/ssh_ui_mods |
Merge into: | lp://qastaging/~linaro-automation/offspring/private-builds |
Diff against target: |
705 lines (+479/-34) 10 files modified
lib/offspring/web/media/js/jquery.placeholder.js (+106/-0) lib/offspring/web/queuemanager/admin.py (+5/-3) lib/offspring/web/queuemanager/forms.py (+35/-7) lib/offspring/web/queuemanager/models.py (+38/-3) lib/offspring/web/queuemanager/tests/test_views.py (+107/-1) lib/offspring/web/queuemanager/views.py (+43/-0) lib/offspring/web/templates/queuemanager/project_create.html (+58/-18) lib/offspring/web/templates/queuemanager/project_edit.html (+16/-2) lib/offspring/web/templates/queuemanager/project_edit_credentials.html (+70/-0) lib/offspring/web/urls.py (+1/-0) |
To merge this branch: | bzr merge lp://qastaging/~salgado/offspring/ssh_ui_mods |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
James Tunnicliffe (community) | Approve | ||
Review via email:
|
Description of the change
A simplified version of https:/
To post a comment you must log in.
=== modified file 'lib/offspring/ web/queuemanage r/forms. py' web/queuemanage r/forms. py 2011-10-19 20:23:49 +0000 web/queuemanage r/forms. py 2011-11-08 21:32:23 +0000
--- lib/offspring/
+++ lib/offspring/
@@ -1,11 +1,9 @@
-# Copyright 2010 Canonical Ltd. This software is licensed under the
-# GNU Affero General Public License version 3 (see the file LICENSE).
+# Copyright 2010 Canonical Ltd. This software is licensed under the # GNU Affero General Public License version 3 (see the file LICENSE).
Seem to have lost a newline here.
=== modified file 'lib/offspring/ web/queuemanage r/models. py' web/queuemanage r/models. py 2011-10-21 16:44:19 +0000 web/queuemanage r/models. py 2011-11-08 21:32:23 +0000
--- lib/offspring/
+++ lib/offspring/
@@ -11,8 +11,10 @@
timedelta
)
import math
+import re
from django. contrib. auth.models import AnonymousUser, User core.exceptions import ValidationError
+from django.
from django.db import (
connection,
models
@@ -199,6 +201,25 @@
return is_visible_to(user)
+def validate_ lp_ssh_ key(value) : key_search_ regexp, value, re.DOTALL | re.MULTILINE) (msg) AccessGroupMixi n, MaybePrivateMixin): TextField( 'Launchpad User', null=True, editable=False, TextField( 'Launchpad User', null=True,
blank= True) TextField( "Launchpad User's SSH Key", blank=True, [validate_ lp_ssh_ key],
+ """Check to see if the value looks like an SSH private key"""
+ if not value:
+ return
+
+ key_search_regexp = (r"-----BEGIN \w+ PRIVATE KEY-----"+
+ r".*"+
+ r"-----END \w+ PRIVATE KEY-----")
+ is_key = re.search(
+
+ if not is_key:
+ msg = ("The key you entered doesn't appear to be valid. I am "+
+ "expecting a key in the form:\n "+
+ "-----BEGIN <type> PRIVATE KEY-----\n"+
+ "<ASCII key>\n"+
+ "-----END <type> PRIVATE KEY-----\n")
+ raise ValidationError
+
+
class Project(
#XXX: This should probably be managed in the database.
STATUS_CHOICES = (
@@ -233,10 +254,13 @@
# The Launchpad User and SSH key are stored per project. If we stored them
# per LauncpadProject, anyone who could create a Project referencing that
# LaunchpadProject could get access to the private data in it.
- lp_user = models.
+ lp_user = models.
- lp_ssh_key = models.
- null=True, editable=False)
+ lp_ssh_key = models.TextField(
+ "Launchpad User's SSH Key", blank=True, null=True, editable=True,
+ validators=
+ help_text=("Enter a private SSH ASCII key block, complete with begin "
+ "and end markers."))
notes = models. TextField( blank=True, null=True)
@@ -249,6 +273,17 @@
def __unicode__(self):
return self.display_name()
+ def clean(self):
+ if self.lp_user and not self.lp_ssh_key:
+ raise ValidationError(
+ "You must specify the SSH key for the given Launchpad user")
+ elif self.lp_ssh_key and not self.lp_user:
+ raise ValidationError(
+ "You must specify the Launchpad user for the given SSH key")
+ ...