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
=== added file 'Makefile'
--- Makefile 1970-01-01 00:00:00 +0000
+++ Makefile 2016-03-10 23:49:51 +0000
@@ -0,0 +1,8 @@
1#!/usr/bin/make
2PYTHON := /usr/bin/env python
3
4all: lint
5
6lint:
7 @flake8 --exclude hooks/charmhelpers hooks tests
8 @charm proof
09
=== modified file 'README.md'
--- README.md 2015-12-09 12:33:36 +0000
+++ README.md 2016-03-10 23:49:51 +0000
@@ -18,11 +18,11 @@
18At this point, Zulu is waiting for a relationship to some other service. This18At this point, Zulu is waiting for a relationship to some other service. This
19can be [any service](https://jujucharms.com/provides/java) that offers the19can be [any service](https://jujucharms.com/provides/java) that offers the
20`java` interface. Building off the previous step, here is a simple deployment20`java` interface. Building off the previous step, here is a simple deployment
21scenario that would result in the Zulu JDK being installed on the `ubuntu-java`21scenario that would result in the Zulu JDK being installed on the
22unit:22`ubuntu-devenv` unit:
2323
24 juju deploy ubuntu-java24 juju deploy ubuntu-devenv
25 juju add-relation ubuntu-java zulu825 juju add-relation ubuntu-devenv zulu8
2626
27The Zulu charm adds a public key for the Azul apt-get repository to your system,27The Zulu charm adds a public key for the Azul apt-get repository to your system,
28then installs Zulu-8 from it. The Zulu charm also sets Zulu-8 as default java28then installs Zulu-8 from it. The Zulu charm also sets Zulu-8 as default java
2929
=== modified file 'reactive/install'
--- reactive/install 2015-12-04 12:27:52 +0000
+++ reactive/install 2016-03-10 23:49:51 +0000
@@ -1,5 +1,5 @@
1#!/bin/bash1#!/bin/bash
2set -ex2set -e
33
4source charms.reactive.sh4source charms.reactive.sh
55
@@ -25,6 +25,7 @@
25 apt-add-repository "deb http://repos.azulsystems.com/ubuntu stable main"25 apt-add-repository "deb http://repos.azulsystems.com/ubuntu stable main"
2626
27 status-set maintenance "Installing Zulu ${java_major}"27 status-set maintenance "Installing Zulu ${java_major}"
28 juju-log "zulu8: installing zulu ${java_major}"
28 apt-get update -q29 apt-get update -q
29 apt-get install -qqy zulu-${java_major}30 apt-get install -qqy zulu-${java_major}
30 update_java_home31 update_java_home
@@ -32,10 +33,11 @@
32 # Send relation data33 # Send relation data
33 java_home=$(readlink -f /usr/bin/java | sed "s:/bin/java::")34 java_home=$(readlink -f /usr/bin/java | sed "s:/bin/java::")
34 java_version=$(java -version 2>&1 | grep -i version | head -1 | awk -F '"' {'print $2'})35 java_version=$(java -version 2>&1 | grep -i version | head -1 | awk -F '"' {'print $2'})
35 relation_call --relation_name=java set_ready $java_home $java_version36 relation_call --state=java.connected set_ready $java_home $java_version
3637
37 set_state 'java.installed'38 set_state 'java.installed'
38 status-set active "Zulu ${java_major} installed"39 status-set active "Zulu ${java_major} installed"
40 juju-log "zulu8: zulu ${java_major} installed"
39}41}
4042
41@when 'java.connected' 'java.installed'43@when 'java.connected' 'java.installed'
@@ -48,14 +50,22 @@
48 if [[ $java_major != $java_major_installed ]]; then50 if [[ $java_major != $java_major_installed ]]; then
49 #Let's remove all available Zulu versions to avoid using java and langtools from different packets51 #Let's remove all available Zulu versions to avoid using java and langtools from different packets
50 status-set maintenance "Uninstalling all Zulu versions before installing new one"52 status-set maintenance "Uninstalling all Zulu versions before installing new one"
53 juju-log "zulu8: uninstalling all zulu versions before installing new one"
51 apt-get remove --purge -qqy zulu*54 apt-get remove --purge -qqy zulu*
5255
53 #no need to add repo once again, so let's just install latest available package56 #no need to add repo once again, so let's just install latest available package
54 status-set maintenance "Installing Zulu ${java_major}"57 status-set maintenance "Installing Zulu ${java_major}"
58 juju-log "zulu8: installing zulu ${java_major}"
55 apt-get install -qqy zulu-${java_major}59 apt-get install -qqy zulu-${java_major}
56
57 update_java_home60 update_java_home
61
62 # Send relation data
63 java_home=$(readlink -f /usr/bin/java | sed "s:/bin/java::")
64 java_version=$(java -version 2>&1 | grep -i version | head -1 | awk -F '"' {'print $2'})
65 relation_call --state=java.connected set_ready $java_home $java_version
66
58 status-set active "Zulu ${java_major} installed"67 status-set active "Zulu ${java_major} installed"
68 juju-log "zulu8: zulu ${java_major} installed"
59 fi69 fi
60}70}
6171
@@ -64,11 +74,13 @@
64function uninstall() {74function uninstall() {
65 # Uninstall all versions of Zulu75 # Uninstall all versions of Zulu
66 status-set maintenance "Uninstalling all Zulu versions"76 status-set maintenance "Uninstalling all Zulu versions"
77 juju-log "zulu8: uninstalling all zulu versions"
67 apt-get remove --purge -qqy zulu*78 apt-get remove --purge -qqy zulu*
68 update_java_home79 update_java_home
6980
70 remove_state 'java.installed'81 remove_state 'java.installed'
71 status-set blocked "Zulu (all versions) uninstalled"82 status-set blocked "Zulu (all versions) uninstalled"
83 juju-log "zulu8: zulu (all versions) uninstalled"
72}84}
7385
74reactive_handler_main86reactive_handler_main
7587
=== added directory 'tests'
=== added file 'tests/01-deploy.py'
--- tests/01-deploy.py 1970-01-01 00:00:00 +0000
+++ tests/01-deploy.py 2016-03-10 23:49:51 +0000
@@ -0,0 +1,33 @@
1#!/usr/bin/env python3
2
3import unittest
4import amulet
5
6
7class TestDeploy(unittest.TestCase):
8 """
9 Deployment test for the Zulu8 java charm.
10
11 This charm is subordinate and requires a principal that provides the
12 'java' relation. Use ubuntu-devenv and ensure java -version works.
13 """
14
15 @classmethod
16 def setUpClass(cls):
17 cls.d = amulet.Deployment(series='trusty')
18 cls.d.add('ubuntu-devenv', 'cs:~kwmonroe/trusty/ubuntu-devenv')
19 cls.d.add('zulu8', 'cs:trusty/zulu8')
20 cls.d.relate('ubuntu-devenv:java', 'zulu8:java')
21 cls.d.setup(timeout=900)
22 cls.d.sentry.wait(timeout=1800)
23 cls.unit = cls.d.sentry['ubuntu-devenv'][0]
24
25 def test_java(self):
26 cmd = "java -version 2>&1"
27 print("running {}".format(cmd))
28 output, rc = self.unit.run(cmd)
29 print("output from cmd: {}".format(output))
30 assert rc == 0, "Unexpected return code: {}".format(rc)
31
32if __name__ == '__main__':
33 unittest.main()
034
=== added file 'tests/tests.yaml'
--- tests/tests.yaml 1970-01-01 00:00:00 +0000
+++ tests/tests.yaml 2016-03-10 23:49:51 +0000
@@ -0,0 +1,2 @@
1packages:
2 - amulet

Subscribers

People subscribed via source and target branches