Merge lp:~azulcharmers/charms/trusty/zulu8/trunk into lp:charms/trusty/zulu8

Proposed by Sergey Grinev
Status: Superseded
Proposed branch: lp:~azulcharmers/charms/trusty/zulu8/trunk
Merge into: lp:charms/trusty/zulu8
Diff against target: 866 lines (+683/-1) (has conflicts)
26 files modified
.build.manifest (+200/-0)
.gitignore (+5/-0)
Makefile (+8/-0)
Makefile.moved (+23/-0)
config.yaml (+6/-0)
hooks/config-changed (+14/-0)
hooks/install (+28/-0)
hooks/java-relation-broken (+14/-0)
hooks/java-relation-changed (+14/-0)
hooks/java-relation-departed (+14/-0)
hooks/java-relation-joined (+14/-0)
hooks/relations/java/README.md (+58/-0)
hooks/relations/java/copyright (+16/-0)
hooks/relations/java/interface.yaml (+4/-0)
hooks/relations/java/provides.py (+36/-0)
hooks/relations/java/requires.py (+42/-0)
hooks/start (+14/-0)
hooks/stop (+14/-0)
hooks/upgrade-charm (+14/-0)
layer.yaml (+4/-0)
metadata.yaml (+10/-1)
reactive/install (+86/-0)
requirements.txt (+2/-0)
tests/01-deploy.py (+33/-0)
tests/tests.yaml (+2/-0)
tox.ini (+8/-0)
Conflict adding file .build.manifest.  Moved existing file to .build.manifest.moved.
Conflict adding file .gitignore.  Moved existing file to .gitignore.moved.
Conflict adding file Makefile.  Moved existing file to Makefile.moved.moved.
Conflict adding file Makefile.moved.  Moved existing file to Makefile.moved.moved.
Conflict adding file config.yaml.  Moved existing file to config.yaml.moved.
Conflict: can't delete hooks.moved because it is not empty.  Not deleting.
Conflict adding file hooks.  Moved existing file to hooks.moved.
Conflict because hooks.moved is not versioned, but has versioned children.  Versioned directory.
Conflict adding file layer.yaml.  Moved existing file to layer.yaml.moved.
Text conflict in metadata.yaml
Conflict adding file reactive.  Moved existing file to reactive.moved.
Conflict adding file requirements.txt.  Moved existing file to requirements.txt.moved.
Conflict: can't delete tests.moved because it is not empty.  Not deleting.
Conflict adding file tests.  Moved existing file to tests.moved.
Conflict because tests.moved is not versioned, but has versioned children.  Versioned directory.
Conflict adding file tox.ini.  Moved existing file to tox.ini.moved.
Conflict adding file wheelhouse.  Moved existing file to wheelhouse.moved.
To merge this branch: bzr merge lp:~azulcharmers/charms/trusty/zulu8/trunk
Reviewer Review Type Date Requested Status
charmers Pending
Review via email: mp+328780@code.launchpad.net

Description of the change

updating from charmers repo

To post a comment you must log in.

Unmerged revisions

21. By Sergey Grinev

updating metadata: new site address

20. By Dmitriy Kozorez

merged with Kevin's update

19. By Dmitriy Kozorez

merge with lp:~kwmonroe/charms/trusty/zulu8/add-tests

18. By Dmitriy Kozorez

edited contact info

17. By Dmitriy Kozorez

merge with Kevin. created deployable charm

16. By Dmitriy Kozorez

merge with Kevin during review for 1519858

15. By Dmitriy Kozorez

added laeyred-specific files

14. By Dmitriy Kozorez

rewritten charm to fit layered approach

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file '.build.manifest'
2--- .build.manifest 1970-01-01 00:00:00 +0000
3+++ .build.manifest 2017-08-09 15:38:57 +0000
4@@ -0,0 +1,200 @@
5+{
6+ "layers": [
7+ "layer:basic",
8+ "zulu8",
9+ "interface:java",
10+ "build"
11+ ],
12+ "signatures": {
13+ "hooks/java-relation-joined": [
14+ "interface:java",
15+ "dynamic",
16+ "b7e88ef72bd7a04a749faa425dd31f348700f5041f0bd0518a3bba37063bff2c"
17+ ],
18+ "hooks/stop": [
19+ "layer:basic",
20+ "static",
21+ "e3341fbab061efd2040de288e97715d7d3c0f2e3dfdd84a2d1e35fc43cec48d9"
22+ ],
23+ "wheelhouse/six-1.10.0-py2.py3-none-any.whl": [
24+ "layer:basic",
25+ "dynamic",
26+ "ae8b909ea725ca108c9a8c4e897acc4621b6b421e8b04bc8036be9cf99efc909"
27+ ],
28+ "hooks/relations/java/interface.yaml": [
29+ "interface:java",
30+ "static",
31+ "483a0485f8fc110629f4cc10fffa9fc5fc6a7d8e9fec0816c6980603b3266c88"
32+ ],
33+ "hooks/relations/java/provides.py": [
34+ "interface:java",
35+ "static",
36+ "f6364ab4c1b22b5b581bd9c40e1985d82ac7a3c3c26c32b76d858cd6032daa6a"
37+ ],
38+ "wheelhouse/MarkupSafe-0.23-cp27-none-linux_x86_64.whl": [
39+ "layer:basic",
40+ "dynamic",
41+ "e16e1bfc22cd748a6b8b253bb4207493d107a0573570d32d032a4260301e84b0"
42+ ],
43+ "wheelhouse/pyaml-15.8.2-py2-none-any.whl": [
44+ "layer:basic",
45+ "dynamic",
46+ "d143b28c16637e8a283e529dd69e1635521e45fa7cb0cddea41ed61449e02e7b"
47+ ],
48+ "Makefile": [
49+ "layer:basic",
50+ "static",
51+ "f91213a68bc5edce9ebe0615b70cc908ea45466c2e205fb6cfe9c35d9c3fde4b"
52+ ],
53+ "reactive/__init__.py": [
54+ "layer:basic",
55+ "static",
56+ "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
57+ ],
58+ "hooks/relations/java/requires.py": [
59+ "interface:java",
60+ "static",
61+ "fa2eca6fb016bf3e5073ed88790179f1f82b0eb5daa20f7dbe4c759fca697d12"
62+ ],
63+ "hooks/java-relation-changed": [
64+ "interface:java",
65+ "dynamic",
66+ "b7e88ef72bd7a04a749faa425dd31f348700f5041f0bd0518a3bba37063bff2c"
67+ ],
68+ "hooks/upgrade-charm": [
69+ "layer:basic",
70+ "static",
71+ "e3341fbab061efd2040de288e97715d7d3c0f2e3dfdd84a2d1e35fc43cec48d9"
72+ ],
73+ "wheelhouse/netaddr-0.7.18-py2-none-any.whl": [
74+ "layer:basic",
75+ "dynamic",
76+ "1ace3d06a4995b955b787bc82f04c4bb0195d7fed7efc4d3c41e7896a988b196"
77+ ],
78+ "wheelhouse/Tempita-0.5.2-py2-none-any.whl": [
79+ "layer:basic",
80+ "dynamic",
81+ "8375d1fb299ab8cd66f9cd322e53f2474bea519ed20038869480c38312f723f0"
82+ ],
83+ "reactive/install": [
84+ "zulu8",
85+ "static",
86+ "1df6bd78388182d22efdead95d33f5176a18d3504a5a0cea3bf7aff01566ba37"
87+ ],
88+ "README.md": [
89+ "zulu8",
90+ "static",
91+ "c76ae8e55ae4ce74a9b46c1d82a10df4f439a3c05375a75d1e85d21715fcf0bc"
92+ ],
93+ "tox.ini": [
94+ "layer:basic",
95+ "static",
96+ "5efb9280763f1f4cb861485e80863caafc9cd5ab1176543e911c27519436de7a"
97+ ],
98+ "metadata.yaml": [
99+ "zulu8",
100+ "dynamic",
101+ "e89bfcdd0b0c6bddecc219cd30656e2c482558f197200ed3bb2b0f4917c937ce"
102+ ],
103+ "wheelhouse/pip-7.1.2-py2.py3-none-any.whl": [
104+ "layer:basic",
105+ "dynamic",
106+ "8272f38ad219a6af3b97490859d0f4497683d8372995b8a34ac056c03dafa243"
107+ ],
108+ "copyright": [
109+ "zulu8",
110+ "static",
111+ "cc92fa52ff579376afbf222c78c333f82f275651712a76ec9cc143828db25475"
112+ ],
113+ "hooks/relations/java/README.md": [
114+ "interface:java",
115+ "static",
116+ "d8bdd132abb116a52fcb1db548d3c75e2a5ec3cdd873742c89be212030bc566f"
117+ ],
118+ "wheelhouse/PyYAML-3.11-cp27-none-linux_x86_64.whl": [
119+ "layer:basic",
120+ "dynamic",
121+ "e5e14bca3d05c41127b72656f96cf3c2e5e9e9b9a2f2c9a207efef74a9fb359c"
122+ ],
123+ "hooks/start": [
124+ "layer:basic",
125+ "static",
126+ "e3341fbab061efd2040de288e97715d7d3c0f2e3dfdd84a2d1e35fc43cec48d9"
127+ ],
128+ "wheelhouse/Jinja2-2.8-py2.py3-none-any.whl": [
129+ "layer:basic",
130+ "dynamic",
131+ "6329846ce408fc32dba509275a94597b9e56beb78a8743931ef38cf0189748cb"
132+ ],
133+ ".gitignore": [
134+ "layer:basic",
135+ "static",
136+ "0da5c4dcda27cd6406e5bb81cbf68ddccaf728ac764ec15053a165c1449d87d9"
137+ ],
138+ "hooks/relations/java/__init__.py": [
139+ "interface:java",
140+ "static",
141+ "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
142+ ],
143+ "hooks/install": [
144+ "layer:basic",
145+ "static",
146+ "5f1bf2a89d26e56e57f56456d1390c55803c5f33c0c65f414692555c508283ea"
147+ ],
148+ "config.yaml": [
149+ "zulu8",
150+ "dynamic",
151+ "d47282e928f04305946b22781e0ad9f3c2eb76138addb5d69f606a904f76203c"
152+ ],
153+ "layer.yaml": [
154+ "zulu8",
155+ "dynamic",
156+ "4fa777c2efbbfe13f0e26c468b6ab09d0eebd6fbc9b36aece6764a643a568d5e"
157+ ],
158+ "wheelhouse/charms.reactive-0.3.6-py2-none-any.whl": [
159+ "layer:basic",
160+ "dynamic",
161+ "196f8005f275e5d17ccaeb19e5a98d006fa75941ca7c81e09d2a021cacdd9ba4"
162+ ],
163+ "wheelhouse/charmhelpers-0.6.0-py2-none-any.whl": [
164+ "layer:basic",
165+ "dynamic",
166+ "4a3a0bf726f45d3ac05f33d4e4cc6f43175af404f6dccfaa1b4850985e2d8670"
167+ ],
168+ "hooks/relations/java/copyright": [
169+ "interface:java",
170+ "static",
171+ "188b8b4aa4477e8d2a0b4c290c451326456a0ddf58e1f314c3f5bf151ddbd8a8"
172+ ],
173+ "hooks/java-relation-broken": [
174+ "interface:java",
175+ "dynamic",
176+ "b7e88ef72bd7a04a749faa425dd31f348700f5041f0bd0518a3bba37063bff2c"
177+ ],
178+ ".build.manifest": [
179+ "build",
180+ "dynamic",
181+ "unchecked"
182+ ],
183+ "icon.svg": [
184+ "zulu8",
185+ "static",
186+ "b9bb876dd399b42e25201f0bb073dd6e6981a0f6a13601262f0985d84b8f09bb"
187+ ],
188+ "hooks/java-relation-departed": [
189+ "interface:java",
190+ "dynamic",
191+ "b7e88ef72bd7a04a749faa425dd31f348700f5041f0bd0518a3bba37063bff2c"
192+ ],
193+ "requirements.txt": [
194+ "layer:basic",
195+ "static",
196+ "0f1c70d27e26005a96d66ad54482877ae20f7737693c833e29dd72bd6ac24892"
197+ ],
198+ "hooks/config-changed": [
199+ "layer:basic",
200+ "static",
201+ "e3341fbab061efd2040de288e97715d7d3c0f2e3dfdd84a2d1e35fc43cec48d9"
202+ ]
203+ }
204+}
205\ No newline at end of file
206
207=== renamed file '.build.manifest' => '.build.manifest.moved'
208=== added file '.gitignore'
209--- .gitignore 1970-01-01 00:00:00 +0000
210+++ .gitignore 2017-08-09 15:38:57 +0000
211@@ -0,0 +1,5 @@
212+*.pyc
213+*~
214+.ropeproject
215+.settings
216+.tox
217
218=== renamed file '.gitignore' => '.gitignore.moved'
219=== added file 'Makefile'
220--- Makefile 1970-01-01 00:00:00 +0000
221+++ Makefile 2017-08-09 15:38:57 +0000
222@@ -0,0 +1,8 @@
223+#!/usr/bin/make
224+PYTHON := /usr/bin/env python
225+
226+all: lint
227+
228+lint:
229+ @flake8 --exclude hooks/charmhelpers hooks tests
230+ @charm proof
231
232=== added file 'Makefile.moved'
233--- Makefile.moved 1970-01-01 00:00:00 +0000
234+++ Makefile.moved 2017-08-09 15:38:57 +0000
235@@ -0,0 +1,23 @@
236+#!/usr/bin/make
237+PYTHON := /usr/bin/env python
238+
239+all: lint test build
240+
241+
242+build: unit_test
243+ juju-compose -o ~/charms .
244+
245+lint:
246+ @flake8 --exclude hooks/charmhelpers hooks unit_tests tests
247+ @charm proof
248+
249+unit_test:
250+ @echo Starting tests...
251+ tox
252+
253+test:
254+ @echo Starting Amulet tests...
255+ # coreycb note: The -v should only be temporary until Amulet sends
256+ # raise_status() messages to stderr:
257+ # https://bugs.launchpad.net/amulet/+bug/1320357
258+ @juju test -v -p AMULET_HTTP_PROXY,AMULET_OS_VIP --timeout 2700
259
260=== renamed file 'Makefile' => 'Makefile.moved.moved'
261=== added file 'config.yaml'
262--- config.yaml 1970-01-01 00:00:00 +0000
263+++ config.yaml 2017-08-09 15:38:57 +0000
264@@ -0,0 +1,6 @@
265+options:
266+ java-major:
267+ type: string
268+ default: '8'
269+ description: |
270+ Major version of Java. Defaults to 8.
271
272=== renamed file 'config.yaml' => 'config.yaml.moved'
273=== added directory 'hooks'
274=== renamed directory 'hooks' => 'hooks.moved'
275=== added file 'hooks/config-changed'
276--- hooks/config-changed 1970-01-01 00:00:00 +0000
277+++ hooks/config-changed 2017-08-09 15:38:57 +0000
278@@ -0,0 +1,14 @@
279+#!/usr/bin/env python
280+
281+# Load modules from $CHARM_DIR/lib
282+import sys
283+sys.path.append('lib')
284+
285+# This will load and run the appropriate @hook and other decorated
286+# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
287+# and $CHARM_DIR/hooks/relations.
288+#
289+# See https://jujucharms.com/docs/stable/getting-started-with-charms-reactive
290+# for more information on this pattern.
291+from charms.reactive import main
292+main()
293
294=== added file 'hooks/install'
295--- hooks/install 1970-01-01 00:00:00 +0000
296+++ hooks/install 2017-08-09 15:38:57 +0000
297@@ -0,0 +1,28 @@
298+#!/usr/bin/env python
299+
300+from glob import glob
301+import os
302+import sys
303+from subprocess import check_call
304+
305+
306+# Load modules from $CHARM_DIR/lib
307+sys.path.append('lib')
308+
309+# bootstrap wheelhouse
310+if os.path.exists('wheelhouse'):
311+ check_call(['apt-get', 'install', '-yq', 'python-pip'])
312+ # need newer pip, to fix spurious Double Requirement error https://github.com/pypa/pip/issues/56
313+ check_call(['pip', 'install', '-U', '--no-index', '-f', 'wheelhouse', 'pip'])
314+ # install the rest of the wheelhouse deps
315+ check_call(['pip', 'install', '-U', '--no-index'] + glob('wheelhouse/*'))
316+
317+
318+# This will load and run the appropriate @hook and other decorated
319+# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
320+# and $CHARM_DIR/hooks/relations.
321+#
322+# See https://jujucharms.com/docs/stable/getting-started-with-charms-reactive
323+# for more information on this pattern.
324+from charms.reactive import main
325+main()
326
327=== added file 'hooks/java-relation-broken'
328--- hooks/java-relation-broken 1970-01-01 00:00:00 +0000
329+++ hooks/java-relation-broken 2017-08-09 15:38:57 +0000
330@@ -0,0 +1,14 @@
331+#!/usr/bin/env python
332+
333+# Load modules from $CHARM_DIR/lib
334+import sys
335+sys.path.append('lib')
336+
337+# This will load and run the appropriate @hook and other decorated
338+# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
339+# and $CHARM_DIR/hooks/relations.
340+#
341+# See https://jujucharms.com/docs/stable/getting-started-with-charms-reactive
342+# for more information on this pattern.
343+from charms.reactive import main
344+main('java')
345
346=== added file 'hooks/java-relation-changed'
347--- hooks/java-relation-changed 1970-01-01 00:00:00 +0000
348+++ hooks/java-relation-changed 2017-08-09 15:38:57 +0000
349@@ -0,0 +1,14 @@
350+#!/usr/bin/env python
351+
352+# Load modules from $CHARM_DIR/lib
353+import sys
354+sys.path.append('lib')
355+
356+# This will load and run the appropriate @hook and other decorated
357+# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
358+# and $CHARM_DIR/hooks/relations.
359+#
360+# See https://jujucharms.com/docs/stable/getting-started-with-charms-reactive
361+# for more information on this pattern.
362+from charms.reactive import main
363+main('java')
364
365=== added file 'hooks/java-relation-departed'
366--- hooks/java-relation-departed 1970-01-01 00:00:00 +0000
367+++ hooks/java-relation-departed 2017-08-09 15:38:57 +0000
368@@ -0,0 +1,14 @@
369+#!/usr/bin/env python
370+
371+# Load modules from $CHARM_DIR/lib
372+import sys
373+sys.path.append('lib')
374+
375+# This will load and run the appropriate @hook and other decorated
376+# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
377+# and $CHARM_DIR/hooks/relations.
378+#
379+# See https://jujucharms.com/docs/stable/getting-started-with-charms-reactive
380+# for more information on this pattern.
381+from charms.reactive import main
382+main('java')
383
384=== added file 'hooks/java-relation-joined'
385--- hooks/java-relation-joined 1970-01-01 00:00:00 +0000
386+++ hooks/java-relation-joined 2017-08-09 15:38:57 +0000
387@@ -0,0 +1,14 @@
388+#!/usr/bin/env python
389+
390+# Load modules from $CHARM_DIR/lib
391+import sys
392+sys.path.append('lib')
393+
394+# This will load and run the appropriate @hook and other decorated
395+# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
396+# and $CHARM_DIR/hooks/relations.
397+#
398+# See https://jujucharms.com/docs/stable/getting-started-with-charms-reactive
399+# for more information on this pattern.
400+from charms.reactive import main
401+main('java')
402
403=== added directory 'hooks/relations'
404=== added directory 'hooks/relations/java'
405=== added file 'hooks/relations/java/README.md'
406--- hooks/relations/java/README.md 1970-01-01 00:00:00 +0000
407+++ hooks/relations/java/README.md 2017-08-09 15:38:57 +0000
408@@ -0,0 +1,58 @@
409+# Overview
410+
411+This interface layer handles the communication with Java related services via
412+the `java` interface protocol. It sets two states when appropriate:
413+
414+ * `{relation_name}.connected` indicates that a Java relation is present
415+ * `{relation_name}.ready` indicates that Java is installed and ready
416+
417+The charm implementing this relation (e.g., [openjdk][]) will install and
418+configure the Java environment. It also sets two pieces of relation data:
419+
420+ * `java-home` is equivalent to the $JAVA_HOME environment variable
421+ * `java-version` is the numeric version string (e.g. "1.7.0_85")
422+
423+The charm consuming this relation (e.g., [ubuntu-java][]) will use the above
424+relation data to configure its Java based service.
425+
426+
427+# Example Usage
428+
429+An example of a charm using this interface would be:
430+
431+```python
432+@when('java.connected')
433+@when_not('java.installed')
434+def install():
435+ status_set('maintenance', 'Installing JRE')
436+ java.install_jre()
437+ reactive.set_state('java.installed')
438+ hookenv.status_set('active', 'JRE is installed')
439+
440+@when('java.connected', 'java.installed')
441+def configure():
442+ # update /etc/environment, call update-alternatives, etc
443+ java.configure_jre()
444+ hookenv.status_set('active', 'JRE is ready')
445+
446+@when_not('java.connected')
447+@when('java.installed')
448+def uninstall():
449+ java.uninstall_jre()
450+ reactive.remove_state('java.installed')
451+ hookenv.status_set('blocked', 'No JRE available')
452+```
453+
454+
455+# Contact Information
456+
457+- <bigdata@lists.ubuntu.com>
458+
459+
460+# OpenJDK
461+
462+- [OpenJDK](http://openjdk.java.net/) home page
463+
464+
465+[openjdk]: https://jujucharms.com/u/kwmonroe/openjdk
466+[ubuntu-java]: https://jujucharms.com/u/kwmonroe/ubuntu-java
467
468=== added file 'hooks/relations/java/__init__.py'
469=== added file 'hooks/relations/java/copyright'
470--- hooks/relations/java/copyright 1970-01-01 00:00:00 +0000
471+++ hooks/relations/java/copyright 2017-08-09 15:38:57 +0000
472@@ -0,0 +1,16 @@
473+Format: http://dep.debian.net/deps/dep5/
474+
475+Files: *
476+Copyright: Copyright 2015, Canonical Ltd., All Rights Reserved.
477+License: Apache License 2.0
478+ Licensed under the Apache License, Version 2.0 (the "License");
479+ you may not use this file except in compliance with the License.
480+ You may obtain a copy of the License at
481+ .
482+ http://www.apache.org/licenses/LICENSE-2.0
483+ .
484+ Unless required by applicable law or agreed to in writing, software
485+ distributed under the License is distributed on an "AS IS" BASIS,
486+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
487+ See the License for the specific language governing permissions and
488+ limitations under the License.
489
490=== added file 'hooks/relations/java/interface.yaml'
491--- hooks/relations/java/interface.yaml 1970-01-01 00:00:00 +0000
492+++ hooks/relations/java/interface.yaml 2017-08-09 15:38:57 +0000
493@@ -0,0 +1,4 @@
494+name: java
495+summary: Interface for relating to Java
496+version: 1
497+maintainer: "Big Data Team <bigdata@lists.ubuntu.com>"
498
499=== added file 'hooks/relations/java/provides.py'
500--- hooks/relations/java/provides.py 1970-01-01 00:00:00 +0000
501+++ hooks/relations/java/provides.py 2017-08-09 15:38:57 +0000
502@@ -0,0 +1,36 @@
503+# Licensed under the Apache License, Version 2.0 (the "License");
504+# you may not use this file except in compliance with the License.
505+# You may obtain a copy of the License at
506+#
507+# http://www.apache.org/licenses/LICENSE-2.0
508+#
509+# Unless required by applicable law or agreed to in writing, software
510+# distributed under the License is distributed on an "AS IS" BASIS,
511+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
512+# See the License for the specific language governing permissions and
513+# limitations under the License.
514+
515+from charms.reactive import hook
516+from charms.reactive import RelationBase
517+from charms.reactive import scopes
518+
519+
520+class JavaProvides(RelationBase):
521+ scope = scopes.GLOBAL
522+
523+ # convenient way to provide accessor methods
524+ auto_accessors = ['java-home', 'java-version']
525+
526+ def java_ready(self):
527+ return self.get_remote('java-ready', 'false').lower() == 'true'
528+
529+ @hook('{provides:java}-relation-changed')
530+ def changed(self):
531+ if self.java_ready():
532+ self.set_state('{relation_name}.ready')
533+ else:
534+ self.remove_state('{relation_name}.ready')
535+
536+ @hook('{provides:java}-relation-departed')
537+ def departed(self):
538+ self.remove_state('{relation_name}.ready')
539
540=== added file 'hooks/relations/java/requires.py'
541--- hooks/relations/java/requires.py 1970-01-01 00:00:00 +0000
542+++ hooks/relations/java/requires.py 2017-08-09 15:38:57 +0000
543@@ -0,0 +1,42 @@
544+# Licensed under the Apache License, Version 5.0 (the "License");
545+# you may not use this file except in compliance with the License.
546+# You may obtain a copy of the License at
547+#
548+# http://www.apache.org/licenses/LICENSE-2.0
549+#
550+# Unless required by applicable law or agreed to in writing, software
551+# distributed under the License is distributed on an "AS IS" BASIS,
552+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
553+# See the License for the specific language governing permissions and
554+# limitations under the License.
555+
556+from charms.reactive import hook
557+from charms.reactive import RelationBase
558+from charms.reactive import scopes
559+
560+
561+class JavaRequires(RelationBase):
562+ scope = scopes.GLOBAL
563+
564+ @hook('{requires:java}-relation-joined')
565+ def joined(self):
566+ self.set_state('{relation_name}.connected')
567+
568+ @hook('{requires:java}-relation-departed')
569+ def departed(self):
570+ self.remove_state('{relation_name}.connected')
571+
572+ # Send relation data when java is ready
573+ def set_ready(self, java_home, java_version):
574+ self.set_remote(data={
575+ 'java-ready': True,
576+ 'java-home': java_home,
577+ 'java-version': java_version,
578+ })
579+
580+ # For minor upgrades, provide a way to set java-version independently
581+ def set_version(self, version):
582+ self.set_remote('java-version', version)
583+
584+ def unset_ready(self):
585+ self.set_remote('java-ready', False)
586
587=== added file 'hooks/start'
588--- hooks/start 1970-01-01 00:00:00 +0000
589+++ hooks/start 2017-08-09 15:38:57 +0000
590@@ -0,0 +1,14 @@
591+#!/usr/bin/env python
592+
593+# Load modules from $CHARM_DIR/lib
594+import sys
595+sys.path.append('lib')
596+
597+# This will load and run the appropriate @hook and other decorated
598+# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
599+# and $CHARM_DIR/hooks/relations.
600+#
601+# See https://jujucharms.com/docs/stable/getting-started-with-charms-reactive
602+# for more information on this pattern.
603+from charms.reactive import main
604+main()
605
606=== added file 'hooks/stop'
607--- hooks/stop 1970-01-01 00:00:00 +0000
608+++ hooks/stop 2017-08-09 15:38:57 +0000
609@@ -0,0 +1,14 @@
610+#!/usr/bin/env python
611+
612+# Load modules from $CHARM_DIR/lib
613+import sys
614+sys.path.append('lib')
615+
616+# This will load and run the appropriate @hook and other decorated
617+# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
618+# and $CHARM_DIR/hooks/relations.
619+#
620+# See https://jujucharms.com/docs/stable/getting-started-with-charms-reactive
621+# for more information on this pattern.
622+from charms.reactive import main
623+main()
624
625=== added file 'hooks/upgrade-charm'
626--- hooks/upgrade-charm 1970-01-01 00:00:00 +0000
627+++ hooks/upgrade-charm 2017-08-09 15:38:57 +0000
628@@ -0,0 +1,14 @@
629+#!/usr/bin/env python
630+
631+# Load modules from $CHARM_DIR/lib
632+import sys
633+sys.path.append('lib')
634+
635+# This will load and run the appropriate @hook and other decorated
636+# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
637+# and $CHARM_DIR/hooks/relations.
638+#
639+# See https://jujucharms.com/docs/stable/getting-started-with-charms-reactive
640+# for more information on this pattern.
641+from charms.reactive import main
642+main()
643
644=== added file 'layer.yaml'
645--- layer.yaml 1970-01-01 00:00:00 +0000
646+++ layer.yaml 2017-08-09 15:38:57 +0000
647@@ -0,0 +1,4 @@
648+includes:
649+- layer:basic
650+- interface:java
651+is: zulu8
652
653=== renamed file 'layer.yaml' => 'layer.yaml.moved'
654=== modified file 'metadata.yaml'
655--- metadata.yaml 2016-03-10 23:04:24 +0000
656+++ metadata.yaml 2017-08-09 15:38:57 +0000
657@@ -1,13 +1,22 @@
658 name: zulu8
659 summary: Azul implementation of OpenJDK
660-maintainer: Azul Systems <azul_openjdk@azulsystems.com>
661+maintainer: Azul Systems <azul_openjdk@azul.com>
662 description: |
663 Azul Zulu is open source implementation of OpenJDK.
664 It provides both JRE and JDK.
665+<<<<<<< TREE
666 More information at http://www.azulsystems.com/products/zulu
667 tags: [java]
668 requires:
669 java:
670 interface: java
671 scope: container
672+=======
673+ More information at http://www.azul.com/products/zulu
674+tags: [java]
675+requires:
676+ java:
677+ interface: java
678+ scope: container
679+>>>>>>> MERGE-SOURCE
680 subordinate: true
681
682=== added directory 'reactive'
683=== renamed directory 'reactive' => 'reactive.moved'
684=== added file 'reactive/__init__.py'
685=== added file 'reactive/install'
686--- reactive/install 1970-01-01 00:00:00 +0000
687+++ reactive/install 2017-08-09 15:38:57 +0000
688@@ -0,0 +1,86 @@
689+#!/bin/bash
690+set -e
691+
692+source charms.reactive.sh
693+
694+# Remove any previous mention of JAVA_HOME, then append the appropriate value
695+# based on the source of our /usr/bin/java symlink (if it exists).
696+function update_java_home() {
697+ sed -i -e '/JAVA_HOME/d' /etc/environment
698+
699+ if [[ -L "/usr/bin/java" ]]; then
700+ java_home=$(readlink -f /usr/bin/java | sed "s:/bin/java::")
701+ echo "JAVA_HOME=${java_home}" >> /etc/environment
702+ fi
703+}
704+
705+@when 'java.connected'
706+@when_not 'java.installed'
707+function install() {
708+ java_major=$(config-get 'java-major')
709+
710+ # Add Azul key and repo
711+ apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0x219BD9C9
712+ apt-key list | grep -i azul && juju-log "Key added successfully"
713+ apt-add-repository "deb http://repos.azulsystems.com/ubuntu stable main"
714+
715+ status-set maintenance "Installing Zulu ${java_major}"
716+ juju-log "zulu8: installing zulu ${java_major}"
717+ apt-get update -q
718+ apt-get install -qqy zulu-${java_major}
719+ update_java_home
720+
721+ # Send relation data
722+ java_home=$(readlink -f /usr/bin/java | sed "s:/bin/java::")
723+ java_version=$(java -version 2>&1 | grep -i version | head -1 | awk -F '"' {'print $2'})
724+ relation_call --state=java.connected set_ready $java_home $java_version
725+
726+ set_state 'java.installed'
727+ status-set active "Zulu ${java_major} installed"
728+ juju-log "zulu8: zulu ${java_major} installed"
729+}
730+
731+@when 'java.connected' 'java.installed'
732+function check_version() {
733+ java_major=$(config-get 'java-major')
734+ java_major_installed=$(java -version 2>&1 | grep -i version | head -1 | awk -F '.' {'print $2'})
735+
736+ # Install new major version if the user has set 'java-major' to something
737+ # different than the version we have installed.
738+ if [[ $java_major != $java_major_installed ]]; then
739+ #Let's remove all available Zulu versions to avoid using java and langtools from different packets
740+ status-set maintenance "Uninstalling all Zulu versions before installing new one"
741+ juju-log "zulu8: uninstalling all zulu versions before installing new one"
742+ apt-get remove --purge -qqy zulu*
743+
744+ #no need to add repo once again, so let's just install latest available package
745+ status-set maintenance "Installing Zulu ${java_major}"
746+ juju-log "zulu8: installing zulu ${java_major}"
747+ apt-get install -qqy zulu-${java_major}
748+ update_java_home
749+
750+ # Send relation data
751+ java_home=$(readlink -f /usr/bin/java | sed "s:/bin/java::")
752+ java_version=$(java -version 2>&1 | grep -i version | head -1 | awk -F '"' {'print $2'})
753+ relation_call --state=java.connected set_ready $java_home $java_version
754+
755+ status-set active "Zulu ${java_major} installed"
756+ juju-log "zulu8: zulu ${java_major} installed"
757+ fi
758+}
759+
760+@when 'java.installed'
761+@when_not 'java.connected'
762+function uninstall() {
763+ # Uninstall all versions of Zulu
764+ status-set maintenance "Uninstalling all Zulu versions"
765+ juju-log "zulu8: uninstalling all zulu versions"
766+ apt-get remove --purge -qqy zulu*
767+ update_java_home
768+
769+ remove_state 'java.installed'
770+ status-set blocked "Zulu (all versions) uninstalled"
771+ juju-log "zulu8: zulu (all versions) uninstalled"
772+}
773+
774+reactive_handler_main
775
776=== added file 'requirements.txt'
777--- requirements.txt 1970-01-01 00:00:00 +0000
778+++ requirements.txt 2017-08-09 15:38:57 +0000
779@@ -0,0 +1,2 @@
780+flake8
781+pytest
782
783=== renamed file 'requirements.txt' => 'requirements.txt.moved'
784=== added directory 'tests'
785=== renamed directory 'tests' => 'tests.moved'
786=== added file 'tests/01-deploy.py'
787--- tests/01-deploy.py 1970-01-01 00:00:00 +0000
788+++ tests/01-deploy.py 2017-08-09 15:38:57 +0000
789@@ -0,0 +1,33 @@
790+#!/usr/bin/env python3
791+
792+import unittest
793+import amulet
794+
795+
796+class TestDeploy(unittest.TestCase):
797+ """
798+ Deployment test for the Zulu8 java charm.
799+
800+ This charm is subordinate and requires a principal that provides the
801+ 'java' relation. Use ubuntu-devenv and ensure java -version works.
802+ """
803+
804+ @classmethod
805+ def setUpClass(cls):
806+ cls.d = amulet.Deployment(series='trusty')
807+ cls.d.add('ubuntu-devenv', 'cs:~kwmonroe/trusty/ubuntu-devenv')
808+ cls.d.add('zulu8', 'cs:trusty/zulu8')
809+ cls.d.relate('ubuntu-devenv:java', 'zulu8:java')
810+ cls.d.setup(timeout=900)
811+ cls.d.sentry.wait(timeout=1800)
812+ cls.unit = cls.d.sentry['ubuntu-devenv'][0]
813+
814+ def test_java(self):
815+ cmd = "java -version 2>&1"
816+ print("running {}".format(cmd))
817+ output, rc = self.unit.run(cmd)
818+ print("output from cmd: {}".format(output))
819+ assert rc == 0, "Unexpected return code: {}".format(rc)
820+
821+if __name__ == '__main__':
822+ unittest.main()
823
824=== added file 'tests/tests.yaml'
825--- tests/tests.yaml 1970-01-01 00:00:00 +0000
826+++ tests/tests.yaml 2017-08-09 15:38:57 +0000
827@@ -0,0 +1,2 @@
828+packages:
829+ - amulet
830
831=== added file 'tox.ini'
832--- tox.ini 1970-01-01 00:00:00 +0000
833+++ tox.ini 2017-08-09 15:38:57 +0000
834@@ -0,0 +1,8 @@
835+[tox]
836+skipsdist=True
837+envlist = py34
838+
839+[testenv]
840+commands = py.test -v
841+deps =
842+ -r{toxinidir}/requirements.txt
843
844=== renamed file 'tox.ini' => 'tox.ini.moved'
845=== added directory 'wheelhouse'
846=== renamed directory 'wheelhouse' => 'wheelhouse.moved'
847=== added file 'wheelhouse/Jinja2-2.8-py2.py3-none-any.whl'
848Binary files wheelhouse/Jinja2-2.8-py2.py3-none-any.whl 1970-01-01 00:00:00 +0000 and wheelhouse/Jinja2-2.8-py2.py3-none-any.whl 2017-08-09 15:38:57 +0000 differ
849=== added file 'wheelhouse/MarkupSafe-0.23-cp27-none-linux_x86_64.whl'
850Binary files wheelhouse/MarkupSafe-0.23-cp27-none-linux_x86_64.whl 1970-01-01 00:00:00 +0000 and wheelhouse/MarkupSafe-0.23-cp27-none-linux_x86_64.whl 2017-08-09 15:38:57 +0000 differ
851=== added file 'wheelhouse/PyYAML-3.11-cp27-none-linux_x86_64.whl'
852Binary files wheelhouse/PyYAML-3.11-cp27-none-linux_x86_64.whl 1970-01-01 00:00:00 +0000 and wheelhouse/PyYAML-3.11-cp27-none-linux_x86_64.whl 2017-08-09 15:38:57 +0000 differ
853=== added file 'wheelhouse/Tempita-0.5.2-py2-none-any.whl'
854Binary files wheelhouse/Tempita-0.5.2-py2-none-any.whl 1970-01-01 00:00:00 +0000 and wheelhouse/Tempita-0.5.2-py2-none-any.whl 2017-08-09 15:38:57 +0000 differ
855=== added file 'wheelhouse/charmhelpers-0.6.0-py2-none-any.whl'
856Binary files wheelhouse/charmhelpers-0.6.0-py2-none-any.whl 1970-01-01 00:00:00 +0000 and wheelhouse/charmhelpers-0.6.0-py2-none-any.whl 2017-08-09 15:38:57 +0000 differ
857=== added file 'wheelhouse/charms.reactive-0.3.6-py2-none-any.whl'
858Binary files wheelhouse/charms.reactive-0.3.6-py2-none-any.whl 1970-01-01 00:00:00 +0000 and wheelhouse/charms.reactive-0.3.6-py2-none-any.whl 2017-08-09 15:38:57 +0000 differ
859=== added file 'wheelhouse/netaddr-0.7.18-py2-none-any.whl'
860Binary files wheelhouse/netaddr-0.7.18-py2-none-any.whl 1970-01-01 00:00:00 +0000 and wheelhouse/netaddr-0.7.18-py2-none-any.whl 2017-08-09 15:38:57 +0000 differ
861=== added file 'wheelhouse/pip-7.1.2-py2.py3-none-any.whl'
862Binary files wheelhouse/pip-7.1.2-py2.py3-none-any.whl 1970-01-01 00:00:00 +0000 and wheelhouse/pip-7.1.2-py2.py3-none-any.whl 2017-08-09 15:38:57 +0000 differ
863=== added file 'wheelhouse/pyaml-15.8.2-py2-none-any.whl'
864Binary files wheelhouse/pyaml-15.8.2-py2-none-any.whl 1970-01-01 00:00:00 +0000 and wheelhouse/pyaml-15.8.2-py2-none-any.whl 2017-08-09 15:38:57 +0000 differ
865=== added file 'wheelhouse/six-1.10.0-py2.py3-none-any.whl'
866Binary files wheelhouse/six-1.10.0-py2.py3-none-any.whl 1970-01-01 00:00:00 +0000 and wheelhouse/six-1.10.0-py2.py3-none-any.whl 2017-08-09 15:38:57 +0000 differ

Subscribers

People subscribed via source and target branches