From patchwork Thu Jul 25 23:08:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Terceiro X-Patchwork-Id: 18595 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f69.google.com (mail-vb0-f69.google.com [209.85.212.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C46F525DF6 for ; Thu, 25 Jul 2013 23:08:29 +0000 (UTC) Received: by mail-vb0-f69.google.com with SMTP id e12sf588795vbg.8 for ; Thu, 25 Jul 2013 16:08:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-beenthere:x-forwarded-to:x-forwarded-for:delivered-to :mime-version:x-launchpad-project:x-launchpad-branch :x-launchpad-message-rationale:x-launchpad-branch-revision-number :x-launchpad-notification-type:to:from:subject:message-id:date :reply-to:sender:errors-to:precedence:x-generated-by :x-launchpad-hash:x-gm-message-state:x-original-sender :x-original-authentication-results:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe :content-type; bh=h2tf0cW1Fpvnfz9I+jdYWFVXHMv6MmI5pUKzvKUnVpM=; b=O7ajK7r15GMJDwsdewyBjDoyx+Lo48LC/MinW2r+oSgl9IelB2TTVhSscAmhPNjhr/ BU/kTu0EbWz0jHCzUAiKIV2jsyyvE8LOwmG9aTRwMF/W9G7hOBFNm5BzMYS7mrk3eJuj anJbB3He+JbQvCfx9+TMxgtcT9F/c0RU0+7iHiljeYzTbVLhKxqKG9H1qat0ZqmFEdpF hJON5LXaVx4ns7zGPSlQ2R+6TzWvaTEdC7bYTaCT2QNKneiddggCLSjJY3iKpzUtF1vh dhv5IKTR5+1dXLG+6eOvOmOJZDY+QdZUbVyjIMY+P04ccsBxXwIcCd5aJCPIJLAyORHA NOuQ== X-Received: by 10.224.86.200 with SMTP id t8mr58278412qal.0.1374793708995; Thu, 25 Jul 2013 16:08:28 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.60.70 with SMTP id f6ls171898qer.59.gmail; Thu, 25 Jul 2013 16:08:28 -0700 (PDT) X-Received: by 10.58.236.70 with SMTP id us6mr19056468vec.89.1374793708858; Thu, 25 Jul 2013 16:08:28 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id aj7si13168504vec.21.2013.07.25.16.08.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 25 Jul 2013 16:08:28 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id kw10so91211vcb.15 for ; Thu, 25 Jul 2013 16:08:28 -0700 (PDT) X-Received: by 10.52.35.109 with SMTP id g13mr16053946vdj.21.1374793708725; Thu, 25 Jul 2013 16:08:28 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.165.8 with SMTP id yu8csp100573veb; Thu, 25 Jul 2013 16:08:28 -0700 (PDT) X-Received: by 10.180.12.80 with SMTP id w16mr3630773wib.47.1374793707573; Thu, 25 Jul 2013 16:08:27 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id vf8si19749075wjc.146.2013.07.25.16.08.27 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 25 Jul 2013 16:08:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1V2Ue2-00010d-VF for ; Thu, 25 Jul 2013 23:08:27 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id DDE67E000F for ; Thu, 25 Jul 2013 23:08:26 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: lava-server X-Launchpad-Branch: ~linaro-validation/lava-server/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 414 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-server/trunk] Rev 414: Do not require changing server source code to enable crowd authentication Message-Id: <20130725230826.9491.30743.launchpad@ackee.canonical.com> Date: Thu, 25 Jul 2013 23:08:26 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: list X-Generated-By: Launchpad (canonical.com); Revision="16700"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: c585657778bba0cd353bb02fa2b72a5839e7ce25 X-Gm-Message-State: ALoCoQmEIZJyif85x/hbVUlTiAgxINJejlc1X1I5H3gUyewSDDGMSHFT86lJ98DyLuXKYz+ceav2 X-Original-Sender: noreply@launchpad.net X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Merge authors: Antonio Terceiro (terceiro) Related merge proposals: https://code.launchpad.net/~terceiro/lava-server/crowd-config/+merge/176837 proposed by: Antonio Terceiro (terceiro) review: Approve - Paul Sokolovsky (pfalcon) ------------------------------------------------------------ revno: 414 [merge] committer: Antonio Terceiro branch nick: trunk timestamp: Thu 2013-07-25 20:06:24 -0300 message: Do not require changing server source code to enable crowd authentication added: lava_server/settings/crowd.py modified: lava_server/settings/common.py setup.py --- lp:lava-server https://code.launchpad.net/~linaro-validation/lava-server/trunk You are subscribed to branch lp:lava-server. To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-server/trunk/+edit-subscription === modified file 'lava_server/settings/common.py' --- lava_server/settings/common.py 2013-07-25 12:07:17 +0000 +++ lava_server/settings/common.py 2013-07-25 23:06:24 +0000 @@ -16,6 +16,7 @@ # You should have received a copy of the GNU Affero General Public License # along with LAVA Server. If not, see . +import lava_server.settings.crowd as crowd # Administrator contact, used for sending # emergency email when something breaks @@ -120,11 +121,16 @@ 'linaro_django_xmlrpc', 'lava_markitup', # Support app for MarkItUp in LAVA 'south', - # Uncomment to enable Atlassian Crowd auth support. - #'crowdrest', 'google_analytics', ] +if crowd.enabled: + try: + import crowdrest + INSTALLED_APPS.append('crowdrest') + except ImportError: + pass + try: import devserver INSTALLED_APPS += ['devserver'] @@ -163,9 +169,9 @@ # Configuration settings for crowdrest.backend.CrowdRestBackend # Alternatively, can be set in production config for particular installed # instance. -#AUTH_CROWD_APPLICATION_USER = 'appname' -#AUTH_CROWD_APPLICATION_PASSWORD = 'apppass' -#AUTH_CROWD_SERVER_REST_URI = 'https://crowd-server/crowd/rest/usermanagement/1' +AUTH_CROWD_APPLICATION_USER = crowd.settings.get('username', 'appname') +AUTH_CROWD_APPLICATION_PASSWORD = crowd.settings.get('password', 'apppass') +AUTH_CROWD_SERVER_REST_URI = crowd.settings.get('apiurl', 'https://crowd-server/crowd/rest/usermanagement/1') RESTRUCTUREDTEXT_FILTER_SETTINGS = {"initial_header_level": 4} === added file 'lava_server/settings/crowd.py' --- lava_server/settings/crowd.py 1970-01-01 00:00:00 +0000 +++ lava_server/settings/crowd.py 2013-07-25 02:09:32 +0000 @@ -0,0 +1,24 @@ +import os +import yaml + +search_path = [ + '/etc/lava-server/crowd.yaml' +] + +if "VIRTUAL_ENV" in os.environ: + search_path.insert(0, os.path.join(os.environ["VIRTUAL_ENV"], + 'etc/lava-server/crowd.yaml')) + +config_file = None + +for f in search_path: + if os.path.exists(f): + config_file = f + break + +enabled = (config_file is not None) + +settings = {} + +if config_file: + settings = yaml.load(open(config_file)) === modified file 'setup.py' --- setup.py 2013-07-11 11:26:54 +0000 +++ setup.py 2013-07-25 23:02:35 +0000 @@ -73,10 +73,9 @@ 'south >= 0.7.3', 'versiontools >= 1.8', 'markdown >= 2.0.3', - # Disabled by default, as most people don't need - # Atlassian Crowd auth. Handled on the level of - # buildout.cfg instead. - #'django-crowd-rest-backend >= 0.3', + + # optional dependency; for authentication with Attlassian Crowd SSO + # 'django-crowd-rest-backend >= 0.3, ], setup_requires=[ 'versiontools >= 1.8',