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

Subscribers

People subscribed via source and target branches

to all changes: