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
=== added file '.build.manifest'
--- .build.manifest 1970-01-01 00:00:00 +0000
+++ .build.manifest 2017-08-09 15:38:57 +0000
@@ -0,0 +1,200 @@
1{
2 "layers": [
3 "layer:basic",
4 "zulu8",
5 "interface:java",
6 "build"
7 ],
8 "signatures": {
9 "hooks/java-relation-joined": [
10 "interface:java",
11 "dynamic",
12 "b7e88ef72bd7a04a749faa425dd31f348700f5041f0bd0518a3bba37063bff2c"
13 ],
14 "hooks/stop": [
15 "layer:basic",
16 "static",
17 "e3341fbab061efd2040de288e97715d7d3c0f2e3dfdd84a2d1e35fc43cec48d9"
18 ],
19 "wheelhouse/six-1.10.0-py2.py3-none-any.whl": [
20 "layer:basic",
21 "dynamic",
22 "ae8b909ea725ca108c9a8c4e897acc4621b6b421e8b04bc8036be9cf99efc909"
23 ],
24 "hooks/relations/java/interface.yaml": [
25 "interface:java",
26 "static",
27 "483a0485f8fc110629f4cc10fffa9fc5fc6a7d8e9fec0816c6980603b3266c88"
28 ],
29 "hooks/relations/java/provides.py": [
30 "interface:java",
31 "static",
32 "f6364ab4c1b22b5b581bd9c40e1985d82ac7a3c3c26c32b76d858cd6032daa6a"
33 ],
34 "wheelhouse/MarkupSafe-0.23-cp27-none-linux_x86_64.whl": [
35 "layer:basic",
36 "dynamic",
37 "e16e1bfc22cd748a6b8b253bb4207493d107a0573570d32d032a4260301e84b0"
38 ],
39 "wheelhouse/pyaml-15.8.2-py2-none-any.whl": [
40 "layer:basic",
41 "dynamic",
42 "d143b28c16637e8a283e529dd69e1635521e45fa7cb0cddea41ed61449e02e7b"
43 ],
44 "Makefile": [
45 "layer:basic",
46 "static",
47 "f91213a68bc5edce9ebe0615b70cc908ea45466c2e205fb6cfe9c35d9c3fde4b"
48 ],
49 "reactive/__init__.py": [
50 "layer:basic",
51 "static",
52 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
53 ],
54 "hooks/relations/java/requires.py": [
55 "interface:java",
56 "static",
57 "fa2eca6fb016bf3e5073ed88790179f1f82b0eb5daa20f7dbe4c759fca697d12"
58 ],
59 "hooks/java-relation-changed": [
60 "interface:java",
61 "dynamic",
62 "b7e88ef72bd7a04a749faa425dd31f348700f5041f0bd0518a3bba37063bff2c"
63 ],
64 "hooks/upgrade-charm": [
65 "layer:basic",
66 "static",
67 "e3341fbab061efd2040de288e97715d7d3c0f2e3dfdd84a2d1e35fc43cec48d9"
68 ],
69 "wheelhouse/netaddr-0.7.18-py2-none-any.whl": [
70 "layer:basic",
71 "dynamic",
72 "1ace3d06a4995b955b787bc82f04c4bb0195d7fed7efc4d3c41e7896a988b196"
73 ],
74 "wheelhouse/Tempita-0.5.2-py2-none-any.whl": [
75 "layer:basic",
76 "dynamic",
77 "8375d1fb299ab8cd66f9cd322e53f2474bea519ed20038869480c38312f723f0"
78 ],
79 "reactive/install": [
80 "zulu8",
81 "static",
82 "1df6bd78388182d22efdead95d33f5176a18d3504a5a0cea3bf7aff01566ba37"
83 ],
84 "README.md": [
85 "zulu8",
86 "static",
87 "c76ae8e55ae4ce74a9b46c1d82a10df4f439a3c05375a75d1e85d21715fcf0bc"
88 ],
89 "tox.ini": [
90 "layer:basic",
91 "static",
92 "5efb9280763f1f4cb861485e80863caafc9cd5ab1176543e911c27519436de7a"
93 ],
94 "metadata.yaml": [
95 "zulu8",
96 "dynamic",
97 "e89bfcdd0b0c6bddecc219cd30656e2c482558f197200ed3bb2b0f4917c937ce"
98 ],
99 "wheelhouse/pip-7.1.2-py2.py3-none-any.whl": [
100 "layer:basic",
101 "dynamic",
102 "8272f38ad219a6af3b97490859d0f4497683d8372995b8a34ac056c03dafa243"
103 ],
104 "copyright": [
105 "zulu8",
106 "static",
107 "cc92fa52ff579376afbf222c78c333f82f275651712a76ec9cc143828db25475"
108 ],
109 "hooks/relations/java/README.md": [
110 "interface:java",
111 "static",
112 "d8bdd132abb116a52fcb1db548d3c75e2a5ec3cdd873742c89be212030bc566f"
113 ],
114 "wheelhouse/PyYAML-3.11-cp27-none-linux_x86_64.whl": [
115 "layer:basic",
116 "dynamic",
117 "e5e14bca3d05c41127b72656f96cf3c2e5e9e9b9a2f2c9a207efef74a9fb359c"
118 ],
119 "hooks/start": [
120 "layer:basic",
121 "static",
122 "e3341fbab061efd2040de288e97715d7d3c0f2e3dfdd84a2d1e35fc43cec48d9"
123 ],
124 "wheelhouse/Jinja2-2.8-py2.py3-none-any.whl": [
125 "layer:basic",
126 "dynamic",
127 "6329846ce408fc32dba509275a94597b9e56beb78a8743931ef38cf0189748cb"
128 ],
129 ".gitignore": [
130 "layer:basic",
131 "static",
132 "0da5c4dcda27cd6406e5bb81cbf68ddccaf728ac764ec15053a165c1449d87d9"
133 ],
134 "hooks/relations/java/__init__.py": [
135 "interface:java",
136 "static",
137 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
138 ],
139 "hooks/install": [
140 "layer:basic",
141 "static",
142 "5f1bf2a89d26e56e57f56456d1390c55803c5f33c0c65f414692555c508283ea"
143 ],
144 "config.yaml": [
145 "zulu8",
146 "dynamic",
147 "d47282e928f04305946b22781e0ad9f3c2eb76138addb5d69f606a904f76203c"
148 ],
149 "layer.yaml": [
150 "zulu8",
151 "dynamic",
152 "4fa777c2efbbfe13f0e26c468b6ab09d0eebd6fbc9b36aece6764a643a568d5e"
153 ],
154 "wheelhouse/charms.reactive-0.3.6-py2-none-any.whl": [
155 "layer:basic",
156 "dynamic",
157 "196f8005f275e5d17ccaeb19e5a98d006fa75941ca7c81e09d2a021cacdd9ba4"
158 ],
159 "wheelhouse/charmhelpers-0.6.0-py2-none-any.whl": [
160 "layer:basic",
161 "dynamic",
162 "4a3a0bf726f45d3ac05f33d4e4cc6f43175af404f6dccfaa1b4850985e2d8670"
163 ],
164 "hooks/relations/java/copyright": [
165 "interface:java",
166 "static",
167 "188b8b4aa4477e8d2a0b4c290c451326456a0ddf58e1f314c3f5bf151ddbd8a8"
168 ],
169 "hooks/java-relation-broken": [
170 "interface:java",
171 "dynamic",
172 "b7e88ef72bd7a04a749faa425dd31f348700f5041f0bd0518a3bba37063bff2c"
173 ],
174 ".build.manifest": [
175 "build",
176 "dynamic",
177 "unchecked"
178 ],
179 "icon.svg": [
180 "zulu8",
181 "static",
182 "b9bb876dd399b42e25201f0bb073dd6e6981a0f6a13601262f0985d84b8f09bb"
183 ],
184 "hooks/java-relation-departed": [
185 "interface:java",
186 "dynamic",
187 "b7e88ef72bd7a04a749faa425dd31f348700f5041f0bd0518a3bba37063bff2c"
188 ],
189 "requirements.txt": [
190 "layer:basic",
191 "static",
192 "0f1c70d27e26005a96d66ad54482877ae20f7737693c833e29dd72bd6ac24892"
193 ],
194 "hooks/config-changed": [
195 "layer:basic",
196 "static",
197 "e3341fbab061efd2040de288e97715d7d3c0f2e3dfdd84a2d1e35fc43cec48d9"
198 ]
199 }
200}
0\ No newline at end of file201\ No newline at end of file
1202
=== renamed file '.build.manifest' => '.build.manifest.moved'
=== added file '.gitignore'
--- .gitignore 1970-01-01 00:00:00 +0000
+++ .gitignore 2017-08-09 15:38:57 +0000
@@ -0,0 +1,5 @@
1*.pyc
2*~
3.ropeproject
4.settings
5.tox
06
=== renamed file '.gitignore' => '.gitignore.moved'
=== added file 'Makefile'
--- Makefile 1970-01-01 00:00:00 +0000
+++ Makefile 2017-08-09 15:38:57 +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
=== added file 'Makefile.moved'
--- Makefile.moved 1970-01-01 00:00:00 +0000
+++ Makefile.moved 2017-08-09 15:38:57 +0000
@@ -0,0 +1,23 @@
1#!/usr/bin/make
2PYTHON := /usr/bin/env python
3
4all: lint test build
5
6
7build: unit_test
8 juju-compose -o ~/charms .
9
10lint:
11 @flake8 --exclude hooks/charmhelpers hooks unit_tests tests
12 @charm proof
13
14unit_test:
15 @echo Starting tests...
16 tox
17
18test:
19 @echo Starting Amulet tests...
20 # coreycb note: The -v should only be temporary until Amulet sends
21 # raise_status() messages to stderr:
22 # https://bugs.launchpad.net/amulet/+bug/1320357
23 @juju test -v -p AMULET_HTTP_PROXY,AMULET_OS_VIP --timeout 2700
024
=== renamed file 'Makefile' => 'Makefile.moved.moved'
=== added file 'config.yaml'
--- config.yaml 1970-01-01 00:00:00 +0000
+++ config.yaml 2017-08-09 15:38:57 +0000
@@ -0,0 +1,6 @@
1options:
2 java-major:
3 type: string
4 default: '8'
5 description: |
6 Major version of Java. Defaults to 8.
07
=== renamed file 'config.yaml' => 'config.yaml.moved'
=== added directory 'hooks'
=== renamed directory 'hooks' => 'hooks.moved'
=== added file 'hooks/config-changed'
--- hooks/config-changed 1970-01-01 00:00:00 +0000
+++ hooks/config-changed 2017-08-09 15:38:57 +0000
@@ -0,0 +1,14 @@
1#!/usr/bin/env python
2
3# Load modules from $CHARM_DIR/lib
4import sys
5sys.path.append('lib')
6
7# This will load and run the appropriate @hook and other decorated
8# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
9# and $CHARM_DIR/hooks/relations.
10#
11# See https://jujucharms.com/docs/stable/getting-started-with-charms-reactive
12# for more information on this pattern.
13from charms.reactive import main
14main()
015
=== added file 'hooks/install'
--- hooks/install 1970-01-01 00:00:00 +0000
+++ hooks/install 2017-08-09 15:38:57 +0000
@@ -0,0 +1,28 @@
1#!/usr/bin/env python
2
3from glob import glob
4import os
5import sys
6from subprocess import check_call
7
8
9# Load modules from $CHARM_DIR/lib
10sys.path.append('lib')
11
12# bootstrap wheelhouse
13if os.path.exists('wheelhouse'):
14 check_call(['apt-get', 'install', '-yq', 'python-pip'])
15 # need newer pip, to fix spurious Double Requirement error https://github.com/pypa/pip/issues/56
16 check_call(['pip', 'install', '-U', '--no-index', '-f', 'wheelhouse', 'pip'])
17 # install the rest of the wheelhouse deps
18 check_call(['pip', 'install', '-U', '--no-index'] + glob('wheelhouse/*'))
19
20
21# This will load and run the appropriate @hook and other decorated
22# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
23# and $CHARM_DIR/hooks/relations.
24#
25# See https://jujucharms.com/docs/stable/getting-started-with-charms-reactive
26# for more information on this pattern.
27from charms.reactive import main
28main()
029
=== added file 'hooks/java-relation-broken'
--- hooks/java-relation-broken 1970-01-01 00:00:00 +0000
+++ hooks/java-relation-broken 2017-08-09 15:38:57 +0000
@@ -0,0 +1,14 @@
1#!/usr/bin/env python
2
3# Load modules from $CHARM_DIR/lib
4import sys
5sys.path.append('lib')
6
7# This will load and run the appropriate @hook and other decorated
8# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
9# and $CHARM_DIR/hooks/relations.
10#
11# See https://jujucharms.com/docs/stable/getting-started-with-charms-reactive
12# for more information on this pattern.
13from charms.reactive import main
14main('java')
015
=== added file 'hooks/java-relation-changed'
--- hooks/java-relation-changed 1970-01-01 00:00:00 +0000
+++ hooks/java-relation-changed 2017-08-09 15:38:57 +0000
@@ -0,0 +1,14 @@
1#!/usr/bin/env python
2
3# Load modules from $CHARM_DIR/lib
4import sys
5sys.path.append('lib')
6
7# This will load and run the appropriate @hook and other decorated
8# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
9# and $CHARM_DIR/hooks/relations.
10#
11# See https://jujucharms.com/docs/stable/getting-started-with-charms-reactive
12# for more information on this pattern.
13from charms.reactive import main
14main('java')
015
=== added file 'hooks/java-relation-departed'
--- hooks/java-relation-departed 1970-01-01 00:00:00 +0000
+++ hooks/java-relation-departed 2017-08-09 15:38:57 +0000
@@ -0,0 +1,14 @@
1#!/usr/bin/env python
2
3# Load modules from $CHARM_DIR/lib
4import sys
5sys.path.append('lib')
6
7# This will load and run the appropriate @hook and other decorated
8# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
9# and $CHARM_DIR/hooks/relations.
10#
11# See https://jujucharms.com/docs/stable/getting-started-with-charms-reactive
12# for more information on this pattern.
13from charms.reactive import main
14main('java')
015
=== added file 'hooks/java-relation-joined'
--- hooks/java-relation-joined 1970-01-01 00:00:00 +0000
+++ hooks/java-relation-joined 2017-08-09 15:38:57 +0000
@@ -0,0 +1,14 @@
1#!/usr/bin/env python
2
3# Load modules from $CHARM_DIR/lib
4import sys
5sys.path.append('lib')
6
7# This will load and run the appropriate @hook and other decorated
8# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
9# and $CHARM_DIR/hooks/relations.
10#
11# See https://jujucharms.com/docs/stable/getting-started-with-charms-reactive
12# for more information on this pattern.
13from charms.reactive import main
14main('java')
015
=== added directory 'hooks/relations'
=== added directory 'hooks/relations/java'
=== added file 'hooks/relations/java/README.md'
--- hooks/relations/java/README.md 1970-01-01 00:00:00 +0000
+++ hooks/relations/java/README.md 2017-08-09 15:38:57 +0000
@@ -0,0 +1,58 @@
1# Overview
2
3This interface layer handles the communication with Java related services via
4the `java` interface protocol. It sets two states when appropriate:
5
6 * `{relation_name}.connected` indicates that a Java relation is present
7 * `{relation_name}.ready` indicates that Java is installed and ready
8
9The charm implementing this relation (e.g., [openjdk][]) will install and
10configure the Java environment. It also sets two pieces of relation data:
11
12 * `java-home` is equivalent to the $JAVA_HOME environment variable
13 * `java-version` is the numeric version string (e.g. "1.7.0_85")
14
15The charm consuming this relation (e.g., [ubuntu-java][]) will use the above
16relation data to configure its Java based service.
17
18
19# Example Usage
20
21An example of a charm using this interface would be:
22
23```python
24@when('java.connected')
25@when_not('java.installed')
26def install():
27 status_set('maintenance', 'Installing JRE')
28 java.install_jre()
29 reactive.set_state('java.installed')
30 hookenv.status_set('active', 'JRE is installed')
31
32@when('java.connected', 'java.installed')
33def configure():
34 # update /etc/environment, call update-alternatives, etc
35 java.configure_jre()
36 hookenv.status_set('active', 'JRE is ready')
37
38@when_not('java.connected')
39@when('java.installed')
40def uninstall():
41 java.uninstall_jre()
42 reactive.remove_state('java.installed')
43 hookenv.status_set('blocked', 'No JRE available')
44```
45
46
47# Contact Information
48
49- <bigdata@lists.ubuntu.com>
50
51
52# OpenJDK
53
54- [OpenJDK](http://openjdk.java.net/) home page
55
56
57[openjdk]: https://jujucharms.com/u/kwmonroe/openjdk
58[ubuntu-java]: https://jujucharms.com/u/kwmonroe/ubuntu-java
059
=== added file 'hooks/relations/java/__init__.py'
=== added file 'hooks/relations/java/copyright'
--- hooks/relations/java/copyright 1970-01-01 00:00:00 +0000
+++ hooks/relations/java/copyright 2017-08-09 15:38:57 +0000
@@ -0,0 +1,16 @@
1Format: http://dep.debian.net/deps/dep5/
2
3Files: *
4Copyright: Copyright 2015, Canonical Ltd., All Rights Reserved.
5License: Apache License 2.0
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9 .
10 http://www.apache.org/licenses/LICENSE-2.0
11 .
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
017
=== added file 'hooks/relations/java/interface.yaml'
--- hooks/relations/java/interface.yaml 1970-01-01 00:00:00 +0000
+++ hooks/relations/java/interface.yaml 2017-08-09 15:38:57 +0000
@@ -0,0 +1,4 @@
1name: java
2summary: Interface for relating to Java
3version: 1
4maintainer: "Big Data Team <bigdata@lists.ubuntu.com>"
05
=== added file 'hooks/relations/java/provides.py'
--- hooks/relations/java/provides.py 1970-01-01 00:00:00 +0000
+++ hooks/relations/java/provides.py 2017-08-09 15:38:57 +0000
@@ -0,0 +1,36 @@
1# Licensed under the Apache License, Version 2.0 (the "License");
2# you may not use this file except in compliance with the License.
3# You may obtain a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS,
9# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10# See the License for the specific language governing permissions and
11# limitations under the License.
12
13from charms.reactive import hook
14from charms.reactive import RelationBase
15from charms.reactive import scopes
16
17
18class JavaProvides(RelationBase):
19 scope = scopes.GLOBAL
20
21 # convenient way to provide accessor methods
22 auto_accessors = ['java-home', 'java-version']
23
24 def java_ready(self):
25 return self.get_remote('java-ready', 'false').lower() == 'true'
26
27 @hook('{provides:java}-relation-changed')
28 def changed(self):
29 if self.java_ready():
30 self.set_state('{relation_name}.ready')
31 else:
32 self.remove_state('{relation_name}.ready')
33
34 @hook('{provides:java}-relation-departed')
35 def departed(self):
36 self.remove_state('{relation_name}.ready')
037
=== added file 'hooks/relations/java/requires.py'
--- hooks/relations/java/requires.py 1970-01-01 00:00:00 +0000
+++ hooks/relations/java/requires.py 2017-08-09 15:38:57 +0000
@@ -0,0 +1,42 @@
1# Licensed under the Apache License, Version 5.0 (the "License");
2# you may not use this file except in compliance with the License.
3# You may obtain a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS,
9# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10# See the License for the specific language governing permissions and
11# limitations under the License.
12
13from charms.reactive import hook
14from charms.reactive import RelationBase
15from charms.reactive import scopes
16
17
18class JavaRequires(RelationBase):
19 scope = scopes.GLOBAL
20
21 @hook('{requires:java}-relation-joined')
22 def joined(self):
23 self.set_state('{relation_name}.connected')
24
25 @hook('{requires:java}-relation-departed')
26 def departed(self):
27 self.remove_state('{relation_name}.connected')
28
29 # Send relation data when java is ready
30 def set_ready(self, java_home, java_version):
31 self.set_remote(data={
32 'java-ready': True,
33 'java-home': java_home,
34 'java-version': java_version,
35 })
36
37 # For minor upgrades, provide a way to set java-version independently
38 def set_version(self, version):
39 self.set_remote('java-version', version)
40
41 def unset_ready(self):
42 self.set_remote('java-ready', False)
043
=== added file 'hooks/start'
--- hooks/start 1970-01-01 00:00:00 +0000
+++ hooks/start 2017-08-09 15:38:57 +0000
@@ -0,0 +1,14 @@
1#!/usr/bin/env python
2
3# Load modules from $CHARM_DIR/lib
4import sys
5sys.path.append('lib')
6
7# This will load and run the appropriate @hook and other decorated
8# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
9# and $CHARM_DIR/hooks/relations.
10#
11# See https://jujucharms.com/docs/stable/getting-started-with-charms-reactive
12# for more information on this pattern.
13from charms.reactive import main
14main()
015
=== added file 'hooks/stop'
--- hooks/stop 1970-01-01 00:00:00 +0000
+++ hooks/stop 2017-08-09 15:38:57 +0000
@@ -0,0 +1,14 @@
1#!/usr/bin/env python
2
3# Load modules from $CHARM_DIR/lib
4import sys
5sys.path.append('lib')
6
7# This will load and run the appropriate @hook and other decorated
8# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
9# and $CHARM_DIR/hooks/relations.
10#
11# See https://jujucharms.com/docs/stable/getting-started-with-charms-reactive
12# for more information on this pattern.
13from charms.reactive import main
14main()
015
=== added file 'hooks/upgrade-charm'
--- hooks/upgrade-charm 1970-01-01 00:00:00 +0000
+++ hooks/upgrade-charm 2017-08-09 15:38:57 +0000
@@ -0,0 +1,14 @@
1#!/usr/bin/env python
2
3# Load modules from $CHARM_DIR/lib
4import sys
5sys.path.append('lib')
6
7# This will load and run the appropriate @hook and other decorated
8# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
9# and $CHARM_DIR/hooks/relations.
10#
11# See https://jujucharms.com/docs/stable/getting-started-with-charms-reactive
12# for more information on this pattern.
13from charms.reactive import main
14main()
015
=== added file 'layer.yaml'
--- layer.yaml 1970-01-01 00:00:00 +0000
+++ layer.yaml 2017-08-09 15:38:57 +0000
@@ -0,0 +1,4 @@
1includes:
2- layer:basic
3- interface:java
4is: zulu8
05
=== renamed file 'layer.yaml' => 'layer.yaml.moved'
=== modified file 'metadata.yaml'
--- metadata.yaml 2016-03-10 23:04:24 +0000
+++ metadata.yaml 2017-08-09 15:38:57 +0000
@@ -1,13 +1,22 @@
1name: zulu81name: zulu8
2summary: Azul implementation of OpenJDK2summary: Azul implementation of OpenJDK
3maintainer: Azul Systems <azul_openjdk@azulsystems.com>3maintainer: Azul Systems <azul_openjdk@azul.com>
4description: |4description: |
5 Azul Zulu is open source implementation of OpenJDK.5 Azul Zulu is open source implementation of OpenJDK.
6 It provides both JRE and JDK.6 It provides both JRE and JDK.
7<<<<<<< TREE
7 More information at http://www.azulsystems.com/products/zulu8 More information at http://www.azulsystems.com/products/zulu
8tags: [java]9tags: [java]
9requires:10requires:
10 java:11 java:
11 interface: java12 interface: java
12 scope: container13 scope: container
14=======
15 More information at http://www.azul.com/products/zulu
16tags: [java]
17requires:
18 java:
19 interface: java
20 scope: container
21>>>>>>> MERGE-SOURCE
13subordinate: true22subordinate: true
1423
=== added directory 'reactive'
=== renamed directory 'reactive' => 'reactive.moved'
=== added file 'reactive/__init__.py'
=== added file 'reactive/install'
--- reactive/install 1970-01-01 00:00:00 +0000
+++ reactive/install 2017-08-09 15:38:57 +0000
@@ -0,0 +1,86 @@
1#!/bin/bash
2set -e
3
4source charms.reactive.sh
5
6# Remove any previous mention of JAVA_HOME, then append the appropriate value
7# based on the source of our /usr/bin/java symlink (if it exists).
8function update_java_home() {
9 sed -i -e '/JAVA_HOME/d' /etc/environment
10
11 if [[ -L "/usr/bin/java" ]]; then
12 java_home=$(readlink -f /usr/bin/java | sed "s:/bin/java::")
13 echo "JAVA_HOME=${java_home}" >> /etc/environment
14 fi
15}
16
17@when 'java.connected'
18@when_not 'java.installed'
19function install() {
20 java_major=$(config-get 'java-major')
21
22 # Add Azul key and repo
23 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0x219BD9C9
24 apt-key list | grep -i azul && juju-log "Key added successfully"
25 apt-add-repository "deb http://repos.azulsystems.com/ubuntu stable main"
26
27 status-set maintenance "Installing Zulu ${java_major}"
28 juju-log "zulu8: installing zulu ${java_major}"
29 apt-get update -q
30 apt-get install -qqy zulu-${java_major}
31 update_java_home
32
33 # Send relation data
34 java_home=$(readlink -f /usr/bin/java | sed "s:/bin/java::")
35 java_version=$(java -version 2>&1 | grep -i version | head -1 | awk -F '"' {'print $2'})
36 relation_call --state=java.connected set_ready $java_home $java_version
37
38 set_state 'java.installed'
39 status-set active "Zulu ${java_major} installed"
40 juju-log "zulu8: zulu ${java_major} installed"
41}
42
43@when 'java.connected' 'java.installed'
44function check_version() {
45 java_major=$(config-get 'java-major')
46 java_major_installed=$(java -version 2>&1 | grep -i version | head -1 | awk -F '.' {'print $2'})
47
48 # Install new major version if the user has set 'java-major' to something
49 # different than the version we have installed.
50 if [[ $java_major != $java_major_installed ]]; then
51 #Let's remove all available Zulu versions to avoid using java and langtools from different packets
52 status-set maintenance "Uninstalling all Zulu versions before installing new one"
53 juju-log "zulu8: uninstalling all zulu versions before installing new one"
54 apt-get remove --purge -qqy zulu*
55
56 #no need to add repo once again, so let's just install latest available package
57 status-set maintenance "Installing Zulu ${java_major}"
58 juju-log "zulu8: installing zulu ${java_major}"
59 apt-get install -qqy zulu-${java_major}
60 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
67 status-set active "Zulu ${java_major} installed"
68 juju-log "zulu8: zulu ${java_major} installed"
69 fi
70}
71
72@when 'java.installed'
73@when_not 'java.connected'
74function uninstall() {
75 # Uninstall all versions of Zulu
76 status-set maintenance "Uninstalling all Zulu versions"
77 juju-log "zulu8: uninstalling all zulu versions"
78 apt-get remove --purge -qqy zulu*
79 update_java_home
80
81 remove_state 'java.installed'
82 status-set blocked "Zulu (all versions) uninstalled"
83 juju-log "zulu8: zulu (all versions) uninstalled"
84}
85
86reactive_handler_main
087
=== added file 'requirements.txt'
--- requirements.txt 1970-01-01 00:00:00 +0000
+++ requirements.txt 2017-08-09 15:38:57 +0000
@@ -0,0 +1,2 @@
1flake8
2pytest
03
=== renamed file 'requirements.txt' => 'requirements.txt.moved'
=== added directory 'tests'
=== renamed directory 'tests' => 'tests.moved'
=== added file 'tests/01-deploy.py'
--- tests/01-deploy.py 1970-01-01 00:00:00 +0000
+++ tests/01-deploy.py 2017-08-09 15:38:57 +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 2017-08-09 15:38:57 +0000
@@ -0,0 +1,2 @@
1packages:
2 - amulet
03
=== added file 'tox.ini'
--- tox.ini 1970-01-01 00:00:00 +0000
+++ tox.ini 2017-08-09 15:38:57 +0000
@@ -0,0 +1,8 @@
1[tox]
2skipsdist=True
3envlist = py34
4
5[testenv]
6commands = py.test -v
7deps =
8 -r{toxinidir}/requirements.txt
09
=== renamed file 'tox.ini' => 'tox.ini.moved'
=== added directory 'wheelhouse'
=== renamed directory 'wheelhouse' => 'wheelhouse.moved'
=== added file 'wheelhouse/Jinja2-2.8-py2.py3-none-any.whl'
1Binary 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 differ10Binary 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
=== added file 'wheelhouse/MarkupSafe-0.23-cp27-none-linux_x86_64.whl'
2Binary 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 differ11Binary 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
=== added file 'wheelhouse/PyYAML-3.11-cp27-none-linux_x86_64.whl'
3Binary 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 differ12Binary 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
=== added file 'wheelhouse/Tempita-0.5.2-py2-none-any.whl'
4Binary 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 differ13Binary 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
=== added file 'wheelhouse/charmhelpers-0.6.0-py2-none-any.whl'
5Binary 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 differ14Binary 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
=== added file 'wheelhouse/charms.reactive-0.3.6-py2-none-any.whl'
6Binary 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 differ15Binary 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
=== added file 'wheelhouse/netaddr-0.7.18-py2-none-any.whl'
7Binary 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 differ16Binary 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
=== added file 'wheelhouse/pip-7.1.2-py2.py3-none-any.whl'
8Binary 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 differ17Binary 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
=== added file 'wheelhouse/pyaml-15.8.2-py2-none-any.whl'
9Binary 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 differ18Binary 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
=== added file 'wheelhouse/six-1.10.0-py2.py3-none-any.whl'
10Binary 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 differ19Binary 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