Merge lp:~brunogirin/charms/precise/python-django/username-password into lp:~charmers/charms/precise/python-django/trunk

Proposed by Bruno Girin
Status: Merged
Approved by: Brandon Holtsclaw
Approved revision: 23
Merged at revision: 22
Proposed branch: lp:~brunogirin/charms/precise/python-django/username-password
Merge into: lp:~charmers/charms/precise/python-django/trunk
Prerequisite: lp:~patrick-hetu/charms/precise/python-django/trunk
Diff against target: 50 lines (+25/-0)
2 files modified
config.yaml (+8/-0)
hooks/install (+17/-0)
To merge this branch: bzr merge lp:~brunogirin/charms/precise/python-django/username-password
Reviewer Review Type Date Requested Status
Brandon Holtsclaw (community) Approve
Review via email: mp+145230@code.launchpad.net

Description of the change

Added support for user name and password in the VCS repo to support repositories like the github private repositories. This implementation only works with URLs of the form protocol://domain/file and stores user name and password in the ~/.netrc file with 600 permissions.

To post a comment you must log in.
Revision history for this message
Brandon Holtsclaw (imbrandon) wrote :

Looks good to me, merging.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'config.yaml'
--- config.yaml 2013-01-28 20:07:29 +0000
+++ config.yaml 2013-01-28 20:07:29 +0000
@@ -8,6 +8,14 @@
8 type: string8 type: string
9 default: ""9 default: ""
10 description: The vcs url to checkout.10 description: The vcs url to checkout.
11 repos_username:
12 type: string
13 default: ""
14 description: The vcs user name.
15 repos_password:
16 type: string
17 default: ""
18 description: The vcs password.
11 extra_deb_pkgs:19 extra_deb_pkgs:
12 type: string20 type: string
13 default: ""21 default: ""
1422
=== modified file 'hooks/install'
--- hooks/install 2012-07-06 16:02:20 +0000
+++ hooks/install 2013-01-28 20:07:29 +0000
@@ -4,12 +4,29 @@
4UNIT_NAME=`echo $JUJU_UNIT_NAME | cut -d/ -f1`4UNIT_NAME=`echo $JUJU_UNIT_NAME | cut -d/ -f1`
5VCS=$(config-get vcs)5VCS=$(config-get vcs)
6REPOS_URL=$(config-get repos_url)6REPOS_URL=$(config-get repos_url)
7REPOS_USERNAME=$(config-get repos_username)
8REPOS_PASSWORD=$(config-get repos_password)
7EXTRA_DEB_PKGS=$(config-get extra_deb_pkgs)9EXTRA_DEB_PKGS=$(config-get extra_deb_pkgs)
8REQUIREMENTS=$(config-get requirements)10REQUIREMENTS=$(config-get requirements)
911
1012
11juju-log "django: Repos with $VCS and url: $REPOS_URL"13juju-log "django: Repos with $VCS and url: $REPOS_URL"
1214
15if [ -n "$REPOS_USERNAME" ]; then
16 if [[ "$REPOS_URL" =~ .*://([^/]+)/.* ]]; then
17 REPOS_DOMAIN=${BASH_REMATCH[1]}
18 cat >> ~/.netrc << EOF
19machine ${REPOS_DOMAIN}
20 login ${REPOS_USERNAME}
21 password ${REPOS_PASSWORD}
22
23EOF
24 chmod 600 ~/.netrc
25 else
26 juju-log "Cannot retrieve domain name from URL $REPOS_URL"
27 fi
28fi
29
13apt-get install -y python-django python-imaging python-docutils python-psycopg2 python-pip python-jinja2 mercurial git-core subversion bzr postgresql-client $EXTRA_DEB_PKGS30apt-get install -y python-django python-imaging python-docutils python-psycopg2 python-pip python-jinja2 mercurial git-core subversion bzr postgresql-client $EXTRA_DEB_PKGS
1431
1532

Subscribers

People subscribed via source and target branches

to all changes: