From patchwork Tue Aug 6 09:54:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Sokolovsky X-Patchwork-Id: 18791 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f72.google.com (mail-qa0-f72.google.com [209.85.216.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C4E9125DF6 for ; Tue, 6 Aug 2013 09:54:28 +0000 (UTC) Received: by mail-qa0-f72.google.com with SMTP id o19sf567536qap.7 for ; Tue, 06 Aug 2013 02:54:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:delivered-to:mime-version:to:from:subject :message-id:date:reply-to:sender:errors-to:precedence :x-original-sender:x-original-authentication-results:mailing-list :list-id:list-post:list-help:list-archive:list-unsubscribe :content-type; bh=8LNZaB7SV+Rg9yY2Tgmpl1hfsFnMi3LRLFNvonIipeQ=; b=SUtuZqOE+dUkZKxjVhYEjlkl0ui6DwraaieR3qWWeLdmZkymPmc6HTsJL1N1d/DWBo 7WkT7ahOWtSmkFvgkj8DKxcNAg3xq3K2KLIOtvW7eJJJBuFMxzjlD6Yb6CJKdir/HdKH 7SSkYUhGk5CGldVjImTClFDj5M/xUs/9EWQbEgz6D+I6GqWe8hLhVDCi4QUVDhF2DT5K Vc1Ka/S/C2QD9frNGmDMDTrxY3PPlCcI7T4W1VBnoLQKEVGbjs53qaiUsGtM84nkcR8Y y4kFi0yVFa1P79ibaMuJHncEcwTtS8toY+pS5gYen6Wzd1j7lAD0CJIlZKAuKoh2gNvF s5Eg== X-Received: by 10.236.51.225 with SMTP id b61mr202325yhc.4.1375782868397; Tue, 06 Aug 2013 02:54:28 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.5.197 with SMTP id u5ls148233qeu.84.gmail; Tue, 06 Aug 2013 02:54:28 -0700 (PDT) X-Received: by 10.58.109.5 with SMTP id ho5mr156380veb.10.1375782868282; Tue, 06 Aug 2013 02:54:28 -0700 (PDT) Received: from mail-vb0-f41.google.com (mail-vb0-f41.google.com [209.85.212.41]) by mx.google.com with ESMTPS id sd9si104476vdc.117.2013.08.06.02.54.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 06 Aug 2013 02:54:28 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.41 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.41; Received: by mail-vb0-f41.google.com with SMTP id g17so149085vbg.14 for ; Tue, 06 Aug 2013 02:54:28 -0700 (PDT) X-Gm-Message-State: ALoCoQkraU4bW20fD/CpYyk30mayO8EEAD4hXLnw67pqG3Cc1L1xtmg/4lDPpCg767WpTTUShC1f X-Received: by 10.52.180.229 with SMTP id dr5mr129078vdc.20.1375782868102; Tue, 06 Aug 2013 02:54: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.221.11.8 with SMTP id pc8csp136581vcb; Tue, 6 Aug 2013 02:54:27 -0700 (PDT) X-Received: by 10.180.74.210 with SMTP id w18mr1376710wiv.20.1375782866933; Tue, 06 Aug 2013 02:54:26 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id ot3si302895wjc.141.2013.08.06.02.54.26 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 06 Aug 2013 02:54:26 -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 1V6dyE-0002KM-9R for ; Tue, 06 Aug 2013 09:54:26 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 34773E0977 for ; Tue, 6 Aug 2013 09:54: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: 415 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-server/trunk] Rev 415: Get Crowd auth settings using django-debian package. Message-Id: <20130806095426.8406.51145.launchpad@ackee.canonical.com> Date: Tue, 06 Aug 2013 09:54: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="16718"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 0e573ca0722c1097aee015abe38b86cab504d136 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: noreply@launchpad.net X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.41 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: Paul Sokolovsky (pfalcon) Related merge proposals: https://code.launchpad.net/~pfalcon/lava-server/crowd-settings-final/+merge/177825 proposed by: Paul Sokolovsky (pfalcon) review: Approve - Antonio Terceiro (terceiro) ------------------------------------------------------------ revno: 415 [merge] committer: Paul Sokolovsky branch nick: lava-server timestamp: Tue 2013-08-06 12:52:32 +0300 message: Get Crowd auth settings using django-debian package. Main settings are in /srv/lava/instances/*/etc/lava-server/settings.conf and credentials are in /srv/lava/instances/*/etc/lava-server/crowd.conf removed: lava_server/settings/crowd.py modified: lava_server/context_processors.py lava_server/settings/common.py lava_server/settings/debian.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/context_processors.py' --- lava_server/context_processors.py 2013-07-23 13:29:45 +0000 +++ lava_server/context_processors.py 2013-07-30 15:28:17 +0000 @@ -47,7 +47,7 @@ lava_server.__version__, hint=lava_server)}} def openid_available(request): - openid_enabled = "django_openid_auth.auth.OpenIDBackend" in lava_server.settings.common.AUTHENTICATION_BACKENDS + openid_enabled = "django_openid_auth.auth.OpenIDBackend" in settings.AUTHENTICATION_BACKENDS # Check if we use generic OpenID or Launchpad.net openid_url = getattr(settings, "OPENID_SSO_SERVER_URL", "") if "ubuntu.com" in openid_url or "launchpad.net" in openid_url: === modified file 'lava_server/settings/common.py' --- lava_server/settings/common.py 2013-07-25 23:06:24 +0000 +++ lava_server/settings/common.py 2013-08-05 17:39:08 +0000 @@ -1,4 +1,4 @@ -# Copyright (C) 2010, 2011 Linaro Limited +# Copyright (C) 2010-2013 Linaro Limited # # Author: Zygmunt Krynicki # @@ -16,7 +16,15 @@ # 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 + +# WARNING: +# Never edit this file on a production system! +# Any changes can be overwritten at any time by upgrade or any +# system management operation. All production config changes +# should happen strictly to etc/settings.conf, etc. files. +# All comments below are strictly for development usage and +# reference. + # Administrator contact, used for sending # emergency email when something breaks @@ -124,13 +132,6 @@ 'google_analytics', ] -if crowd.enabled: - try: - import crowdrest - INSTALLED_APPS.append('crowdrest') - except ImportError: - pass - try: import devserver INSTALLED_APPS += ['devserver'] @@ -166,13 +167,6 @@ from openid import oidutil oidutil.log = lambda msg, level=0: None -# Configuration settings for crowdrest.backend.CrowdRestBackend -# Alternatively, can be set in production config for particular installed -# instance. -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} # Add google analytics model. === removed file 'lava_server/settings/crowd.py' --- lava_server/settings/crowd.py 2013-07-25 02:09:32 +0000 +++ lava_server/settings/crowd.py 1970-01-01 00:00:00 +0000 @@ -1,24 +0,0 @@ -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 'lava_server/settings/debian.py' --- lava_server/settings/debian.py 2012-09-24 02:55:36 +0000 +++ lava_server/settings/debian.py 2013-07-30 14:22:38 +0000 @@ -87,6 +87,22 @@ OPENID_LAUNCHPAD_TEAMS_MAPPING_AUTO = False OPENID_LAUNCHPAD_TEAMS_MAPPING = debian_settings.get_setting("OPENID_LAUNCHPAD_TEAMS_MAPPING") +# Atlassian Crowd authentication config +AUTH_CROWD_SERVER_REST_URI = debian_settings.get_setting("AUTH_CROWD_SERVER_REST_URI") +if AUTH_CROWD_SERVER_REST_URI: + # If Crowd server URL is configured, disable OpenID and + # enable Crowd auth backend + INSTALLED_APPS.append('crowdrest') + AUTHENTICATION_BACKENDS = ['crowdrest.backend.CrowdRestBackend'] + \ + [x for x in AUTHENTICATION_BACKENDS if "OpenID" not in x] + + # Load credentials from a separate file + from django_debian.config_file import ConfigFile + pathname = debian_settings._get_pathname("crowd") + crowd_config = ConfigFile.load(pathname) + AUTH_CROWD_APPLICATION_USER = crowd_config.AUTH_CROWD_APPLICATION_USER + AUTH_CROWD_APPLICATION_PASSWORD = crowd_config.AUTH_CROWD_APPLICATION_PASSWORD + # Load extensions loader.contribute_to_settings(locals(), debian_settings)