Merge lp:~lazypower/charms/trusty/liferay/fix_1364680 into lp:charms/liferay

Proposed by Charles Butler
Status: Rejected
Rejected by: Charles Butler
Proposed branch: lp:~lazypower/charms/trusty/liferay/fix_1364680
Merge into: lp:charms/liferay
Diff against target: 108 lines (+63/-10)
3 files modified
hooks/install (+5/-7)
inc/common (+57/-2)
tests/99-autogen (+1/-1)
To merge this branch: bzr merge lp:~lazypower/charms/trusty/liferay/fix_1364680
Reviewer Review Type Date Requested Status
charmers Pending
Review via email: mp+241093@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

8. By Charles Butler

Refactor charm for trusty: modify the tests to deploy trusty, embed some download helpers in inc/common, remove charm-helpers-sh dependency

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/install'
2--- hooks/install 2013-07-15 13:57:38 +0000
3+++ hooks/install 2014-11-07 15:19:15 +0000
4@@ -5,16 +5,14 @@
5 source inc/latest-release
6
7 # unzip needed to unzip Liferay, JDK needed to run it
8-juju-log "Fetching and installing unzip, openjdk-7-jdk, charm-tools, charm-helper-sh"
9-
10-apt-get -y install unzip openjdk-7-jre-headless charm-tools charm-helper-sh
11-
12-# get some charm tools for download and verification steps
13-. "/usr/share/charm-helper/sh/net.sh"
14+juju-log "Fetching and installing unzip, openjdk-7-jdk, charm-tools"
15+
16+apt-get -y install unzip openjdk-7-jre-headless charm-tools
17+
18
19 # download and extract liferay to a temporary spot
20 juju-log "Fetching latest upstream Liferay release from $LR_URL with expected hash $LR_HASH"
21-DOWNLOAD=`ch_get_file "$LR_URL" "$LR_HASH"`
22+DOWNLOAD=`get_file "$LR_URL" "$LR_HASH"`
23
24 if [ ! -f "${DOWNLOAD}" ] || [ -z "${DOWNLOAD}" ]; then
25 juju-log "Failed to retrieve ${LR_URL}"
26
27=== modified file 'inc/common'
28--- inc/common 2013-06-14 17:15:00 +0000
29+++ inc/common 2014-11-07 15:19:15 +0000
30@@ -42,7 +42,62 @@
31 juju-log "Cannot load current config from ${CHARM_DIR}/.current-config"
32 exit 1
33 fi
34-
35+
36 source ${CHARM_DIR}/.current-config
37
38-}
39\ No newline at end of file
40+}
41+
42+# These are modified and embedded helpers that originated in the charm-helpes-sh
43+# package. Not the most elegant solution, but far better tested than what I had
44+# originally proposed.
45+
46+WGET_ARGS=${WGET_ARGS:-" --content-disposition"}
47+get_file()
48+{
49+ local FILE=${1:-""}
50+ local HASH=${2:-""}
51+ local CH_DOWNLOAD_DIR=${CH_DOWNLOAD_DIR:-"`mktemp -d /tmp/ch-downloads.XXXXXX`"}
52+
53+ wget $WGET_ARGS --directory-prefix="$CH_DOWNLOAD_DIR/" "$FILE"
54+ FILE=$CH_DOWNLOAD_DIR/$(ls -tr $CH_DOWNLOAD_DIR|head -n 1)
55+
56+ if [ ! -f "$FILE" ]; then
57+ return 2
58+ fi
59+
60+ local HASH_TYPE=$(type_hash $HASH)
61+ local FILE_HASH=$(${HASH_TYPE}sum $FILE | awk '{ print $1 }')
62+
63+ if [ "$FILE_HASH" != "$HASH" ]; then
64+ return 4
65+ fi
66+
67+
68+ echo "$FILE"
69+ return 0
70+}
71+
72+type_hash()
73+{
74+ local DIRTY="$1"
75+
76+ case $DIRTY in
77+ *[![:xdigit:]]* | "" )
78+ echo ""
79+ return 1
80+ ;;
81+ * )
82+ case ${#DIRTY} in
83+ 32 )
84+ echo md5
85+ ;;
86+ 40 )
87+ echo sha1
88+ ;;
89+ 64 )
90+ echo sha256
91+ ;;
92+ esac
93+ ;;
94+ esac
95+}
96
97=== modified file 'tests/99-autogen'
98--- tests/99-autogen 2014-11-06 19:21:11 +0000
99+++ tests/99-autogen 2014-11-07 15:19:15 +0000
100@@ -8,7 +8,7 @@
101 class TestDeployment(unittest.TestCase):
102 @classmethod
103 def setUpClass(cls):
104- cls.deployment = amulet.Deployment(series='precise')
105+ cls.deployment = amulet.Deployment(series='trusty')
106
107 cls.deployment.add('liferay')
108 cls.deployment.add('mysql')

Subscribers

People subscribed via source and target branches

to all changes: