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
1=== modified file 'config.yaml'
2--- config.yaml 2013-01-28 20:07:29 +0000
3+++ config.yaml 2013-01-28 20:07:29 +0000
4@@ -8,6 +8,14 @@
5 type: string
6 default: ""
7 description: The vcs url to checkout.
8+ repos_username:
9+ type: string
10+ default: ""
11+ description: The vcs user name.
12+ repos_password:
13+ type: string
14+ default: ""
15+ description: The vcs password.
16 extra_deb_pkgs:
17 type: string
18 default: ""
19
20=== modified file 'hooks/install'
21--- hooks/install 2012-07-06 16:02:20 +0000
22+++ hooks/install 2013-01-28 20:07:29 +0000
23@@ -4,12 +4,29 @@
24 UNIT_NAME=`echo $JUJU_UNIT_NAME | cut -d/ -f1`
25 VCS=$(config-get vcs)
26 REPOS_URL=$(config-get repos_url)
27+REPOS_USERNAME=$(config-get repos_username)
28+REPOS_PASSWORD=$(config-get repos_password)
29 EXTRA_DEB_PKGS=$(config-get extra_deb_pkgs)
30 REQUIREMENTS=$(config-get requirements)
31
32
33 juju-log "django: Repos with $VCS and url: $REPOS_URL"
34
35+if [ -n "$REPOS_USERNAME" ]; then
36+ if [[ "$REPOS_URL" =~ .*://([^/]+)/.* ]]; then
37+ REPOS_DOMAIN=${BASH_REMATCH[1]}
38+ cat >> ~/.netrc << EOF
39+machine ${REPOS_DOMAIN}
40+ login ${REPOS_USERNAME}
41+ password ${REPOS_PASSWORD}
42+
43+EOF
44+ chmod 600 ~/.netrc
45+ else
46+ juju-log "Cannot retrieve domain name from URL $REPOS_URL"
47+ fi
48+fi
49+
50 apt-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
51
52

Subscribers

People subscribed via source and target branches

to all changes: