Merge lp:~kwmonroe/charms/trusty/zulu8/promulgated-source into lp:~azulcharmers/charms/trusty/zulu8/source

Proposed by Kevin W Monroe
Status: Merged
Merged at revision: 18
Proposed branch: lp:~kwmonroe/charms/trusty/zulu8/promulgated-source
Merge into: lp:~azulcharmers/charms/trusty/zulu8/source
Diff against target: 148 lines (+62/-7)
5 files modified
Makefile (+8/-0)
README.md (+4/-4)
reactive/install (+15/-3)
tests/01-deploy.py (+33/-0)
tests/tests.yaml (+2/-0)
To merge this branch: bzr merge lp:~kwmonroe/charms/trusty/zulu8/promulgated-source
Reviewer Review Type Date Requested Status
Azul Charmers Pending
Review via email: mp+288727@code.launchpad.net

Description of the change

This is the source branch that was used to build the Zulu8 charm available here:

https://jujucharms.com/zulu8/trusty/2

I noticed this is a few commits ahead of your lp:~azulcharmers/charms/trusty/zulu8/source branch, so I wanted to create this merge proposal to get your branch updated. Notable changes:

+ include tests in the layered source (these were in your ./trunk branch, but they need to live in the ./source branch since that is where 'charm build' will look for them when creating a deployable charm)

+ minor README and logging updates (I noticed 'set -x' was causing a tremendous amount of juju debug-log output, so I removed it in favor of appropriate 'juju-log' statements)

+ send relation data when zulu version changes after install (I noticed the new java version and JAVA_HOME were not getting set when up/downgrading zulu after initial install)

Let me know if you have any questions/concerns over any of this. I'm excited to have zulu8 in the charm store as an alternative to other java environments! Thanks.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'Makefile'
2--- Makefile 1970-01-01 00:00:00 +0000
3+++ Makefile 2016-03-10 23:49:51 +0000
4@@ -0,0 +1,8 @@
5+#!/usr/bin/make
6+PYTHON := /usr/bin/env python
7+
8+all: lint
9+
10+lint:
11+ @flake8 --exclude hooks/charmhelpers hooks tests
12+ @charm proof
13
14=== modified file 'README.md'
15--- README.md 2015-12-09 12:33:36 +0000
16+++ README.md 2016-03-10 23:49:51 +0000
17@@ -18,11 +18,11 @@
18 At this point, Zulu is waiting for a relationship to some other service. This
19 can be [any service](https://jujucharms.com/provides/java) that offers the
20 `java` interface. Building off the previous step, here is a simple deployment
21-scenario that would result in the Zulu JDK being installed on the `ubuntu-java`
22-unit:
23+scenario that would result in the Zulu JDK being installed on the
24+`ubuntu-devenv` unit:
25
26- juju deploy ubuntu-java
27- juju add-relation ubuntu-java zulu8
28+ juju deploy ubuntu-devenv
29+ juju add-relation ubuntu-devenv zulu8
30
31 The Zulu charm adds a public key for the Azul apt-get repository to your system,
32 then installs Zulu-8 from it. The Zulu charm also sets Zulu-8 as default java
33
34=== modified file 'reactive/install'
35--- reactive/install 2015-12-04 12:27:52 +0000
36+++ reactive/install 2016-03-10 23:49:51 +0000
37@@ -1,5 +1,5 @@
38 #!/bin/bash
39-set -ex
40+set -e
41
42 source charms.reactive.sh
43
44@@ -25,6 +25,7 @@
45 apt-add-repository "deb http://repos.azulsystems.com/ubuntu stable main"
46
47 status-set maintenance "Installing Zulu ${java_major}"
48+ juju-log "zulu8: installing zulu ${java_major}"
49 apt-get update -q
50 apt-get install -qqy zulu-${java_major}
51 update_java_home
52@@ -32,10 +33,11 @@
53 # Send relation data
54 java_home=$(readlink -f /usr/bin/java | sed "s:/bin/java::")
55 java_version=$(java -version 2>&1 | grep -i version | head -1 | awk -F '"' {'print $2'})
56- relation_call --relation_name=java set_ready $java_home $java_version
57+ relation_call --state=java.connected set_ready $java_home $java_version
58
59 set_state 'java.installed'
60 status-set active "Zulu ${java_major} installed"
61+ juju-log "zulu8: zulu ${java_major} installed"
62 }
63
64 @when 'java.connected' 'java.installed'
65@@ -48,14 +50,22 @@
66 if [[ $java_major != $java_major_installed ]]; then
67 #Let's remove all available Zulu versions to avoid using java and langtools from different packets
68 status-set maintenance "Uninstalling all Zulu versions before installing new one"
69+ juju-log "zulu8: uninstalling all zulu versions before installing new one"
70 apt-get remove --purge -qqy zulu*
71
72 #no need to add repo once again, so let's just install latest available package
73 status-set maintenance "Installing Zulu ${java_major}"
74+ juju-log "zulu8: installing zulu ${java_major}"
75 apt-get install -qqy zulu-${java_major}
76-
77 update_java_home
78+
79+ # Send relation data
80+ java_home=$(readlink -f /usr/bin/java | sed "s:/bin/java::")
81+ java_version=$(java -version 2>&1 | grep -i version | head -1 | awk -F '"' {'print $2'})
82+ relation_call --state=java.connected set_ready $java_home $java_version
83+
84 status-set active "Zulu ${java_major} installed"
85+ juju-log "zulu8: zulu ${java_major} installed"
86 fi
87 }
88
89@@ -64,11 +74,13 @@
90 function uninstall() {
91 # Uninstall all versions of Zulu
92 status-set maintenance "Uninstalling all Zulu versions"
93+ juju-log "zulu8: uninstalling all zulu versions"
94 apt-get remove --purge -qqy zulu*
95 update_java_home
96
97 remove_state 'java.installed'
98 status-set blocked "Zulu (all versions) uninstalled"
99+ juju-log "zulu8: zulu (all versions) uninstalled"
100 }
101
102 reactive_handler_main
103
104=== added directory 'tests'
105=== added file 'tests/01-deploy.py'
106--- tests/01-deploy.py 1970-01-01 00:00:00 +0000
107+++ tests/01-deploy.py 2016-03-10 23:49:51 +0000
108@@ -0,0 +1,33 @@
109+#!/usr/bin/env python3
110+
111+import unittest
112+import amulet
113+
114+
115+class TestDeploy(unittest.TestCase):
116+ """
117+ Deployment test for the Zulu8 java charm.
118+
119+ This charm is subordinate and requires a principal that provides the
120+ 'java' relation. Use ubuntu-devenv and ensure java -version works.
121+ """
122+
123+ @classmethod
124+ def setUpClass(cls):
125+ cls.d = amulet.Deployment(series='trusty')
126+ cls.d.add('ubuntu-devenv', 'cs:~kwmonroe/trusty/ubuntu-devenv')
127+ cls.d.add('zulu8', 'cs:trusty/zulu8')
128+ cls.d.relate('ubuntu-devenv:java', 'zulu8:java')
129+ cls.d.setup(timeout=900)
130+ cls.d.sentry.wait(timeout=1800)
131+ cls.unit = cls.d.sentry['ubuntu-devenv'][0]
132+
133+ def test_java(self):
134+ cmd = "java -version 2>&1"
135+ print("running {}".format(cmd))
136+ output, rc = self.unit.run(cmd)
137+ print("output from cmd: {}".format(output))
138+ assert rc == 0, "Unexpected return code: {}".format(rc)
139+
140+if __name__ == '__main__':
141+ unittest.main()
142
143=== added file 'tests/tests.yaml'
144--- tests/tests.yaml 1970-01-01 00:00:00 +0000
145+++ tests/tests.yaml 2016-03-10 23:49:51 +0000
146@@ -0,0 +1,2 @@
147+packages:
148+ - amulet

Subscribers

People subscribed via source and target branches