Merge lp:~johnsca/charms/trusty/ibm-java/layer-review into lp:~ibmcharmers/charms/trusty/ibm-java/source

Proposed by Cory Johns
Status: Merged
Merged at revision: 2
Proposed branch: lp:~johnsca/charms/trusty/ibm-java/layer-review
Merge into: lp:~ibmcharmers/charms/trusty/ibm-java/source
Diff against target: 121 lines (+16/-21)
5 files modified
README.md (+0/-3)
config.yaml (+0/-5)
files/sftp_get.sh (+3/-5)
reactive/install (+9/-5)
tests/10-bundles-test.py (+4/-3)
To merge this branch: bzr merge lp:~johnsca/charms/trusty/ibm-java/layer-review
Reviewer Review Type Date Requested Status
Prabakaran (community) Approve
Review via email: mp+287511@code.launchpad.net

Description of the change

Recommended changes from review:

  * Fix lint errors in tests
  * Create archive dir if doesn't exist (gets dropped during `charm build`)
  * Improve error handling for download in expect script

To post a comment you must log in.
4. By Cory Johns

Remove unnecessary java-major config option

Revision history for this message
Prabakaran (prabacha) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'README.md'
--- README.md 2016-02-15 08:55:57 +0000
+++ README.md 2016-02-29 18:53:05 +0000
@@ -125,9 +125,6 @@
125 should be altered by the user only when the package name is change. Else it125 should be altered by the user only when the package name is change. Else it
126 should not be altered.126 should not be altered.
127127
128- **java-major** Major version of Java. If not
129 set, it will be assigned to the default value 1.8.0.
130
131- **install-type** Type of install to perform. Valid options are 'jre' or 'full'. 128- **install-type** Type of install to perform. Valid options are 'jre' or 'full'.
132 The default is 'jre', which will install the IBM Java Runtime Environment (JRE). 129 The default is 'jre', which will install the IBM Java Runtime Environment (JRE).
133 Setting this to 'full' will install the IBM Java Development Kit in addition to the JRE.130 Setting this to 'full' will install the IBM Java Development Kit in addition to the JRE.
134131
=== modified file 'config.yaml'
--- config.yaml 2016-02-15 08:55:57 +0000
+++ config.yaml 2016-02-29 18:53:05 +0000
@@ -55,11 +55,6 @@
55 the integrity check. Refer README file to find out Checksum value for55 the integrity check. Refer README file to find out Checksum value for
56 downloaded package. Cryptographic value should be altered by the user56 downloaded package. Cryptographic value should be altered by the user
57 only when the package name is change. Else it should not be altered.57 only when the package name is change. Else it should not be altered.
58 java-major:
59 type: string
60 default: 1.8.0
61 description: |
62 Major version of Java. Defaults to 1.8.0.
63 install-type:58 install-type:
64 type: string59 type: string
65 default: jre60 default: jre
6661
=== modified file 'files/sftp_get.sh'
--- files/sftp_get.sh 2016-02-15 08:55:57 +0000
+++ files/sftp_get.sh 2016-02-29 18:53:05 +0000
@@ -10,11 +10,9 @@
10set localpath [lindex $argv 4]10set localpath [lindex $argv 4]
1111
12set timeout 9012set timeout 90
13spawn sftp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $user@$host13spawn sftp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $user@$host:$r_dir $localpath
14expect "password:"14expect "password:"
15send "$password\n"15send "$password\n"
16expect "sftp>"
17set timeout 300016set timeout 3000
18send "get -r $r_dir $localpath\n"17catch wait result
19expect "sftp>"18exit [lindex $result 3]
20send "exit\n"
2119
=== modified file 'reactive/install'
--- reactive/install 2016-02-15 08:55:57 +0000
+++ reactive/install 2016-02-29 18:53:05 +0000
@@ -179,8 +179,10 @@
179@when 'java.connected' 'license.accepted'179@when 'java.connected' 'license.accepted'
180@when_not 'java.installed'180@when_not 'java.installed'
181function install() {181function install() {
182 java_major=$(config-get 'java-major')
183 install_type=$(config-get 'install-type')182 install_type=$(config-get 'install-type')
183 if [[ ! -d $ARCHIVE_DIR ]]; then
184 mkdir $ARCHIVE_DIR
185 fi
184 cd $ARCHIVE_DIR186 cd $ARCHIVE_DIR
185 echo -e "LICENSE_ACCEPTED=TRUE\nUSER_INSTALL_DIR=$JAVA_INSTALL_PATH\nINSTALLER_UI=silent" > installer.properties187 echo -e "LICENSE_ACCEPTED=TRUE\nUSER_INSTALL_DIR=$JAVA_INSTALL_PATH\nINSTALLER_UI=silent" > installer.properties
186 download_java188 download_java
@@ -209,7 +211,7 @@
209 relation_call --state=java.connected set_ready $java_home $java_version211 relation_call --state=java.connected set_ready $java_home $java_version
210212
211 set_state 'java.installed'213 set_state 'java.installed'
212 status-set active "IBM Java ${java_major} installed"214 status-set active "IBM Java ${java_version} installed"
213 java -version215 java -version
214 if [ $? == 0 ]; then216 if [ $? == 0 ]; then
215 if [[ ${install_type} == "full" ]]; then217 if [[ ${install_type} == "full" ]]; then
@@ -229,10 +231,12 @@
229}231}
230232
231@when 'java.connected' 'java.installed' 'license.accepted'233@when 'java.connected' 'java.installed' 'license.accepted'
234@when 'config.changed'
232function check_version() {235function check_version() {
233 java_major=$(config-get 'java-major')236 if charms.reactive is_state 'config.changed.java_path_name' || \
234 java_major_installed=$(java -version 2>&1 | grep -i version | head -n 1 | awk -F '"' '{print $2}')237 charms.reactive is_state 'config.changed.install-type' || \
235 if [[ $java_major != $java_major_installed ]]; then238 charms.reactive is_state 'config.changed.java_file_name' || \
239 charms.reactive is_state 'config.changed.sha'; then
236 status-set maintenance "Uninstalling all IBM Java versions before installing new one"240 status-set maintenance "Uninstalling all IBM Java versions before installing new one"
237 remove_java_software241 remove_java_software
238 install242 install
239243
=== modified file 'tests/10-bundles-test.py' (properties changed: -x to +x)
--- tests/10-bundles-test.py 2016-02-15 08:55:57 +0000
+++ tests/10-bundles-test.py 2016-02-29 18:53:05 +0000
@@ -7,7 +7,6 @@
7import amulet7import amulet
8import sys8import sys
9import time9import time
10import requests
1110
12# Lots of prereqs on this charm so give it a large timeout accordingly11# Lots of prereqs on this charm so give it a large timeout accordingly
13seconds_to_wait = 2000012seconds_to_wait = 20000
@@ -103,7 +102,8 @@
103 cmd = "java -version"102 cmd = "java -version"
104 output, code = ibmjava_unit.run(cmd)103 output, code = ibmjava_unit.run(cmd)
105 if code != 0:104 if code != 0:
106 message = 'Unable to run Java Command: As java is not installed or appropriate path variable is not set.'105 message = 'Unable to run Java Command: As java is not ' \
106 'installed or appropriate path variable is not set.'
107 amulet.raise_status(amulet.FAIL, msg=message)107 amulet.raise_status(amulet.FAIL, msg=message)
108 else:108 else:
109 ibmjava_unit.run('mkdir -m a=rwx /home/test')109 ibmjava_unit.run('mkdir -m a=rwx /home/test')
@@ -121,7 +121,8 @@
121 output, code = ibmjava_unit.run(cmd)121 output, code = ibmjava_unit.run(cmd)
122 print('Output of simple java program is %s' % output)122 print('Output of simple java program is %s' % output)
123 if code != 0:123 if code != 0:
124 message = 'Unable to run Java Program: As java is not installed or appropriate path variable is not set.'124 message = 'Unable to run Java Program: As java is not ' \
125 'installed or appropriate path variable is not set.'
125 amulet.raise_status(amulet.FAIL, msg=message)126 amulet.raise_status(amulet.FAIL, msg=message)
126127
127if __name__ == '__main__':128if __name__ == '__main__':

Subscribers

People subscribed via source and target branches

to all changes: