Merge lp:~ibmcharmers/charms/trusty/ibm-db2/trunk into lp:charms/trusty/ibm-db2

Proposed by Suchitra Venugopal
Status: Merged
Approved by: Kevin W Monroe
Approved revision: 63
Merge reported by: Cory Johns
Merged at revision: not available
Proposed branch: lp:~ibmcharmers/charms/trusty/ibm-db2/trunk
Merge into: lp:charms/trusty/ibm-db2
Diff against target: 4535 lines (+2938/-1212)
47 files modified
.build.manifest (+298/-0)
.gitignore (+2/-0)
Makefile (+24/-0)
README.md (+78/-64)
bin/layer_option (+24/-0)
config.yaml (+62/-71)
copyright (+1/-1)
files/archives/db2inst1.INS (+119/-0)
files/archives/db2installresfile/db2inst1.INS (+0/-119)
files/archives/db2installresfile/db2server.rsp (+0/-64)
files/archives/db2installresfile/db2server_ppcle.rsp (+0/-64)
files/archives/db2server.rsp (+64/-0)
files/archives/db2server_ppcle.rsp (+64/-0)
files/sftp_get.sh (+0/-19)
hooks/config-changed (+19/-568)
hooks/db-relation-broken (+19/-0)
hooks/db-relation-changed (+19/-0)
hooks/db-relation-departed (+19/-0)
hooks/db-relation-joined (+19/-14)
hooks/hook.template (+19/-0)
hooks/install (+19/-62)
hooks/leader-elected (+19/-0)
hooks/leader-settings-changed (+19/-0)
hooks/relations/db2/README.md (+66/-0)
hooks/relations/db2/interface.yaml (+4/-0)
hooks/relations/db2/provides.py (+80/-0)
hooks/relations/db2/requires.py (+65/-0)
hooks/start (+19/-48)
hooks/stop (+19/-30)
hooks/update-status (+19/-0)
hooks/upgrade-charm (+28/-0)
layer.yaml (+22/-0)
lib/charms/__init__.py (+2/-0)
lib/charms/apt.py (+182/-0)
lib/charms/layer/__init__.py (+21/-0)
lib/charms/layer/basic.py (+159/-0)
lib/charms/layer/execd.py (+138/-0)
lib/charms/leadership.py (+58/-0)
metadata.yaml (+21/-14)
reactive/apt.py (+112/-0)
reactive/ibm-base.sh (+107/-0)
reactive/ibm-db2.sh (+799/-0)
reactive/leadership.py (+68/-0)
requirements.txt (+2/-0)
tests/00-setup (+10/-24)
tests/10-bundles-test.py (+18/-50)
tox.ini (+12/-0)
To merge this branch: bzr merge lp:~ibmcharmers/charms/trusty/ibm-db2/trunk
Reviewer Review Type Date Requested Status
Kevin W Monroe Approve
Review Queue (community) automated testing Needs Fixing
Review via email: mp+294153@code.launchpad.net

Commit message

Code changes for DB2 Layered charm

Description of the change

Updates for Layered DB2 charm.

Deployable charm can be fond in the
Repo : https://code.launchpad.net/~ibmcharmers/charms/trusty/ibm-db2/trunk

And, its source code can be found in the below repository
Repo : https://code.launchpad.net/~ibmcharmers/charms/trusty/layer-ibm-db2/trunk

The charm has been pushed into charm store as well
branch : cs:~ibmcharmers/trusty/ibm-db2-31

To post a comment you must log in.
Revision history for this message
Review Queue (review-queue) wrote :

This item has failed automated testing! Results available here http://juju-ci.vapour.ws:8080/job/charm-bundle-test-lxc/4102/

review: Needs Fixing (automated testing)
Revision history for this message
Review Queue (review-queue) wrote :

This item has failed automated testing! Results available here http://juju-ci.vapour.ws:8080/job/charm-bundle-test-aws/4116/

review: Needs Fixing (automated testing)
Revision history for this message
Cory Johns (johnsca) wrote :

Overall this looks good. I encountered a couple of small rough edges from the ibm-base layer, which can be addressed there. But I did notice that the ibm-db2.client.sshconfigured state is not set per-consumer; once any consumer sends SSH keys, all consumers will assume that keys have been sent, and once any one consumer departs, all consumers will be blocked even if they previously sent SSH keys. I don't know if that was intended, but it seems like that state should be set by the interface layer instead, such as in the dismiss() method.

Revision history for this message
Suchitra Venugopal (suchvenu) wrote :

> Overall this looks good. I encountered a couple of small rough edges from the
> ibm-base layer, which can be addressed there. But I did notice that the ibm-
> db2.client.sshconfigured state is not set per-consumer; once any consumer
> sends SSH keys, all consumers will assume that keys have been sent, and once
> any one consumer departs, all consumers will be blocked even if they
> previously sent SSH keys. I don't know if that was intended, but it seems
> like that state should be set by the interface layer instead, such as in the
> dismiss() method.

Hi Cory,
 I have done the changes as per your suggestions. Please review once and let me know.

Thanks,
 Suchitra

Revision history for this message
Kevin W Monroe (kwmonroe) wrote :

Hi Suchitra - to be compatible with recent changes in the db2 interface layer [0], I updated layer-ibm-db2 source so it uses the 'db.connected' state instead of 'db.available'. There is no need to have both states in the interface, so I removed references to the undocumented 'available' state.

The resultant ibm-db2 charms seems ok to me, but I would like you to verify this still works as expected for you. A charm based on these changes is available here:

https://jujucharms.com/u/ibmcharmers/ibm-db2/trusty/35

And can be deployed with:

juju deploy cs:~ibmcharmers/trusty/ibm-db2-35

Please let me know if this works as expected for you. If all is ok, we'll promulgate v35. Thanks!!

[0] - http://bazaar.launchpad.net/~ibmcharmers/interface-ibm-db2/trunk/revision/5

review: Needs Information
Revision history for this message
Kevin W Monroe (kwmonroe) wrote :

A diff of the changes from my comment above can be found here:

http://bazaar.launchpad.net/~ibmcharmers/charms/trusty/layer-ibm-db2/trunk/revision/10

Apologies for including lint fixes there; you can find relevant changes by searching for 'db.connected' in that diff.

Revision history for this message
Kevin W Monroe (kwmonroe) wrote :

I made a mistake in the ssh_key handler in the interface, which has now been fixed. A new version of ibm-db2 for test is available here:

juju deploy cs:~ibmcharmers/trusty/ibm-db2-36

Revision history for this message
Suchitra Venugopal (suchvenu) wrote :

Charm is tested with the changes. Few minor changes are done to handle the states properly.

Revision history for this message
Suchitra Venugopal (suchvenu) wrote :

The new version is available here :
cs:~ibmcharmers/trusty/ibm-db2-37

62. By Suchitra Venugopal

DB2 stopping the apps before db2stop

Revision history for this message
Kevin W Monroe (kwmonroe) wrote :

Hi Suchitra, I made quite a few tweaks to the layered source:

http://bazaar.launchpad.net/~ibmcharmers/charms/trusty/layer-ibm-db2/trunk/revision/20?compare_revid=15

Some are cosmetic, others are bash-ism tweaks (like comparing strings with == and integers with -eq). The most significant, however, is in the password handling of db2 users.

I didn't realize before that the db2inst1, dasusr1, db2fenc1, and the users for related units all had default passwords. This isn't acceptable for applications providing network services, so I updated this charm to use the 'pwgen' utility to create random passwords for these users.

Have a look at the above diff, which is available for deployment at:

cs:~ibmcharmers/trusty/ibm-db2-39

If you're ok with these changes, we can (finally) promulgate v39 :)

Thanks!
-Kevin

Revision history for this message
Kevin W Monroe (kwmonroe) wrote :

There was a bug in the leadership layer [0] that would cause the config.set.x states to be reset after the 'leader-elected' hook was run. This caused the db2 charm to report blocked even after installation because it thought license.accepted was no longer set.

This has been fixed in cs:~ibmcharmers/trusty/ibm-db2-41

We'll need the MP in [0] to be merged before officially promoting v41. Hopefully that will happen in the next few hours.

[0] https://code.launchpad.net/~kwmonroe/layer-leadership/+git/layer-leadership/+merge/299986

Revision history for this message
Suchitra Venugopal (suchvenu) wrote :
Download full text (5.5 KiB)

 I just removed the 2 functions you added for missing license and curl config , to check whether everything else is working fine.

1. DB2 gets installed but shows the state as

ibm-db2:
    charm: local:trusty/ibm-db2-15
    exposed: false
    service-status:
      current: maintenance
      message: Installing binutils,curl,pwgen,tar
      since: 14 Jul 2016 09:37:15+05:30
    units:
      ibm-db2/14:
        workload-status:
          current: maintenance
          message: Installing binutils,curl,pwgen,tar
          since: 14 Jul 2016 09:37:15+05:30
        agent-status:
          current: idle
          since: 14 Jul 2016 10:07:49+05:30
          version: 1.25.5.1
        agent-state: started
        agent-version: 1.25.5.1
        machine: "49"
        public-address: 10.0.3.141

The status history shows like this :

charm@islrpbeixv665:~/charms/trusty$ juju status-history ibm-db2/14 -n 1000
TIME TYPE STATUS MESSAGE
14 Jul 2016 09:21:59+05:30 workload unknown Waiting for agent initialization to finish
14 Jul 2016 09:21:59+05:30 agent allocating
14 Jul 2016 09:24:51+05:30 workload maintenance installing charm software
14 Jul 2016 09:24:52+05:30 agent executing running install hook
14 Jul 2016 09:26:24+05:30 workload maintenance ibm-base: fetching resource(s)
14 Jul 2016 09:34:38+05:30 workload active ibm-base: curl resource(s) fetched
14 Jul 2016 09:34:39+05:30 workload maintenance Installing pre requisites for IBM DB2
14 Jul 2016 09:34:51+05:30 workload maintenance Installed pre requisites for IBM DB2
14 Jul 2016 09:34:51+05:30 workload maintenance Updating apt cache
14 Jul 2016 09:35:25+05:30 workload maintenance Installing IBM DB2
14 Jul 2016 09:37:15+05:30 workload active IBM DB2 Installed
14 Jul 2016 09:37:15+05:30 workload maintenance Installing binutils,curl,pwgen,tar
14 Jul 2016 09:37:15+05:30 workload maintenance Installing binutils,curl,pwgen,tar
14 Jul 2016 09:37:20+05:30 agent executing running leader-elected hook
14 Jul 2016 09:37:23+05:30 agent executing running config-changed hook
14 Jul 2016 09:37:26+05:30 agent executing running start hook
14 Jul 2016 09:37:28+05:30 agent executing running update-status hook
14 Jul 2016 09:37:33+05:30 agent idle
14 Jul 2016 09:42:31+05:30 agent executing running update-status hook
14 Jul 2016 09:42:36+05:30 agent idle
14 Jul 2016 09:47:34+05:30 agent executing running update-status hook
14 Jul 2016 09:47:39+05:30 agent idle
14 Jul 2016 09:52:37+05:30 agent executing running update-status hook
14 Jul 2016 09:52:42+05:30 agent idle
14 Jul 2016 09:57:40+05:30 agent executing running update-status hook
14 Jul 2016 09:57:44+05:30 agent idle
14 Jul 2016 10:02:42+05:30 agent ...

Read more...

Revision history for this message
Suchitra Venugopal (suchvenu) wrote :

Getting this issue related to removing SSH Key

I am getting the following error in the log:
mmzo2djFG9xK7LduQURBTsY11JyShxQElPlHPm+z9WQEWH+JmcAQ2cjJDztlCayspGj94JzWqqf2FKiEkaIds9RlGPWnkz28LRjAwyFpw5bJmn7ACDVrhes63vMvyx1P5WtnykS2aQJAv6drmDfGcGvdNHdnC9lN/v4wB4k9JLw6eE38JASa4eIzpIb5t0qOYmQ71e5FDQPHxYHlBwRI27UHee72bdO97b7VGVE12x8cFzEx2fm6Ad244fvdP24z3D+KnDXoeupBC6TTZgav3/QsnxmG/WWqzyPYZloln4oVfAxYDvmKdTD5WERj7d3lruUP1 Juju:juju-system-key
2016-07-14 08:41:56 INFO stop mv: cannot stat 'tempfile.txt': No such file or directory
2016-07-14 08:41:56 INFO stop Traceback (most recent call last):
2016-07-14 08:41:56 INFO stop File "/var/lib/juju/agents/unit-ibm-db2-19/charm/hooks/stop", line 19, in <module>
2016-07-14 08:41:56 INFO stop main()
2016-07-14 08:41:56 INFO stop File "/usr/local/lib/python3.4/dist-packages/charms/reactive/__init__.py", line 78, in main
2

I revert back the change you did for remove_sshkeys() function and its working fine.
What was the reason for this change ? I tried testing with 2 consumers and it looks fine for me, while removing the relation between DB2 and this consumer.

Revision history for this message
Suchitra Venugopal (suchvenu) wrote :

Done the following changes with combined effort from Kevin and myself.

1. Issue related to unordered status fixed.
2. SSH key issue - reverted back the code changes related to this.
3. Updated README file with DB2 limitations

63. By Kevin W Monroe

new build of layered db2 charm (source lives in lp:~ibmcharmers/charms/trusty/layer-ibm-db2/trunk)

Revision history for this message
Kevin W Monroe (kwmonroe) wrote :

This has been a long time coming, but it looks good :) The layered ibm-db2 charm is now promulgated (https://jujucharms.com/ibm-db2/) and can be deployed with:

juju deploy ibm-db2

Thanks for the patience and work to get this charm into a recommended state!

review: Approve
Revision history for this message
Cory Johns (johnsca) wrote :

Changed status to Merged to drop off queue

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 2016-07-14 17:53:24 +0000
@@ -0,0 +1,298 @@
1{
2 "layers": [
3 "layer:ibm-base",
4 "layer:basic",
5 "layer:apt",
6 "layer:leadership",
7 "ibm-db2",
8 "interface:db2",
9 "build"
10 ],
11 "signatures": {
12 "bin/layer_option": [
13 "layer:basic",
14 "static",
15 "621b556cd208005e131e9f648859294347da9376609745a73ca2e808dd2032f9"
16 ],
17 "hooks/leader-settings-changed": [
18 "layer:basic",
19 "static",
20 "3a854a5fd180c5bacbb80b501d968a8d8bdc1468361e7123ea4022a1e0363c9a"
21 ],
22 "wheelhouse/pyaml-15.8.2.tar.gz": [
23 "layer:basic",
24 "dynamic",
25 "9c54fb5f17b58572c4cef50affea60bb73f445ab153580dac07a12383712b5b8"
26 ],
27 "lib/charms/layer/execd.py": [
28 "layer:basic",
29 "static",
30 "c0eb4c90e93a14f04d851f78bc6592e093226321fbe328125958633397aed014"
31 ],
32 "hooks/leader-elected": [
33 "layer:basic",
34 "static",
35 "3a854a5fd180c5bacbb80b501d968a8d8bdc1468361e7123ea4022a1e0363c9a"
36 ],
37 "Makefile": [
38 "layer:basic",
39 "static",
40 "b7ab3a34e5faf79b96a8632039a0ad0aa87f2a9b5f0ba604e007cafb22190301"
41 ],
42 "reactive/__init__.py": [
43 "layer:leadership",
44 "static",
45 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
46 ],
47 "tests/00-setup": [
48 "ibm-db2",
49 "static",
50 "0307887d397887fbf3f2f60b963535c455a2771615ae84c722b59a937c2185a3"
51 ],
52 "reactive/ibm-db2.sh": [
53 "ibm-db2",
54 "static",
55 "d28f50f4c6e4441501665edb609b88836af7517b4a234f286b151f5c41b61acc"
56 ],
57 ".build.manifest": [
58 "build",
59 "dynamic",
60 "unchecked"
61 ],
62 "hooks/upgrade-charm": [
63 "layer:basic",
64 "static",
65 "8b9c153a61cc78067af8d016a8fa1c764caad3a40c82bb0b5121fc4c4c6a04f1"
66 ],
67 "wheelhouse/charms.reactive-0.4.4.tar.gz": [
68 "layer:basic",
69 "dynamic",
70 "97455ce944a85adb2ceb897af81a1b93746f43527e6c4ac44798b193132158c7"
71 ],
72 "wheelhouse/Tempita-0.5.2.tar.gz": [
73 "layer:basic",
74 "dynamic",
75 "cacecf0baa674d356641f1d406b8bff1d756d739c46b869a54de515d08e6fc9c"
76 ],
77 "hooks/relations/db2/README.md": [
78 "interface:db2",
79 "static",
80 "200642c8fc5863827cd22d596b83b50be20205a6ecaebe7fd177fa52c1e16bb5"
81 ],
82 "reactive/leadership.py": [
83 "layer:leadership",
84 "static",
85 "e2b233cf861adc3b2d9e9c062134ce2f104953f03283cdddd88f49efee652e8f"
86 ],
87 "lib/charms/layer/basic.py": [
88 "layer:basic",
89 "static",
90 "d52423911fcef803a418025d355ac7c2e6729c2949c68aaf01bb3f8f24b67831"
91 ],
92 "tox.ini": [
93 "layer:basic",
94 "static",
95 "00b57a776ac313e92a52daa05d1fdb6056c21b3105b643d32610fd937664321b"
96 ],
97 "reactive/ibm-base.sh": [
98 "layer:ibm-base",
99 "static",
100 "d6251d7632d5cdd6fbc44db2478ab6ad1a392a1ed99867b28cff93b9402b2a1f"
101 ],
102 "tests/bundles.yaml": [
103 "ibm-db2",
104 "static",
105 "1f2ad79c72a0c737e7d1e94b8047076a50fd33029100435c5d39fca46f1a4f81"
106 ],
107 "copyright": [
108 "ibm-db2",
109 "static",
110 "600ba4f95fa249c78ea37dfcf870a1df35a0480509ca29bc221a80c6a7486711"
111 ],
112 "hooks/install": [
113 "layer:basic",
114 "static",
115 "3a854a5fd180c5bacbb80b501d968a8d8bdc1468361e7123ea4022a1e0363c9a"
116 ],
117 "lib/charms/leadership.py": [
118 "layer:leadership",
119 "static",
120 "12b52fa768c3e9072556ac6f46f68129dc762f89eb806d8dee921c86497f6707"
121 ],
122 "requirements.txt": [
123 "layer:basic",
124 "static",
125 "0f1c70d27e26005a96d66ad54482877ae20f7737693c833e29dd72bd6ac24892"
126 ],
127 "wheelhouse/netaddr-0.7.18.tar.gz": [
128 "layer:basic",
129 "dynamic",
130 "a1f5c9fcf75ac2579b9995c843dade33009543c04f218ff7c007b3c81695bd19"
131 ],
132 ".gitignore": [
133 "layer:leadership",
134 "static",
135 "54c2eac10d7d0187b02c271ac7a3767bb3d365d562cfb8c1548efb4e84f7b2d5"
136 ],
137 "files/archives/db2server_ppcle.rsp": [
138 "ibm-db2",
139 "static",
140 "31d1b67b7e5da6c86fcc44999b96b8520e10b4c93602691edc8e75910a0fe6cd"
141 ],
142 "wheelhouse/MarkupSafe-0.23.tar.gz": [
143 "layer:basic",
144 "dynamic",
145 "a4ec1aff59b95a14b45eb2e23761a0179e98319da5a7eb76b56ea8cdc7b871c3"
146 ],
147 "hooks/relations/db2/interface.yaml": [
148 "interface:db2",
149 "static",
150 "70f0b2954e6e8ed4e08987d3eea6932cb7cd5d310dcad5ae28b50fd721631861"
151 ],
152 "icon.svg": [
153 "ibm-db2",
154 "static",
155 "47984b36228e7500edb73a689797e0498babe9bc080573e0807bb3b4ece1b68d"
156 ],
157 "config.yaml": [
158 "ibm-db2",
159 "dynamic",
160 "6a7919e3802ebd8de302cc661f5647a3d9211bdf253a7040d7db6bd64882be81"
161 ],
162 "lib/charms/layer/__init__.py": [
163 "layer:basic",
164 "static",
165 "4ffd74384bd81d737572acf2d14fe55431eab8f49d6212d9aabedf24e1d992b2"
166 ],
167 "hooks/stop": [
168 "layer:basic",
169 "static",
170 "3a854a5fd180c5bacbb80b501d968a8d8bdc1468361e7123ea4022a1e0363c9a"
171 ],
172 "reactive/apt.py": [
173 "layer:apt",
174 "static",
175 "1d95f16ec99a5c7927b0b02c07ee7f174e51c80b2d64edc702b8d4352c70a258"
176 ],
177 "hooks/relations/db2/provides.py": [
178 "interface:db2",
179 "static",
180 "472a72180fccde0197681815e3787bab0a0b3bd5d9b12f5f0bff21b77dedd5e7"
181 ],
182 "hooks/hook.template": [
183 "layer:basic",
184 "static",
185 "3a854a5fd180c5bacbb80b501d968a8d8bdc1468361e7123ea4022a1e0363c9a"
186 ],
187 "hooks/db-relation-joined": [
188 "interface:db2",
189 "dynamic",
190 "3a854a5fd180c5bacbb80b501d968a8d8bdc1468361e7123ea4022a1e0363c9a"
191 ],
192 "wheelhouse/Jinja2-2.8.tar.gz": [
193 "layer:basic",
194 "dynamic",
195 "bc1ff2ff88dbfacefde4ddde471d1417d3b304e8df103a7a9437d47269201bf4"
196 ],
197 "hooks/db-relation-departed": [
198 "interface:db2",
199 "dynamic",
200 "3a854a5fd180c5bacbb80b501d968a8d8bdc1468361e7123ea4022a1e0363c9a"
201 ],
202 "metadata.yaml": [
203 "ibm-db2",
204 "dynamic",
205 "99910e2c192e818b159d57f763fb422d23342bb6426c87ebc6c3a410c82c265b"
206 ],
207 "wheelhouse/pip-8.1.2.tar.gz": [
208 "layer:basic",
209 "dynamic",
210 "4d24b03ffa67638a3fa931c09fd9e0273ffa904e95ebebe7d4b1a54c93d7b732"
211 ],
212 "hooks/update-status": [
213 "layer:basic",
214 "static",
215 "3a854a5fd180c5bacbb80b501d968a8d8bdc1468361e7123ea4022a1e0363c9a"
216 ],
217 "lib/charms/__init__.py": [
218 "layer:leadership",
219 "static",
220 "4032724b98ed267185b12b8ec78dd9bcb0423ab1c89a6f0dad99397fd51159d9"
221 ],
222 "README.md": [
223 "ibm-db2",
224 "static",
225 "d2f0f64141542a8ea38b1f90ea0e6ef07128b5d642cc91b95940f8240e748f4a"
226 ],
227 "hooks/start": [
228 "layer:basic",
229 "static",
230 "3a854a5fd180c5bacbb80b501d968a8d8bdc1468361e7123ea4022a1e0363c9a"
231 ],
232 "hooks/db-relation-changed": [
233 "interface:db2",
234 "dynamic",
235 "3a854a5fd180c5bacbb80b501d968a8d8bdc1468361e7123ea4022a1e0363c9a"
236 ],
237 "wheelhouse/PyYAML-3.11.zip": [
238 "layer:basic",
239 "dynamic",
240 "19bb3ac350ef878dda84a62d37c7d5c17a137386dde9c2ce7249c7a21d7f6ac9"
241 ],
242 "files/archives/db2server.rsp": [
243 "ibm-db2",
244 "static",
245 "708d2e38eab0fb470d4b7543566e3b5285ee49f6bdb53a684b7aa4ad267cc6bc"
246 ],
247 "hooks/relations/db2/requires.py": [
248 "interface:db2",
249 "static",
250 "b21956a14a95ab341be8ba5e4b12e2d1a93a40db5f4743430e31a1dc15906da4"
251 ],
252 "wheelhouse/charmhelpers-0.8.0.tar.gz": [
253 "layer:basic",
254 "dynamic",
255 "355c2632049621474c50cfee6a6f7014a863f6f3bac1134ed409479cbe99b102"
256 ],
257 "layer.yaml": [
258 "ibm-db2",
259 "dynamic",
260 "a32ac0f8ad17673d793fed0188d0f42c92931991821fd4fe1bf175cbdbb54621"
261 ],
262 "hooks/config-changed": [
263 "layer:basic",
264 "static",
265 "3a854a5fd180c5bacbb80b501d968a8d8bdc1468361e7123ea4022a1e0363c9a"
266 ],
267 "tests/10-bundles-test.py": [
268 "ibm-db2",
269 "static",
270 "a37aaf266cd0d6b36cfa3f86b22a3169924e3a38eb9be3e161b0929fe5d43e71"
271 ],
272 "hooks/relations/db2/__init__.py": [
273 "interface:db2",
274 "static",
275 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
276 ],
277 "hooks/db-relation-broken": [
278 "interface:db2",
279 "dynamic",
280 "3a854a5fd180c5bacbb80b501d968a8d8bdc1468361e7123ea4022a1e0363c9a"
281 ],
282 "files/archives/db2inst1.INS": [
283 "ibm-db2",
284 "static",
285 "accbce657a8c0fbf5bcc05465082af0302970a9a22ae1e4ac44d8541b25d31e8"
286 ],
287 "wheelhouse/six-1.10.0.tar.gz": [
288 "layer:basic",
289 "dynamic",
290 "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a"
291 ],
292 "lib/charms/apt.py": [
293 "layer:apt",
294 "static",
295 "1f95351be322b40cf6c01fcac128b3fe338516e96cf4314071a89d84a11387c7"
296 ]
297 }
298}
0\ No newline at end of file299\ No newline at end of file
1300
=== added file '.gitignore'
--- .gitignore 1970-01-01 00:00:00 +0000
+++ .gitignore 2016-07-14 17:53:24 +0000
@@ -0,0 +1,2 @@
1*~
2*.pyc
03
=== added file 'Makefile'
--- Makefile 1970-01-01 00:00:00 +0000
+++ Makefile 2016-07-14 17:53:24 +0000
@@ -0,0 +1,24 @@
1#!/usr/bin/make
2
3all: lint unit_test
4
5
6.PHONY: clean
7clean:
8 @rm -rf .tox
9
10.PHONY: apt_prereqs
11apt_prereqs:
12 @# Need tox, but don't install the apt version unless we have to (don't want to conflict with pip)
13 @which tox >/dev/null || (sudo apt-get install -y python-pip && sudo pip install tox)
14
15.PHONY: lint
16lint: apt_prereqs
17 @tox --notest
18 @PATH=.tox/py34/bin:.tox/py35/bin flake8 $(wildcard hooks reactive lib unit_tests tests)
19 @charm proof
20
21.PHONY: unit_test
22unit_test: apt_prereqs
23 @echo Starting tests...
24 tox
025
=== modified file 'README.md'
--- README.md 2016-01-12 08:17:38 +0000
+++ README.md 2016-07-14 17:53:24 +0000
@@ -28,8 +28,12 @@
2828
29Download of Product Binaries29Download of Product Binaries
30----------------------------30----------------------------
31For deploying IBM DB2 charm the user needs to download the correct package as mentioned in the `Usage` section into an SFTP server. The IBM DB2 charm will connect to the SFTP server, download and deploy the same. The SFTP server can be any Power Ubuntu/X86 Ubuntu server and should be copied into a directory structure as below31For deploying IBM DB2 charm the user needs to download the correct package as mentioned in the `Usage` section and host it on an SFTP or Web server. The IBM DB2 charm will connect to the server(either by SFTP or HTTP method) to download and deploy the same. The host server can be any Power Ubuntu/X86 Ubuntu servers and should be copied into a directory structure as below
32`/home/charm/repository/<productname>/<package.tar>`. The complete path where the package is stored is a configurable item in config.yaml file and needs to be configured before deploying the charm. The charm will download the package from this server using SFTP. Hence make sure the SFTP link is accessible. 32
33`/<path to charm dir>/charm/repository/<productname>/<package.tar>`
34
35The complete path where the package is stored is a configurable item which needs to be configured before deploying the charm.
36
3337
34Memory and Disk Requirements38Memory and Disk Requirements
35----------------------------39----------------------------
@@ -39,7 +43,7 @@
3943
40Deploy44Deploy
41------45------
42To deploy DB2 charm run the following command:46To deploy DB2 charm, run the following command:
4347
441. Make sure the appropriate memory requirements are made available481. Make sure the appropriate memory requirements are made available
4549
@@ -48,43 +52,37 @@
48 juju add-machine52 juju add-machine
49 juju deploy --to <machine number> --repository=<path_to_charms_folder> local:trusty/ibm-db253 juju deploy --to <machine number> --repository=<path_to_charms_folder> local:trusty/ibm-db2
5054
513. Set all required config values like the SFTP server, package name, directory in SFTP server where package is kept, username and password to connect to SFTP host and checksum value to proceed with installation, by using juju set command. To provide these run the following command: 553. Set all required config values like the curl__opts to log into the host machine and curl_url which specifies the url to download the packages, by using juju set command. To provide these run the following command:
5256
5357 juju set ibm-db2 curl_opts=<login credentials>
54 juju set ibm-db2 host=<host-name>58 juju set ibm-db2 curl_url=<url to download package?shavalue>
55 juju set ibm-db2 package_dir=<full-path-to-the-directory>59
56 juju set ibm-db2 username=<user-name>60 For eg:
57 juju set ibm-db2 password=<passwd>61
58 juju set ibm-db2 db2_package_name=<package-name>62 juju set ibm-db2 curl_opts="-u user:password"
59 juju set ibm-db2 sha= <checksum-value>63 juju set ibm-db2 curl_url="http://<ipaddress>/debs/ibm-db2/DB2_Svr_10.5.0.3_Linux_x86-64.tar.gz?sha512=ae20be99e3cd2cef24d53a28331871d7193cfc7f7c24c580e6e78dc58c9ffb364cbcc69cb3773d2f0135b8c9be7ee40a7dc4e09fec0a4d731c4864bbba87d31e"
60
61 For eg:
62
63 juju set ibm-db2 host="x.x.x.x"
64 juju set ibm-db2 package_dir="/home/charm/repository/ibm-db2"
65 juju set ibm-db2 username="user1"
66 juju set ibm-db2 password="password"
67 juju set ibm-db2 db2_package_name="DB2_Svr_10.5.0.3_Linux_x86-64.tar.gz"
68 juju set ibm-db2 sha=80501df818faf4f095b5a58210a0e110509fcb70
69
70 64
71 The command to find the checksum value is `sha1sum <Package Name> | cut -d" " -f1`65 The command to find the checksum value is `sha512sum <Package Name>`
66
67 In the above example sha512 is used, you can use sha256 or md5 as well.
68Also in the above example, the packages are hosted on webserver, so http protocol is used, if you have placed the packages on sftp server, then replace the protocol with sftp.
7269
734. At this point DB2 install will wait for you to accept the License. To install the downloaded binaries you must agree to the IBM license. The license file(s) can be found in the product binaries you downloaded.704. At this point DB2 install will wait for you to accept the License. To install the downloaded binaries you must agree to the IBM license. The license file(s) can be found in the product binaries you downloaded.
7471
75 If you agree to the license, run the following command :72If you agree to the license, run the following command :
7673
77 juju set ibm-db2 accept-ibm-db2-license=True74 juju set ibm-db2 license_accepted=True
7875
79 Juju deploy command will install db2 and will expose the hostname, portnumber, db2 instance, install path and userid to the users. 76
77Juju deploy command will install db2 and will expose the hostname, port number, db2 instance, install path and userid to the users.
8078
8179
82Uninstallation of IBM DB280Uninstallation of IBM DB2
83---------------------------81---------------------------
8482
85Setting the accept-ibm-db2-license to False will uninstall the product. 83Setting the license_accepted to False will uninstall the product.
8684
87 juju set ibm-db2 accept-ibm-db2-license=False85 juju set ibm-db2 license_accepted=False
8886
89Additional configuration parameters 87Additional configuration parameters
90-----------------------------------88-----------------------------------
@@ -99,21 +97,10 @@
9997
100 juju set ibm-db2 dftdbpath="/tmp"98 juju set ibm-db2 dftdbpath="/tmp"
10199
102* If you want to add a new user/password and instance name for DB2 you can do that by giving the following commands.
103
104 juju set ibm-db2 db2_user=<newusername>
105 juju set ibm-db2 db2_pw=<newuserpassword>
106
107 For eg:
108
109 juju set ibm-db2 db2_user="user1"
110 juju set ibm-db2 db2_pw="user123"
111
112If the db2_user and db2_pw is not set, then be default the charm will create db2usr1/db2usr123 using which you can connect and work with DB2. A new instance name with same name as db2_user will also be generated.
113100
114Installation Verification101Installation Verification
115------------------------102------------------------
116Once IBM DB2 charm is deployed, the user can log into the container/machine where its deployed and use the db2_user/db2_pw combination to login as the db2 user. The user can run any db2 commands after this. 103Once IBM DB2 charm is deployed, the user can log into the container/machine where it is deployed using the default user/password (db2inst1/db2inst1). The user can run any db2 commands after this.
117 104
118 * For creating a new DB the user may run the command:105 * For creating a new DB the user may run the command:
119106
@@ -127,42 +114,57 @@
127114
128 db2115 db2
129116
117Relating with other consumer charms
118----------------------------------
119IBM DB2 charm can be related to other consumer charms using the following command.
120
121 juju add-relation ibm-db2 <consumer-charm>
122
123When IBM DB2 charm is related to any consumer charm, it creates a db2instance, username/password as per the service name and will be provided to the consumer charm. IBM DB2 charm also creates DBs as provided by the consumer charm and returns the DB details once they are successfully created. The following code will help the consumer charm authors to pass the DB names to the IBM DB2 charm:
124
125 @when 'db.connected'
126 function configure_dbs(){
127 dbnames="db1,db2"
128 relation_call --state=db.connected set_dbs $dbnames || true
129 }
130
131If no DB name is provided by consumer charm, IBM DB2 charm by default creates DBs according to the service name.
132
133Also to set relation with IBM DB2 charm and make use of all the features, the consumer charm __should__ pass the ssh key from itself to IBM DB2 charm. The following code will help the consumer charm authors to do this :
134
135 @when 'db.connected'
136 @when_not 'test.sshconfigured'
137 function configure_sshkeys(){
138 SSH_PATH=/root/.ssh
139 if [ ! -f $SSH_PATH/id_rsa.pub ]; then
140 juju-log "Setting up SSH keys."
141 ssh-keygen -t rsa -f $SSH_PATH/id_rsa -N ''
142 fi
143 key="`cat $SSH_PATH/id_rsa.pub`"
144 relation_call --state=db.connected set_ssh_keys $key || true`
145 set_state 'test.sshconfigured'
146 }
147
148Without this IBM DB2 charm will not be ready and will not create the DBs for the related services.
130149
131Configuration150Configuration
132-------------151-------------
133See config.yaml file for more information.152See config.yaml file for more information.
134153
135 * `accept-ibm-db2-license`: True to accept license. Before you can use or install IBM DB2, you must accept the terms of International License Agreement for Non-Warranted Programs and additional license information. Please read the license agreement carefully. The license file(s) can be found under the server/db2/license directory after downloading and extracting IBM DB2 there. Set the value of accept-ibm-db2-license to True if you agree to IBM DB2 license.154 * `license_accepted`: True to accept license. Before you can use or install IBM DB2, you must accept the terms of International License Agreement for Non-Warranted Programs and additional license information. Please read the license agreement carefully. The license file(s) can be found under the server/db2/license directory after downloading and extracting IBM DB2 there. Set the value of license_accepted to True if you agree to IBM DB2 license.
136
137 * `sha` : Check sum value to check integrity of IBM DB2 package. The Charm uses sha1sum to check the integrity. If empty, it will fail to deploy DB2. Cryptographic value should be altered by the user only when the package name is changed. Else it should not be altered. The command to find the check sum is
138
139 sha1sum <Package Name> | cut -d" " -f1
140
141 This value can be got from the administrator or the user can run the above command from the sftp server where the package resides.
142155
143 * `dftdbpath` : This parameter contains the default file path used to create databases under the database manager. If no path is specified when a database is created, the database is created under the path specified by the dftdbpath parameter.156 * `dftdbpath` : This parameter contains the default file path used to create databases under the database manager. If no path is specified when a database is created, the database is created under the path specified by the dftdbpath parameter.
144157
145 * `db2_user` : The user name to connect to DB2 and work on the same. Db2 will create a new instance with the same name as this user name.158 * `curl_url` : Location of the IBM product installation file(s). This should be a URL that curl can use to download files. Multiple URLs should be separated by a space.
146 159
147 * `db2_pw` : The password for db2_user160 * `curl_opts` : The options passed to the 'curl' command when fetching files from curl_url.
148
149 * `host` : SFTP server where IBM DB2 packages is kept
150
151 * `package_dir` : Path to find the IBM DB2 packages on the SFTP server
152
153 * `username` : User name to connect to the SFTP server
154
155 * `password` : Password to connect to the SFTP server
156
157 * `db2_package_name` : Name of the DB2 package to be deployed
158
159161
160Additional product information162Additional product information
161------------------------------163------------------------------
162164
163##### Enabling BLU acceleration for DB2 Advanced Enterprise Server Edition/DB2 Advanced Workgroup Server Edition165##### Enabling BLU acceleration for DB2 Advanced Enterprise Server Edition/DB2 Advanced Workgroup Server Edition
164166
165The same DB2 charm(DB2 Enterprise Server Edition) can be extended to enable the BLU acceleration(DB2 Advanced Enterprise Server Edition/DB2 Advanced Workgroup Server Edition) by following the below section. The DB2 charm has to be deployed first and then few settings needs to be done to enable the BLU feature. 167The same DB2 charm(DB2 Enterprise Server Edition) can be extended to enable the BLU acceleration(DB2 Advanced Enterprise Server Edition/DB2 Advanced Workgroup Server Edition) by following the below section. The DB2 charm has to be deployed first and then few settings need to be done to enable the BLU feature.
166168
167To upgrade DB2 Enterprise Server Edition (DB2 ESE) to DB2 Advanced Enterprise Server Edition(DB2 AESE) or DB2 Advanced Workgroup Server Edition (DB2 AWSE) the user need to accept the license for the same. Run the following command for accepting the AESE/AWSE license which the user procures on buying the Advanced Enterprise/ Workgroup Server Edition product. The user needs to log in using the configured user name/password to run the below commands.169To upgrade DB2 Enterprise Server Edition (DB2 ESE) to DB2 Advanced Enterprise Server Edition(DB2 AESE) or DB2 Advanced Workgroup Server Edition (DB2 AWSE) the user need to accept the license for the same. Run the following command for accepting the AESE/AWSE license which the user procures on buying the Advanced Enterprise/ Workgroup Server Edition product. The user needs to log in using the configured user name/password to run the below commands.
168170
@@ -185,7 +187,7 @@
185 187
186The output Default table organization (DFT_TABLE_ORG) = COLUMN confirms that the DB2 AESE/AWSE with BLU is enabled. If the pre requisites for DB2 for AESE/AWSE is not set (accepting the proper license and setting the registry variable DB2_WORKLOAD) the above command would return Default table organization (DFT_TABLE_ORG) = ROW. Column-organized tables store each column on a separate set of pages on disk. Organizing data by column on disk reduces the amount of I/O needed for processing queries because only columns that are referenced in a query need to be accessed. 188The output Default table organization (DFT_TABLE_ORG) = COLUMN confirms that the DB2 AESE/AWSE with BLU is enabled. If the pre requisites for DB2 for AESE/AWSE is not set (accepting the proper license and setting the registry variable DB2_WORKLOAD) the above command would return Default table organization (DFT_TABLE_ORG) = ROW. Column-organized tables store each column on a separate set of pages on disk. Organizing data by column on disk reduces the amount of I/O needed for processing queries because only columns that are referenced in a query need to be accessed.
187189
188Once this is set all the tables created will be by default COLUMN organized where as without BLU acceleration the tables will be ROW organized. Also without proper license we cannot create COLUMN organized tables. Once we enable COLUMN organized tables, we can create either ROW enabled or COLUMN enabled tables using the option ORGANIZE BY ROW or ORGANIZE BY COLUMN while creating the tables by running the below commands from db2 command prompt.190Once this is set all the tables created will be by default COLUMN organized whereas without BLU acceleration the tables will be ROW organized. Also without proper license we cannot create COLUMN organized tables. Once we enable COLUMN organized tables, we can create either ROW enabled or COLUMN enabled tables using the option ORGANIZE BY ROW or ORGANIZE BY COLUMN while creating the tables by running the below commands from db2 command prompt.
189191
190 create table sales_row(tid integer not null, prod_name varchar(30)) ORGANIZE BY ROW192 create table sales_row(tid integer not null, prod_name varchar(30)) ORGANIZE BY ROW
191 create table sales_col(tid integer not null, prod_name varchar(30)) ORGANIZE BY COLUMN193 create table sales_col(tid integer not null, prod_name varchar(30)) ORGANIZE BY COLUMN
@@ -196,6 +198,14 @@
196 198
197More details on BLU feature can be found in the link [db2-BLU-acceleration]199More details on BLU feature can be found in the link [db2-BLU-acceleration]
198200
201IBM DB2 Limitations
202-------------------
203If you are running linux containers on a host with kernel < 3.16, be advised that db2start will not succeed because of a hard coded 32MB kernel.shmmax setting. You will need to upgrade your host to kernel 3.16 or greater by following the instructions here:
204
205https://wiki.ubuntu.com/Kernel/LTSEnablementStack
206
207DB2 also needs to be deployed using a non-zfs filesystem for container deployment. ZFS file system might cause some of the db2 commands to error out.
208
199IBM DB2 Links and Contacts209IBM DB2 Links and Contacts
200--------------------------210--------------------------
201211
@@ -237,3 +247,7 @@
237247
238248
239249
250
251
252
253
240254
=== added directory 'bin'
=== added file 'bin/layer_option'
--- bin/layer_option 1970-01-01 00:00:00 +0000
+++ bin/layer_option 2016-07-14 17:53:24 +0000
@@ -0,0 +1,24 @@
1#!/usr/bin/env python3
2
3import sys
4sys.path.append('lib')
5
6import argparse
7from charms.layer import options
8
9
10parser = argparse.ArgumentParser(description='Access layer options.')
11parser.add_argument('section',
12 help='the section, or layer, the option is from')
13parser.add_argument('option',
14 help='the option to access')
15
16args = parser.parse_args()
17value = options(args.section).get(args.option, '')
18if isinstance(value, bool):
19 sys.exit(0 if value else 1)
20elif isinstance(value, list):
21 for val in value:
22 print(val)
23else:
24 print(value)
025
=== modified file 'config.yaml'
--- config.yaml 2015-12-07 02:57:11 +0000
+++ config.yaml 2016-07-14 17:53:24 +0000
@@ -1,71 +1,62 @@
1options:1"options":
2 accept-ibm-db2-license:2 "curl_url":
3 type: boolean3 "type": "string"
4 default: False4 "default": ""
5 description: |5 "description": |
6 The DB2 software can only be used by6 Location of the IBM product installation file(s). This should be a URL
7 accepting the terms and conditions for IBM DB2 License.7 that curl can use to download files. Multiple URLs should be separated
8 Setting this option to True 8 by a space. NOTE: cryptographic verification is required and must be
9 indicates that you have read and accepted the IBM DB2 terms and 9 specified as part of the URL query string with the key a valid hash
10 conditions found in the license file. The details about accessing10 algorithms md5, sha256, or sha512, and the the checksum value itself
11 the license(s) can be found in the README.11 (http://<url>?[md5|sha256|sha512]=<checksum>).
12 Do not set this to False if a relation exists 12 For example:
13 db2_user:13 'http://example.com/file.tgz?sha256=<sum>'
14 type: string14 'sftp://example.com/file1.tgz?md5=<sum> ftp://example.com/file2.tgz?md5=<sum>'
15 default: "db2usr1"15 "curl_opts":
16 description: |16 "type": "string"
17 The username using which the user can connect to the db2. 17 "default": ""
18 Once db2 is installed this user name is generated and the user can 18 "description": |
19 perform all db2 operations using this user.19 The options passed to the 'curl' command when fetching files from
20 db2_pw:20 curl_url. For example:
21 type: string21 '-u <user:password>'
22 default: "db2usr123"22 "license_accepted":
23 description: |23 "type": "boolean"
24 The password used by the db2_user to connect to db2.24 "default": !!bool "false"
25 dftdbpath:25 "description": |
26 type: string26 Some IBM charms require acceptance of a license before installation
27 default: "/tmp"27 can proceed. If required, setting this option to True indicates that you
28 description: |28 have read and accepted the IBM terms and conditions found in the license
29 This parameter contains the default file path used to create databases under29 file referenced by the charm.
30 the database manager. If no path is specified when a database is created, the30 "extra_packages":
31 database is created under the path specified by the dftdbpath parameter.31 "description": "Space separated list of extra deb packages to install.\n"
32 host:32 "type": "string"
33 type: string33 "default": ""
34 default: ""34 "package_status":
35 description: |35 "default": "install"
36 SFTP server where IBM DB2 packages is kept. If not set or set36 "type": "string"
37 incorrectly, the charm cannot find the IBM DB2 software.37 "description": "The status of service-affecting packages will be set to this value\
38 package_dir:38 \ in the dpkg database. Valid values are \"install\" and \"hold\".\n"
39 type: string39 "install_sources":
40 default: ""40 "description": "List of extra apt sources, per charm-helpers standard format (a\
41 description: |41 \ yaml list of strings encoded as a string). Each source may be either a line\
42 Path to find the IBM DB2 packages on the SFTP server. If not set or set incorrectly, the charm cannot find the42 \ that can be added directly to sources.list(5), or in the form ppa:<user>/<ppa-name>\
43 IBM DB2 software.43 \ for adding Personal Package Archives, or a distribution component to enable.\n"
44 username:44 "type": "string"
45 type: string45 "default": ""
46 default: ""46 "install_keys":
47 description: |47 "description": "List of signing keys for install_sources package sources, per\
48 User name to connect to the SFTP server. If not48 \ charmhelpers standard format (a yaml list of strings encoded as a string).\
49 set or set incorrectly, the charm not able to download the software.49 \ The keys should be the full ASCII armoured GPG public keys. While GPG key\
50 password:50 \ ids are also supported and looked up on a keyserver, operators should be aware\
51 type: string51 \ that this mechanism is insecure. null can be used if a standard package signing\
52 default: ""52 \ key is used that will already be installed on the machine, and for PPA sources\
53 description: |53 \ where the package signing key is securely retrieved from Launchpad.\n"
54 Password to connect to the SFTP server. If not54 "type": "string"
55 set or set incorrectly, the charm not able to download the software.55 "default": ""
56 db2_package_name:56 "dftdbpath":
57 type: string57 "type": "string"
58 default: "DB2_Svr_10.5.0.3_Linux_x86-64.tar.gz"58 "default": "/tmp"
59 description: |59 "description": |
60 Name of the DB2 package. If not set, the Charm uses a 60 This parameter contains the default file path used to create databases under
61 predefined package name for download from the url location. 61 the database manager. If no path is specified when a database is created, the
62 If the predefined package is not available at url location or 62 database is created under the path specified by the dftdbpath parameter.
63 if set incorrectly,the charm cannot install the DB2 software.
64 sha:
65 type: string
66 default: ""
67 description: |
68 Checksum value to check integrity of IBM DB2 pacakage. The Charm uses
69 sha1sum to check the integrity. If empty, it throws an error and stop the
70 deployment. The command to find the checksum is
71 sha1sum <Package Name> | cut -d" " -f1
7263
=== modified file 'copyright'
--- copyright 2015-07-14 11:32:09 +0000
+++ copyright 2016-07-14 17:53:24 +0000
@@ -1,4 +1,4 @@
1Copyright 2015 IBM Corporation1Copyright 2016 IBM Corporation
22
3This Charm is licensed under the Apache License, Version 2.0 (the "License");3This Charm is licensed under the Apache License, Version 2.0 (the "License");
4you may not use this file except in compliance with the License.4you may not use this file except in compliance with the License.
55
=== added file 'files/archives/db2inst1.INS'
--- files/archives/db2inst1.INS 1970-01-01 00:00:00 +0000
+++ files/archives/db2inst1.INS 2016-07-14 17:53:24 +0000
@@ -0,0 +1,119 @@
1;Use BINARY file transfer
2
3[FILE_DESCRIPTION]
4APPLICATION=DB2/LINUXX8664 0.5.3
5FILE_CONTENT=DB2 CCA Exported Data Sources
6FILE_TYPE=CommonServer
7FILE_FORMAT_VERSION=2.0
8Platform=30
9DB2SYSTEM=ISLRPBEIXV665
10Instance=db2inst1
11
12[REGISTRY_LOCAL]
13DB2COMM=TCPIP
14DB2AUTOSTART=NO
15
16[DBM_CONFIG]
17NODETYPE=4
18RELEASE=0x1000
19DIAGLEVEL=3
20ALTERNATE_AUTH_ENC=255
21RQRIOBLK=65535
22AUTHENTICATION=0
23DIR_CACHE=1
24DISCOVER=2
25TP_MON_NAME=
26SYSADM_GROUP=DB2GRP1
27SYSCTRL_GROUP=
28SYSMAINT_GROUP=
29SYSMON_GROUP=
30TM_DATABASE=1ST_CONN
31DFT_ACCOUNT_STR=
32CATALOG_NOAUTH=0
33NOTIFYLEVEL=3
34JAVA_HEAP_SZ=2048
35FEDERATED=0
36FED_NOAUTH=0
37UTIL_IMPACT_LIM=10
38GROUP_PLUGIN=
39CLNT_PW_PLUGIN=
40CLNT_KRB_PLUGIN=
41LOCAL_GSSPLUGIN=
42MAX_QUERYDEGREE=-1
43AUDIT_BUF_SZ=0
44INTRA_PARALLEL=0
45NUMDB=32
46INITFENCED_JVM=0
47INDEXREC=2
48SHEAPTHRES=0
49BACKBUFSZ=1024
50RESTBUFSZ=1024
51ASLHEAPSZ=15
52FENCED_POOL=AUTOMATIC-1
53KEEPFENCED=1
54AGENTPRI=-1
55SSL_SVR_KEYDB=
56SSL_SVR_STASH=
57SSL_SVR_LABEL=
58SSL_SVCENAME=
59SSL_CIPHERSPECS=
60SSL_VERSIONS=
61SSL_CLNT_KEYDB=
62SSL_CLNT_STASH=
63DFT_MON_UOW=OFF
64DFT_MON_STMT=OFF
65DFT_MON_TABLE=OFF
66DFT_MON_BUFPOOL=OFF
67DFT_MON_LOCK=OFF
68DFT_MON_SORT=OFF
69DFT_MON_TIMESTAMP=ON
70CPUSPEED=1.889377e-07
71MAXTOTFILOP=0
72AGENT_STACK_SZ=1024
73MON_HEAP_SZ=AUTOMATIC90
74RESYNC_INTERVAL=180
75SPM_LOG_FILE_SZ=256
76SPM_MAX_RESYNC=20
77TRUST_ALLCLNTS=YES
78NUM_INITFENCED=0
79SPM_NAME=islrpbei
80NUM_INITAGENTS=0
81MAX_COORDAGENTS=AUTOMATIC200
82NUM_POOLAGENTS=AUTOMATIC100
83FCM_NUM_BUFFERS=4096
84FCM_NUM_CHANNELS=AUTOMATIC2048
85DISCOVER_INST=1
86MAX_CONNECTIONS=AUTOMATIC-1
87INSTANCE_MEMORY=AUTOMATIC1698252
88HEALTH_MON=OFF
89SRV_PLUGIN_MODE=1
90SRVCON_PW_PLUGIN=
91SRVCON_GSSPLUGIN_LIST=
92COMM_BANDWIDTH=1.000000e+02
93CONN_ELAPSE=10
94MAX_CONNRETRIES=5
95MAX_TIME_DIFF=60
96START_STOP_TIME=10
97FEDERATED_ASYNC=0
98
99[INST>db2inst1]
100instance_name=db2inst1
101NodeType=4
102ServerType=DB2LINUXX8664
103Authentication=SERVER
104DB2COMM=TCPIP
105
106[DB>!LOCAL:APPCNTR]
107Dir_entry_type=INDIRECT
108Drive=/home/db2inst1
109DBName=APPCNTR
110
111[DB>!LOCAL:WRKLGHT]
112Dir_entry_type=INDIRECT
113Drive=/home/db2inst1
114DBName=WRKLGHT
115
116[DB>!LOCAL:TUT_DB]
117Dir_entry_type=INDIRECT
118Drive=/home/db2inst1
119DBName=TUT_DB
0120
=== removed directory 'files/archives/db2installresfile'
=== removed file 'files/archives/db2installresfile/db2inst1.INS'
--- files/archives/db2installresfile/db2inst1.INS 2015-07-14 11:32:09 +0000
+++ files/archives/db2installresfile/db2inst1.INS 1970-01-01 00:00:00 +0000
@@ -1,119 +0,0 @@
1;Use BINARY file transfer
2
3[FILE_DESCRIPTION]
4APPLICATION=DB2/LINUXX8664 0.5.3
5FILE_CONTENT=DB2 CCA Exported Data Sources
6FILE_TYPE=CommonServer
7FILE_FORMAT_VERSION=2.0
8Platform=30
9DB2SYSTEM=ISLRPBEIXV665
10Instance=db2inst1
11
12[REGISTRY_LOCAL]
13DB2COMM=TCPIP
14DB2AUTOSTART=NO
15
16[DBM_CONFIG]
17NODETYPE=4
18RELEASE=0x1000
19DIAGLEVEL=3
20ALTERNATE_AUTH_ENC=255
21RQRIOBLK=65535
22AUTHENTICATION=0
23DIR_CACHE=1
24DISCOVER=2
25TP_MON_NAME=
26SYSADM_GROUP=DB2GRP1
27SYSCTRL_GROUP=
28SYSMAINT_GROUP=
29SYSMON_GROUP=
30TM_DATABASE=1ST_CONN
31DFT_ACCOUNT_STR=
32CATALOG_NOAUTH=0
33NOTIFYLEVEL=3
34JAVA_HEAP_SZ=2048
35FEDERATED=0
36FED_NOAUTH=0
37UTIL_IMPACT_LIM=10
38GROUP_PLUGIN=
39CLNT_PW_PLUGIN=
40CLNT_KRB_PLUGIN=
41LOCAL_GSSPLUGIN=
42MAX_QUERYDEGREE=-1
43AUDIT_BUF_SZ=0
44INTRA_PARALLEL=0
45NUMDB=32
46INITFENCED_JVM=0
47INDEXREC=2
48SHEAPTHRES=0
49BACKBUFSZ=1024
50RESTBUFSZ=1024
51ASLHEAPSZ=15
52FENCED_POOL=AUTOMATIC-1
53KEEPFENCED=1
54AGENTPRI=-1
55SSL_SVR_KEYDB=
56SSL_SVR_STASH=
57SSL_SVR_LABEL=
58SSL_SVCENAME=
59SSL_CIPHERSPECS=
60SSL_VERSIONS=
61SSL_CLNT_KEYDB=
62SSL_CLNT_STASH=
63DFT_MON_UOW=OFF
64DFT_MON_STMT=OFF
65DFT_MON_TABLE=OFF
66DFT_MON_BUFPOOL=OFF
67DFT_MON_LOCK=OFF
68DFT_MON_SORT=OFF
69DFT_MON_TIMESTAMP=ON
70CPUSPEED=1.889377e-07
71MAXTOTFILOP=0
72AGENT_STACK_SZ=1024
73MON_HEAP_SZ=AUTOMATIC90
74RESYNC_INTERVAL=180
75SPM_LOG_FILE_SZ=256
76SPM_MAX_RESYNC=20
77TRUST_ALLCLNTS=YES
78NUM_INITFENCED=0
79SPM_NAME=islrpbei
80NUM_INITAGENTS=0
81MAX_COORDAGENTS=AUTOMATIC200
82NUM_POOLAGENTS=AUTOMATIC100
83FCM_NUM_BUFFERS=4096
84FCM_NUM_CHANNELS=AUTOMATIC2048
85DISCOVER_INST=1
86MAX_CONNECTIONS=AUTOMATIC-1
87INSTANCE_MEMORY=AUTOMATIC1698252
88HEALTH_MON=OFF
89SRV_PLUGIN_MODE=1
90SRVCON_PW_PLUGIN=
91SRVCON_GSSPLUGIN_LIST=
92COMM_BANDWIDTH=1.000000e+02
93CONN_ELAPSE=10
94MAX_CONNRETRIES=5
95MAX_TIME_DIFF=60
96START_STOP_TIME=10
97FEDERATED_ASYNC=0
98
99[INST>db2inst1]
100instance_name=db2inst1
101NodeType=4
102ServerType=DB2LINUXX8664
103Authentication=SERVER
104DB2COMM=TCPIP
105
106[DB>!LOCAL:APPCNTR]
107Dir_entry_type=INDIRECT
108Drive=/home/db2inst1
109DBName=APPCNTR
110
111[DB>!LOCAL:WRKLGHT]
112Dir_entry_type=INDIRECT
113Drive=/home/db2inst1
114DBName=WRKLGHT
115
116[DB>!LOCAL:TUT_DB]
117Dir_entry_type=INDIRECT
118Drive=/home/db2inst1
119DBName=TUT_DB
1200
=== removed file 'files/archives/db2installresfile/db2server.rsp'
--- files/archives/db2installresfile/db2server.rsp 2015-07-14 11:32:09 +0000
+++ files/archives/db2installresfile/db2server.rsp 1970-01-01 00:00:00 +0000
@@ -1,64 +0,0 @@
1*--------------------------------------------------------
2* The response file is generated by the db2rspgn command
3*--------------------------------------------------------
4*--------------------------
5* Product Installation
6*--------------------------
7PROD = DB2_SERVER_EDITION
8FILE = /opt/ibm/db2/V10.5
9LIC_AGREEMENT = ACCEPT
10INSTALL_TYPE = CUSTOM
11COMP = BASE_CLIENT
12COMP = JAVA_SUPPORT
13COMP = SQL_PROCEDURES
14COMP = BASE_DB2_ENGINE
15COMP = CONNECT_SUPPORT
16COMP = DB2_DATA_SOURCE_SUPPORT
17COMP = SPATIAL_EXTENDER_SERVER_SUPPORT
18COMP = JDK
19COMP = LDAP_EXPLOITATION
20COMP = INSTANCE_SETUP_SUPPORT
21COMP = ACS
22COMP = SPATIAL_EXTENDER_CLIENT_SUPPORT
23COMP = COMMUNICATION_SUPPORT_TCPIP
24COMP = APPLICATION_DEVELOPMENT_TOOLS
25COMP = DB2_UPDATE_SERVICE
26COMP = REPL_CLIENT
27COMP = DB2_SAMPLE_DATABASE
28COMP = TEXT_SEARCH
29COMP = INFORMIX_DATA_SOURCE_SUPPORT
30COMP = ORACLE_DATA_SOURCE_SUPPORT
31COMP = FIRST_STEPS
32COMP = GUARDIUM_INST_MNGR_CLIENT
33*--------------------------
34* Installed Languages
35*--------------------------
36LANG = EN
37*--------------------------
38* Instance Properties
39*--------------------------
40INSTANCE = db2inst1
41db2inst1.NAME = db2inst1
42db2inst1.UID = db2inst1_uid
43db2inst1.GROUP_NAME = db2grp1
44db2inst1.GID = db2inst1_gid
45db2inst1.HOME_DIRECTORY = /home/db2inst1_homedir
46db2inst1.PASSWORD = db2inst1_password
47db2inst1.CLIENT_IMPORT_PROFILE = db2inst1.INS
48db2inst1.TYPE = ese
49db2inst1.FENCED_USERNAME = db2fenc1
50db2inst1.FENCED_UID = db2fenc1_uid
51db2inst1.FENCED_GROUP_NAME = db2fgrp1
52db2inst1.FENCED_GID = db2fenc1_gid
53db2inst1.FENCED_HOME_DIRECTORY = /home/db2fenc1
54db2inst1.FENCED_PASSWORD = db2fenc1
55db2inst1.CONFIGURE_TEXT_SEARCH = NO
56*--------------------------
57* DAS Properties
58*__________________________
59DAS_USERNAME = dasusr1
60DAS_UID = das_uid
61DAS_GROUP_NAME = dasadm1
62DAS_GID = das_gid
63DAS_HOME_DIRECTORY = /home/dasusr1
64DAS_PASSWORD = dasusr1
650
=== removed file 'files/archives/db2installresfile/db2server_ppcle.rsp'
--- files/archives/db2installresfile/db2server_ppcle.rsp 2015-07-14 11:32:09 +0000
+++ files/archives/db2installresfile/db2server_ppcle.rsp 1970-01-01 00:00:00 +0000
@@ -1,64 +0,0 @@
1*--------------------------------------------------------
2* The response file is generated by the db2rspgn command
3*--------------------------------------------------------
4*--------------------------
5* Product Installation
6*--------------------------
7PROD = DB2_SERVER_EDITION
8FILE = /opt/ibm/db2/V10.5
9LIC_AGREEMENT = ACCEPT
10INSTALL_TYPE = CUSTOM
11COMP = BASE_CLIENT
12COMP = JAVA_SUPPORT
13COMP = SQL_PROCEDURES
14COMP = BASE_DB2_ENGINE
15COMP = CONNECT_SUPPORT
16COMP = DB2_DATA_SOURCE_SUPPORT
17COMP = SPATIAL_EXTENDER_SERVER_SUPPORT
18COMP = JDK
19COMP = LDAP_EXPLOITATION
20COMP = INSTANCE_SETUP_SUPPORT
21*COMP = ACS
22COMP = SPATIAL_EXTENDER_CLIENT_SUPPORT
23COMP = COMMUNICATION_SUPPORT_TCPIP
24COMP = APPLICATION_DEVELOPMENT_TOOLS
25COMP = DB2_UPDATE_SERVICE
26COMP = REPL_CLIENT
27COMP = DB2_SAMPLE_DATABASE
28COMP = TEXT_SEARCH
29COMP = INFORMIX_DATA_SOURCE_SUPPORT
30COMP = ORACLE_DATA_SOURCE_SUPPORT
31COMP = FIRST_STEPS
32COMP = GUARDIUM_INST_MNGR_CLIENT
33*--------------------------
34* Installed Languages
35*--------------------------
36LANG = EN
37*--------------------------
38* Instance Properties
39*--------------------------
40INSTANCE = db2inst1
41db2inst1.NAME = db2inst1
42db2inst1.UID = db2inst1_uid
43db2inst1.GROUP_NAME = db2grp1
44db2inst1.GID = db2inst1_gid
45db2inst1.HOME_DIRECTORY = /home/db2inst1_homedir
46db2inst1.PASSWORD = db2inst1_password
47db2inst1.CLIENT_IMPORT_PROFILE = db2inst1.INS
48db2inst1.TYPE = ese
49db2inst1.FENCED_USERNAME = db2fenc1
50db2inst1.FENCED_UID = db2fenc1_uid
51db2inst1.FENCED_GROUP_NAME = db2fgrp1
52db2inst1.FENCED_GID = db2fenc1_gid
53db2inst1.FENCED_HOME_DIRECTORY = /home/db2fenc1
54db2inst1.FENCED_PASSWORD = db2fenc1
55db2inst1.CONFIGURE_TEXT_SEARCH = NO
56*--------------------------
57* DAS Properties
58*__________________________
59DAS_USERNAME = dasusr1
60DAS_UID = das_uid
61DAS_GROUP_NAME = dasadm1
62DAS_GID = das_gid
63DAS_HOME_DIRECTORY = /home/dasusr1
64DAS_PASSWORD = dasusr1
650
=== added file 'files/archives/db2server.rsp'
--- files/archives/db2server.rsp 1970-01-01 00:00:00 +0000
+++ files/archives/db2server.rsp 2016-07-14 17:53:24 +0000
@@ -0,0 +1,64 @@
1*--------------------------------------------------------
2* The response file is generated by the db2rspgn command
3*--------------------------------------------------------
4*--------------------------
5* Product Installation
6*--------------------------
7PROD = DB2_SERVER_EDITION
8FILE = /opt/ibm/db2/V10.5
9LIC_AGREEMENT = ACCEPT
10INSTALL_TYPE = CUSTOM
11COMP = BASE_CLIENT
12COMP = JAVA_SUPPORT
13COMP = SQL_PROCEDURES
14COMP = BASE_DB2_ENGINE
15COMP = CONNECT_SUPPORT
16COMP = DB2_DATA_SOURCE_SUPPORT
17COMP = SPATIAL_EXTENDER_SERVER_SUPPORT
18COMP = JDK
19COMP = LDAP_EXPLOITATION
20COMP = INSTANCE_SETUP_SUPPORT
21COMP = ACS
22COMP = SPATIAL_EXTENDER_CLIENT_SUPPORT
23COMP = COMMUNICATION_SUPPORT_TCPIP
24COMP = APPLICATION_DEVELOPMENT_TOOLS
25COMP = DB2_UPDATE_SERVICE
26COMP = REPL_CLIENT
27COMP = DB2_SAMPLE_DATABASE
28COMP = TEXT_SEARCH
29COMP = INFORMIX_DATA_SOURCE_SUPPORT
30COMP = ORACLE_DATA_SOURCE_SUPPORT
31COMP = FIRST_STEPS
32COMP = GUARDIUM_INST_MNGR_CLIENT
33*--------------------------
34* Installed Languages
35*--------------------------
36LANG = EN
37*--------------------------
38* Instance Properties
39*--------------------------
40INSTANCE = db2inst1
41db2inst1.NAME = db2inst1
42db2inst1.UID = db2inst1_uid
43db2inst1.GROUP_NAME = db2grp1
44db2inst1.GID = db2inst1_gid
45db2inst1.HOME_DIRECTORY = /home/db2inst1_homedir
46db2inst1.PASSWORD = db2inst1_password
47db2inst1.CLIENT_IMPORT_PROFILE = db2inst1.INS
48db2inst1.TYPE = ese
49db2inst1.FENCED_USERNAME = db2fenc1
50db2inst1.FENCED_UID = db2fenc1_uid
51db2inst1.FENCED_GROUP_NAME = db2fgrp1
52db2inst1.FENCED_GID = db2fenc1_gid
53db2inst1.FENCED_HOME_DIRECTORY = /home/db2fenc1
54db2inst1.FENCED_PASSWORD = db2fenc1
55db2inst1.CONFIGURE_TEXT_SEARCH = NO
56*--------------------------
57* DAS Properties
58*__________________________
59DAS_USERNAME = dasusr1
60DAS_UID = das_uid
61DAS_GROUP_NAME = dasadm1
62DAS_GID = das_gid
63DAS_HOME_DIRECTORY = /home/dasusr1
64DAS_PASSWORD = dasusr1
065
=== added file 'files/archives/db2server_ppcle.rsp'
--- files/archives/db2server_ppcle.rsp 1970-01-01 00:00:00 +0000
+++ files/archives/db2server_ppcle.rsp 2016-07-14 17:53:24 +0000
@@ -0,0 +1,64 @@
1*--------------------------------------------------------
2* The response file is generated by the db2rspgn command
3*--------------------------------------------------------
4*--------------------------
5* Product Installation
6*--------------------------
7PROD = DB2_SERVER_EDITION
8FILE = /opt/ibm/db2/V10.5
9LIC_AGREEMENT = ACCEPT
10INSTALL_TYPE = CUSTOM
11COMP = BASE_CLIENT
12COMP = JAVA_SUPPORT
13COMP = SQL_PROCEDURES
14COMP = BASE_DB2_ENGINE
15COMP = CONNECT_SUPPORT
16COMP = DB2_DATA_SOURCE_SUPPORT
17COMP = SPATIAL_EXTENDER_SERVER_SUPPORT
18COMP = JDK
19COMP = LDAP_EXPLOITATION
20COMP = INSTANCE_SETUP_SUPPORT
21*COMP = ACS
22COMP = SPATIAL_EXTENDER_CLIENT_SUPPORT
23COMP = COMMUNICATION_SUPPORT_TCPIP
24COMP = APPLICATION_DEVELOPMENT_TOOLS
25COMP = DB2_UPDATE_SERVICE
26COMP = REPL_CLIENT
27COMP = DB2_SAMPLE_DATABASE
28COMP = TEXT_SEARCH
29COMP = INFORMIX_DATA_SOURCE_SUPPORT
30COMP = ORACLE_DATA_SOURCE_SUPPORT
31COMP = FIRST_STEPS
32COMP = GUARDIUM_INST_MNGR_CLIENT
33*--------------------------
34* Installed Languages
35*--------------------------
36LANG = EN
37*--------------------------
38* Instance Properties
39*--------------------------
40INSTANCE = db2inst1
41db2inst1.NAME = db2inst1
42db2inst1.UID = db2inst1_uid
43db2inst1.GROUP_NAME = db2grp1
44db2inst1.GID = db2inst1_gid
45db2inst1.HOME_DIRECTORY = /home/db2inst1_homedir
46db2inst1.PASSWORD = db2inst1_password
47db2inst1.CLIENT_IMPORT_PROFILE = db2inst1.INS
48db2inst1.TYPE = ese
49db2inst1.FENCED_USERNAME = db2fenc1
50db2inst1.FENCED_UID = db2fenc1_uid
51db2inst1.FENCED_GROUP_NAME = db2fgrp1
52db2inst1.FENCED_GID = db2fenc1_gid
53db2inst1.FENCED_HOME_DIRECTORY = /home/db2fenc1
54db2inst1.FENCED_PASSWORD = db2fenc1
55db2inst1.CONFIGURE_TEXT_SEARCH = NO
56*--------------------------
57* DAS Properties
58*__________________________
59DAS_USERNAME = dasusr1
60DAS_UID = das_uid
61DAS_GROUP_NAME = dasadm1
62DAS_GID = das_gid
63DAS_HOME_DIRECTORY = /home/dasusr1
64DAS_PASSWORD = dasusr1
065
=== removed file 'files/sftp_get.sh'
--- files/sftp_get.sh 2015-12-09 05:27:29 +0000
+++ files/sftp_get.sh 1970-01-01 00:00:00 +0000
@@ -1,19 +0,0 @@
1#!/usr/bin/expect
2# Helper script to connect and download using sftp
3# Usage: sftp_get.sh user password host remote_dir localpath
4
5set user [lindex $argv 0]
6set password [lindex $argv 1]
7set host [lindex $argv 2]
8set r_dir [lindex $argv 3]
9set localpath [lindex $argv 4]
10
11set timeout 90
12spawn sftp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $user@$host
13expect "password:"
14send "$password\n"
15expect "sftp>"
16set timeout 3000
17send "get -r $r_dir $localpath\n"
18expect "sftp>"
19send "exit\n"
200
=== modified file 'hooks/config-changed'
--- hooks/config-changed 2016-01-12 08:17:38 +0000
+++ hooks/config-changed 2016-07-14 17:53:24 +0000
@@ -1,568 +1,19 @@
1#!/bin/bash1#!/usr/bin/env python3
22
3set -e3# Load modules from $CHARM_DIR/lib
4DB2_INSTALL_PATH=/opt/ibm/db2/V10.54import sys
5ARCHITECTURE=`uname -m`5sys.path.append('lib')
6ARCHIVE_DIR=$CHARM_DIR/files/archives6
7DB2_ARCHIVE_DIR=`pwd`7from charms.layer import basic
8DB2_USER=db2inst18basic.bootstrap_charm_deps()
9DB2_USER_PW=db2inst19basic.init_config_states()
10# Check whether DB2 is installed10
11is_db2_installed()11
12{12# This will load and run the appropriate @hook and other decorated
13 if [ -d $DB2_INSTALL_PATH/bin ]; then13# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
14 echo "True"14# and $CHARM_DIR/hooks/relations.
15 else15#
16 echo "False"16# See https://jujucharms.com/docs/stable/authors-charm-building
17 fi17# for more information on this pattern.
18}18from charms.reactive import main
19#Download DB2 package19main()
20
21download_db2()
22{
23 HOST=`config-get host`
24 PACKAGE_DIR=`config-get package_dir`
25 USERNAME=`config-get username`
26 PASSWORD=`config-get password`
27
28 #Exit if URL to download package is null
29 if [ "$USERNAME" == "" -o "$PASSWORD" == "" -o "$HOST" == "" -o "$PACKAGE_DIR" == "" ]; then
30 juju-log "IBM DB2: Failed to download files from repository. Please provide values for host,package_dir,username and password in config.yaml"
31 status-set blocked "please set db2_url"
32 exit 0
33 fi
34
35 # If an install was done, get the name of the package from which it was done
36 if [ -f $ARCHIVE_DIR/*.gz ]; then
37 pkg_name=`ls $ARCHIVE_DIR/*.gz`
38 if [ $? == 0 ]; then
39 pkg_name=`basename $pkg_name`
40 fi
41 fi
42 # Get the package name to check whether the user wants to install a different package$
43 cfg_pkg_name=`config-get db2_package_name`
44
45 # Set package name to a predefined value if the user has not provided a package name
46 if [ "$cfg_pkg_name" == "" ]; then
47 ARCHITECTURE=`uname -m`
48 if [ "$ARCHITECTURE" = "x86_64" ]; then
49 cfg_pkg_name="DB2_Svr_10.5.0.3_Linux_x86-64.tar.gz"
50 else
51 cfg_pkg_name="DB2_Svr_10.5.0.5_Linux_ppcle.tar.gz"
52 fi
53 fi
54
55 #Check whether user has selected right package name from the package name string. If he selects wrong package name , install would fail.
56
57 if [ "$ARCHITECTURE" = "x86_64" ]; then
58 juju-log "Checking the package name"
59 if echo "$cfg_pkg_name" | grep -q "x86"; then
60 juju-log "IBM DB2: Package name is matching for the platform"
61 else
62 juju-log "IBM DB2: Probably Not the right package. DB2 install will fail if its not the right package"
63 status-set blocked "Probably Not the right package. Please configure the correct package name"
64 exit 0
65 fi
66 else
67 if echo "$cfg_pkg_name" | grep -q "ppcle"; then
68 juju-log "IBM DB2: Package name is matching for the platform"
69 else
70 juju-log "IBM DB2: Probably Not the right package. DB2 install will fail if its not the right package"
71 status-set blocked "Probably Not the right package. Please configure the correct package name"
72 exit 0
73 fi
74 fi
75
76 #The user has configured a different package name
77 if [ "$pkg_name" != "$cfg_pkg_name" ]; then
78
79 #Download the new DB2 package
80 #set +e
81 juju-log "IBM DB2: Downloading DB2 package."
82 juju-log $cfg_pkg_name
83 status-set maintenance "Downloading IBM DB2 package"
84 set +e
85 $CHARM_DIR/files/sftp_get.sh $USERNAME $PASSWORD $HOST $PACKAGE_DIR/$cfg_pkg_name $ARCHIVE_DIR
86
87 if [ $? == 0 ]; then
88 juju-log "IBM DB2: Downloaded DB2 package."
89 # Delete previously downloaded and installed DB2 package
90 if [ "$pkg_name" != "" ]; then
91 juju-log "IBM DB2: Deleting the older DB2 package."
92 rm $ARCHIVE_DIR/$pkg_name
93 rm -rf $ARCHIVE_DIR/server*
94 remove_software
95 juju-log "IBM DB2: Deleted the older DB2 package."
96 fi
97
98 else
99 juju-log "IBM DB2: Download of DB2 package failed."
100 juju-log "IBM DB2: Ensure the download URL and package name are correctly set in the charm configuration."
101 exit 0
102 fi
103 set -e
104 fi
105
106
107}
108# Remove DB2, if installed
109remove_software()
110{
111 db2_inst=`is_db2_installed`
112 if [ $db2_inst == True ]; then
113 juju-log "IBM DB2: Removing IBM DB2 software......"
114 status-set maintenance "Removing IBM DB2"
115
116 #finding the DB alias names to be dropped and dropping all Databases in that
117 for queue1 in `su - $DB2_USER -c 'db2ilist'`;
118 do
119 juju-log "IBM DB2: Dropping the Databases for the instance $queue1"
120 for queue in `su - $queue1 -c 'db2 list db directory | grep "Database alias" | cut -d"=" -f2'`;
121 do
122 queue=`echo $queue | xargs`
123 juju-log "IBM DB2: Dropping the DB $queue"
124 su - $queue1 -c 'db2 drop database '$queue
125 if [ $? == 0 ]; then
126 juju-log "IBM DB2: Dropped the DB $queue"
127 else
128 juju-log "IBM DB2: Dropping the DB $queue failed"
129 status-set blocked "Dropping the DB failed"
130 exit 0
131 fi
132 done
133 juju-log "IBM DB2: Stopping the DB for $queue1"
134
135 if su - $queue1 -c 'ps -eaf|grep -i "\bdb2sysc 0\b" |grep -i '$queue1
136 then
137 su - $queue1 -c 'db2 force application all'
138 su - $queue1 -c 'db2stop'
139 if [ $? == 0 ]; then
140 juju-log "IBM DB2: Stopped the DB for the instance $queue1"
141 else
142 juju-log "IBM DB2: Stopping the DB for $queue1 failed"
143 status-set blocked "Stopping the DB for $queue1 failed"
144 exit 0
145 fi
146
147 else
148 juju-log "IBM DB2: DB2 is already stopped"
149 fi
150 done
151
152 #drop the das
153 cd $DB2_INSTALL_PATH/instance
154 juju-log "IBM DB2: Dropping the DAS"
155 ./dasdrop
156 if [ $? == 0 ]; then
157 juju-log "IBM DB2: Dropped the DAS"
158 else
159 juju-log "IBM DB2: Dropping the DAS failed"
160 status-set blocked "Dropping the DAS failed"
161 exit 0
162 fi
163
164 #delete the instances
165 su - $DB2_USER -c 'db2ilist'
166
167 for queue1 in `su - $DB2_USER -c 'db2ilist'`;
168 do
169 juju-log "IBM DB2: Deleting the instance $queue1"
170 /opt/ibm/db2/V10.5/instance/db2idrop $queue1
171 if [ $? == 0 ]; then
172 juju-log "IBM DB2: Deleted the instance $queue1"
173 else
174 juju-log "IBM DB2: Deleting the instance $queue1 failed"
175 status-set blocked "Deleting the instance $queue1 failed"
176 exit 0
177 fi
178
179 done
180
181 #Delete the instance entries from /etc/services file
182 juju-log "IBM DB2: Deleting the entries from /etc/services"
183 sed -i '/db2c_/d' /etc/services
184 if [ $? == 0 ]; then
185 juju-log "IBM DB2: Deleted the entries from /etc/services"
186 else
187 juju-log "IBM DB2: Deletion of the entries from /etc/services failed"
188 status-set blocked "Deletion of the entries from /etc/services failed"
189 exit 0
190 fi
191
192 #uninstall
193 juju-log "IBM DB2: Uninstall "
194 cd /opt/ibm/db2/V10.5/install
195 set +e
196 ./db2_deinstall -a
197 if [ $? == 0 ]; then
198 juju-log "IBM DB2: Uninstall of db2 successful"
199 else
200 juju-log "IBM DB2: Uninstall of db2 failed"
201 status-set blocked "IBM DB2 Uninstallation failed"
202 exit 0
203 fi
204 set -e
205 cd /opt/ibm
206 rm -rf db2
207 juju-log "IBM DB2: Finished Uninstalling......."
208 status-set blocked "IBM DB2 Uninstalled"
209
210 else
211 juju-log "IBM DB2: DB2 not installed"
212 fi
213
214}
215
216# Remove DB2 if license not accpeted
217remove_unaccepted_software()
218{
219
220 if [ $1 == False ]; then
221 juju-log "IBM DB2: Removing IBM DB2 (if installed) as the license agreement is not accepted."
222 remove_software
223 fi
224
225}
226# Update system configuration after installing DB2
227configure_system()
228{
229 juju-log "IBM DB2: Updating system configuration."
230 cd $DB2_INSTALL_PATH/instance
231 su - $DB2_USER -c 'db2set DB2COMM=tcpip'
232
233 #Start DB for the DB2_user
234 if su - $DB2_USER -c 'ps -eaf|grep -i "\bdb2sysc 0\b" |grep -i '$DB2_USER;
235 then
236 juju-log "IBM DB2: DB2 already started for the user $DB2_USER"
237 else
238 su - $DB2_USER -c 'db2start'
239 juju-log "IBM DB2: DB2 is started"
240 fi
241
242 service_name=`su - $DB2_USER -c 'db2 get dbm cfg|grep -i svce|cut -d"=" -f2'`
243 port_num=`grep $service_name /etc/services | cut -d"/" -f1 | cut -f2`
244 port_num=`echo $port_num | xargs`
245 if su - $DB2_USER -c 'netstat -an | grep '$port_num;
246 then
247 juju-log "DB2 started on port $port_num"
248 else
249 juju-log "DB2 not started on port $port_num"
250 exit 1
251 fi
252
253 juju-log "IBM DB2: Updated system configuration."
254
255}
256#Configure dftdbpath
257configure_dftdbpath()
258{
259 db2_inst=`is_db2_installed`
260 if [ $db2_inst == True ]; then
261 cfgdbpath=`config-get dftdbpath`
262 #If null, assign the default value
263 if [ "cfgdbpath" == "" ]
264 then
265 cfgdbpath="/tmp"
266 fi
267 for queue1 in `su - $DB2_USER -c 'db2ilist'`;
268 do
269 su - $queue1 -c 'db2 attach to '$queue1
270 dbpath=`su - $queue1 -c 'db2 get dbm cfg|grep -i DFTDBPATH|cut -d"=" -f2'`
271 cfgdbpath=`echo $cfgdbpath | xargs`
272 dbpath=`echo $dbpath | xargs`
273 if [ "$cfgdbpath" != "$dbpath" ]; then
274 if [ -d "$cfgdbpath" ]; then
275 su - $queue1 -c 'db2 update dbm cfg using DFTDBPATH '$cfgdbpath
276 if [ $? == 0 ]; then
277 juju-log "DFTDBPATH changed to $cfgdbpath"
278 else
279 juju-log "Unable to set DFTDBPATH to $cfgdbpath"
280 exit 0
281 fi
282 else
283 juju-log "Not a valid path. Please check the path and run the command again"
284 exit 0
285 fi
286 fi
287 done
288 else
289 juju-log "IBM DB2: DB2 is not installed. Install DB2 to change the dbpath"
290 exit 0
291 fi
292}
293# Edit the response file for UID
294edit_responsefile()
295{
296 rsp_file=db2server_temp.rsp
297 if [ "$ARCHITECTURE" = "x86_64" ]; then
298 orgrsp_file=db2server.rsp
299 else
300 orgrsp_file=db2server_ppcle.rsp
301 fi
302 cp $CHARM_DIR/files/archives/db2installresfile/$orgrsp_file $CHARM_DIR/files/archives/db2installresfile/$rsp_file
303
304 db2uid=`id $DB2_USER | cut -d"=" -f2 | cut -d"(" -f1`
305 sed -i s/db2inst1_uid/$db2uid/g $CHARM_DIR/files/archives/db2installresfile/$rsp_file
306 sed -i s/db2inst1_gid/$db2uid/g $CHARM_DIR/files/archives/db2installresfile/$rsp_file
307 sed -i s/db2inst1_homedir/$DB2_USER/g $CHARM_DIR/files/archives/db2installresfile/$rsp_file
308 sed -i s/db2inst1_password/$DB2_USER_PW/g $CHARM_DIR/files/archives/db2installresfile/$rsp_file
309
310 db2fenid=`id db2fenc1 | cut -d"=" -f2 | cut -d"(" -f1`
311 sed -i s/db2fenc1_uid/$db2fenid/g $CHARM_DIR/files/archives/db2installresfile/$rsp_file
312 sed -i s/db2fenc1_gid/$db2fenid/g $CHARM_DIR/files/archives/db2installresfile/$rsp_file
313 dasuid=`id dasusr1 | cut -d"=" -f2 | cut -d"(" -f1`
314 sed -i s/das_uid/$dasuid/g $CHARM_DIR/files/archives/db2installresfile/$rsp_file
315 sed -i s/das_gid/$dasuid/g $CHARM_DIR/files/archives/db2installresfile/$rsp_file
316
317}
318# Create the Required user for DB2
319
320create_user()
321{
322 passwdchanged=0
323 instance_exists=0
324 db2_inst=`is_db2_installed`
325 if [ $db2_inst == True ]; then
326 status-set maintenance "Creating Users"
327 #Find the group id for db2inst1 user which is used to install db2 and find all
328 #all users belonging to this user
329 db2inst1grpid=`id $DB2_USER | cut -d" " -f2`
330 cfgusername=`config-get db2_user`
331 cfgpasswd=`config-get db2_pw`
332
333 #If user is not set, make "db2usr1" as default user
334 if [ "cfgusername" == "" ]; then
335 cfgusername="db2usr1"
336 fi
337
338 #If password is not set, make "password" as default password
339 if [ "cfgpasswd" == "" ]; then
340 cfgpasswd="db2usr123"
341 fi
342
343 #If the user is already available, just change the password.
344 for queue2 in `awk -F':' '{ print $1}' /etc/passwd`;
345 do
346 gid=`id $queue2 | cut -d" " -f2`
347 if [ $gid == $db2inst1grpid ]; then
348 if [ $queue2 != "$DB2_USER" ]; then
349 if [ $cfgusername == $queue2 ]; then
350 juju-log "IBM DB2: Changing the password for the user $cfgusername to $cfgpasswd"
351 echo $cfgusername:$cfgpasswd | chpasswd
352 passwdchanged=1
353 juju-log "IBM DB2: Changed the password for the user $cfgusername to $cfgpasswd"
354 fi
355
356 fi
357 fi
358 done
359 #If not available, add a new user
360 if [ $passwdchanged != 1 ]; then
361 juju-log "IBM DB2: Creating New user"
362 create_newuser
363 juju-log "IBM DB2: Created New user"
364 juju-log $cfgusername
365 fi
366 #Creating a new instance for the new user if not existing
367
368 for queue1 in `su - $DB2_USER -c 'db2ilist'`;
369 do
370 if [ $queue1 == $cfgusername ]; then
371 instance_exists=1
372 fi
373 done
374 if [ $instance_exists != 1 ]; then
375 juju-log "IBM DB2: Creating new instance for the user"
376 /opt/ibm/db2/V10.5/instance/db2icrt -u $cfgusername $cfgusername
377 if [ $? == 0 ]; then
378 juju-log "IBM DB2: Created new instance for the user"
379 else
380 juju-log "Creation of new instance failed"
381 exit 0
382 fi
383 fi
384
385 #Do the configuration for the new instance created
386 new_port=50001
387 free_port=0
388 is_free=0
389 #Check whether the port number is already in etc/services file, and then add it
390 cd /etc
391 if grep -q "db2c_$cfgusername" services
392 then
393 juju-log "IBM DB2: Services file already updated"
394 else
395 while [ $free_port == 0 ]
396 do
397 is_free=`netstat -lnp | grep $new_port | cut -d":" -f2 | cut -d" " -f1`
398 if [ "$is_free" != "$new_port" ]; then
399 free_port=1
400 else
401 new_port=$((new_port+1))
402 fi
403 done
404 juju-log "IBM DB2:Updating Services file"
405 echo "db2c_$cfgusername $new_port/tcp" >> /etc/services
406 su - $cfgusername -c 'set db2instance=$cfgusername'
407 su - $cfgusername -c 'db2set DB2COMM=tcpip'
408 new_port=`echo $new_port | xargs`
409 su - $cfgusername -c 'db2 update dbm cfg using svcename '$new_port
410 /opt/ibm/db2/V10.5/instance/db2iupdt $cfgusername
411 fi
412 cd -
413
414 #Start DB for the new user
415 if su - $cfgusername -c 'ps -eaf|grep -i "\bdb2sysc 0\b" |grep -i '$cfgusername;
416 then
417 juju-log "IBM DB2: Db2 already started for the user $cfgusername"
418 else
419 su - $cfgusername -c 'db2start'
420 juju-log "IBM DB2: DB2 is started"
421 fi
422 juju-log " After db2start"
423
424 else
425 juju-log "IBM DB2: DB2 is not installed. Install DB2 before creating users"
426 exit 0
427
428 fi
429}
430create_newuser()
431{
432 cfgusername=`config-get db2_user`
433 cfgpasswd=`config-get db2_pw`
434 dbcreated="False"
435 #Add the new user
436 useradd -g db2grp1 -G dasadm1 -m $cfgusername
437 if [ $? != 0 ]; then
438 juju-log "IBM DB2: Addition of user $queue2 failed."
439 status-set blocked "Addition of new used failed, Try again"
440 exit 0
441 fi
442 #Set the password for the new user
443 echo $cfgusername:$cfgpasswd | chpasswd
444 if [ $? != 0 ]; then
445 juju-log "IBM DB2: Setting password for user $queue2 failed."
446 status-set blocked "Setting the password for user failed, Try again"
447 exit 0
448 fi
449 #Check whether test DB is already existing. If not create it
450 dbname=`su - $DB2_USER -c 'db2 list db directory' | grep "Database name" | grep -i "\bTEST\b" | cut -d"=" -f2`
451 dbname=`echo $dbname | xargs`
452 if [ "$dbname" != "TEST" ]; then
453 juju-log "IBM DB2: Creating DB Test"
454 su - $DB2_USER -c 'db2 create database test'
455 if [ $? != 0 ]; then
456 juju-log "IBM DB2: DB creation failed"
457 status-set blocked "DB creation failed, Try again"
458 exit 0
459 fi
460 juju-log "IBM DB2: Created DB Test"
461 fi
462 #Connect to the DB and grant data access
463 su - $DB2_USER -c 'db2 connect to test;db2 grant dataaccess on database to user '$cfgusername
464 if [ $? != 0 ]; then
465 juju-log "IBM DB2: Grant access failed"
466 status-set blocked "Grant dataaccess on database failed, Try again"
467 exit 0
468 fi
469
470 su - $DB2_USER -c 'db2 connect to test;db2 disconnect test'
471 if [ $? != 0 ]; then
472 juju-log "IBM DB2: Disconnect DB failed"
473 status-set blocked "Disconnect DB failed"
474 exit 0
475 fi
476
477}
478#Check the package integrity after download
479check_pkg_integrity()
480{
481 SHA=`config-get sha`
482 pkg_name=`ls $ARCHIVE_DIR/*.gz`
483
484 if [ "$SHA" == "" ]; then
485 juju-log "IBM DB2: Please provide valid sha value for your package."
486 status-set blocked "Please provide valid sha value for your package"
487 exit 0
488 elif [ "$SHA" != "`sha1sum $pkg_name | cut -d" " -f1`" ]; then
489 juju-log "IBM DB2: IBM DB2 package is corrupt."
490 status-set maintenance "IBM DB2 package is corrupt"
491 exit 1
492 fi
493}
494
495juju-log "IBM DB2: Begin config-change hook"
496db2_license_accepted=`config-get accept-ibm-db2-license`
497
498# Remove DB2 if license not accepted and exit. Else install it
499remove_unaccepted_software $db2_license_accepted
500if [ $db2_license_accepted == False ]; then
501 juju-log "IBM DB2: IBM DB2 License not accepted."
502elif [ $db2_license_accepted == True ]; then
503 juju-log "IBM DB2: License accepted"
504 db2_inst=`is_db2_installed`
505 #download db2
506 status-set maintenance "Downloading the IBM DB2 package for deployment"
507 download_db2
508 status-set maintenance "Checking whether download was successful"
509 #Install if download succeeded
510 if [ $db2_inst == False ]; then
511 if [ -f $ARCHIVE_DIR/*.gz ]; then
512 #Check the integrity of the downloaded package
513 check_pkg_integrity
514
515 cd $CHARM_DIR/files/archives
516 tar -zxvf $ARCHIVE_DIR/*.gz
517 if [ $? != 0 ]; then
518 juju-log "IBM DB2: Unable to extract the DB2 package content. Verify whether the package is corrupt."
519 status-set maintenance " Unable to extract the DB2 package content"
520 #Remove corrupt archive file
521 rm -rf $ARCHIVE_DIR/*.gz
522 exit 0
523 fi
524 if [ "$ARCHITECTURE" = "x86_64" ]; then
525 rsp_file=db2server.rsp
526 else
527 rsp_file=db2server_ppcle.rsp
528 fi
529 edit_responsefile
530 cd $CHARM_DIR/files/archives/server*
531
532 juju-log "IBM DB2: Checking etc/hosts file."
533 private_address=`unit-get private-address`
534 juju-log "private_address : $private_address"
535 cd /etc
536 if grep -q "$private_address" hosts
537 then
538 juju-log "IBM DB2: Host file already updated"
539 else
540 juju-log "IBM DB2:Updating Host file"
541 echo "$private_address `hostname`" >> /etc/hosts
542 fi
543 juju-log "IBM DB2: Installing db2 package."
544 status-set maintenance "Installing IBM DB2"
545 cd -
546 ./db2setup -r $CHARM_DIR/files/archives/db2installresfile/$rsp_file
547 juju-log "IBM DB2: Installation of db2 complete."
548 # Configure system values for Db2
549 #configure_system
550 fi
551 fi
552 # Configure system values for Db2
553 configure_system
554 #Create the required user to connect to db2
555 create_user
556 #Configure DFTDBPATH
557 configure_dftdbpath
558 juju-log "After Configure dftd"
559 status-set active "IBM DB2 Installed"
560 $CHARM_DIR/hooks/start
561 juju-log "After calling start"
562else
563 juju-log "IBM DB2: Acceptable values for license is 'True' or 'False'"
564
565fi
566juju-log "IBM DB2: End config-change hook"
567
568
56920
=== added file 'hooks/db-relation-broken'
--- hooks/db-relation-broken 1970-01-01 00:00:00 +0000
+++ hooks/db-relation-broken 2016-07-14 17:53:24 +0000
@@ -0,0 +1,19 @@
1#!/usr/bin/env python3
2
3# Load modules from $CHARM_DIR/lib
4import sys
5sys.path.append('lib')
6
7from charms.layer import basic
8basic.bootstrap_charm_deps()
9basic.init_config_states()
10
11
12# This will load and run the appropriate @hook and other decorated
13# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
14# and $CHARM_DIR/hooks/relations.
15#
16# See https://jujucharms.com/docs/stable/authors-charm-building
17# for more information on this pattern.
18from charms.reactive import main
19main()
020
=== added file 'hooks/db-relation-changed'
--- hooks/db-relation-changed 1970-01-01 00:00:00 +0000
+++ hooks/db-relation-changed 2016-07-14 17:53:24 +0000
@@ -0,0 +1,19 @@
1#!/usr/bin/env python3
2
3# Load modules from $CHARM_DIR/lib
4import sys
5sys.path.append('lib')
6
7from charms.layer import basic
8basic.bootstrap_charm_deps()
9basic.init_config_states()
10
11
12# This will load and run the appropriate @hook and other decorated
13# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
14# and $CHARM_DIR/hooks/relations.
15#
16# See https://jujucharms.com/docs/stable/authors-charm-building
17# for more information on this pattern.
18from charms.reactive import main
19main()
020
=== added file 'hooks/db-relation-departed'
--- hooks/db-relation-departed 1970-01-01 00:00:00 +0000
+++ hooks/db-relation-departed 2016-07-14 17:53:24 +0000
@@ -0,0 +1,19 @@
1#!/usr/bin/env python3
2
3# Load modules from $CHARM_DIR/lib
4import sys
5sys.path.append('lib')
6
7from charms.layer import basic
8basic.bootstrap_charm_deps()
9basic.init_config_states()
10
11
12# This will load and run the appropriate @hook and other decorated
13# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
14# and $CHARM_DIR/hooks/relations.
15#
16# See https://jujucharms.com/docs/stable/authors-charm-building
17# for more information on this pattern.
18from charms.reactive import main
19main()
020
=== modified file 'hooks/db-relation-joined'
--- hooks/db-relation-joined 2016-01-12 08:17:38 +0000
+++ hooks/db-relation-joined 2016-07-14 17:53:24 +0000
@@ -1,14 +1,19 @@
1#!/bin/sh1#!/usr/bin/env python3
22
3set -e3# Load modules from $CHARM_DIR/lib
4DB2_USER=db2inst14import sys
5CFGUSERNAME=`config-get db2_user`5sys.path.append('lib')
6CFGPASSED=`config-get db2_pw`6
77from charms.layer import basic
8service_name=`su - $CFGUSERNAME -c 'db2 get dbm cfg|grep -i svce|cut -d"=" -f2'`8basic.bootstrap_charm_deps()
9DB2_INSTALL_PATH=/opt/ibm/db2/V10.59basic.init_config_states()
10PORT_NUM=`grep $service_name /etc/services | cut -d"/" -f1 | cut -f2`10
11#remove white space11
12PORT_NUM=`echo $PORT_NUM | xargs`12# This will load and run the appropriate @hook and other decorated
1313# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
14relation-set hostname=`unit-get private-address` port=$PORT_NUM dbusername=$CFGUSERNAME dbuserpw=$CFGPASSED db2_instance_name=$CFGUSERNAME db2_install_path=$DB2_INSTALL_PATH14# and $CHARM_DIR/hooks/relations.
15#
16# See https://jujucharms.com/docs/stable/authors-charm-building
17# for more information on this pattern.
18from charms.reactive import main
19main()
1520
=== added file 'hooks/hook.template'
--- hooks/hook.template 1970-01-01 00:00:00 +0000
+++ hooks/hook.template 2016-07-14 17:53:24 +0000
@@ -0,0 +1,19 @@
1#!/usr/bin/env python3
2
3# Load modules from $CHARM_DIR/lib
4import sys
5sys.path.append('lib')
6
7from charms.layer import basic
8basic.bootstrap_charm_deps()
9basic.init_config_states()
10
11
12# This will load and run the appropriate @hook and other decorated
13# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
14# and $CHARM_DIR/hooks/relations.
15#
16# See https://jujucharms.com/docs/stable/authors-charm-building
17# for more information on this pattern.
18from charms.reactive import main
19main()
020
=== modified file 'hooks/install'
--- hooks/install 2016-01-12 08:17:38 +0000
+++ hooks/install 2016-07-14 17:53:24 +0000
@@ -1,62 +1,19 @@
1#!/bin/bash1#!/usr/bin/env python3
22
3set -e3# Load modules from $CHARM_DIR/lib
4juju-log "IBM DB2: Begin Install."4import sys
55sys.path.append('lib')
6# Get the architecture from the uname command.6
7ARCHITECTURE=`uname -m`7from charms.layer import basic
8apt-get update8basic.bootstrap_charm_deps()
9status-set maintenance "Installing pre requisites for IBM DB2"9basic.init_config_states()
1010
11juju-log "IBM DB2: Installing binutils"11
12apt-get install binutils12# This will load and run the appropriate @hook and other decorated
13juju-log "IBM DB2: Installed binutils"13# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
1414# and $CHARM_DIR/hooks/relations.
15ARCHITECTURE=`uname -m`15#
16if [ "$ARCHITECTURE" != "x86_64" -a "$ARCHITECTURE" != "ppc64le" ]; then16# See https://jujucharms.com/docs/stable/authors-charm-building
17 juju-log "IBM DB2: Unsupported platform. IBM DB2 installed with this Charm supports only the x86_64 and POWER LE (ppc64le) platforms."17# for more information on this pattern.
18 exit 118from charms.reactive import main
19fi19main()
20
21if [ "$ARCHITECTURE" == "x86_64" ]; then
22 juju-log "IBM DB2: Installing 32 bit libstdc++.so.6"
23 apt-get update
24 apt-get install lib32stdc++6 -y
25 juju-log "IBM DB2: Installed 32 bit libstdc++.so.6"
26fi
27if [ "$ARCHITECTURE" == "ppc64le" ]; then
28 juju-log "IBM DB2: Installing libnuma package for POWER LE (ppc64le) platforms."
29 apt-get install libnuma-dev -y
30 #Installing XL compiler runtime packages for Linux on Power as this is one of the prerequisite software/configuration requirements
31 echo "deb http://public.dhe.ibm.com/software/server/POWER/Linux/rte/xlcpp/le/ubuntu $(lsb_release -s -c) main" | tee -a /etc/apt/sources.list.d/ibm-xlcpp-rte.list
32 apt-get update
33 apt-get install libxlc -y --force-yes
34 juju-log "IBM DB2: Installed libnuma package for POWER LE (ppc64le) platforms."
35fi
36
37# Install expect
38juju-log "IBM DB2: Installng expect package"
39apt-get install -y expect
40juju-log "IBM DB2: Installed expect package"
41
42#create the userids required for db2 installation
43DB2_USER=db2inst1
44DB2_USER_PW=db2inst1
45
46juju-log "IBM DB2: Creating the user ids for db2 installation"
47groupadd db2grp1
48groupadd dasadm1
49groupadd db2fgrp1
50
51useradd -g db2grp1 -G dasadm1 -m $DB2_USER
52echo $DB2_USER:$DB2_USER_PW | chpasswd
53
54useradd -g dasadm1 -G db2grp1 -m dasusr1
55echo dasusr1:dasusr1 | chpasswd
56
57useradd -g db2fgrp1 -m db2fenc1
58echo db2fenc1:db2fenc1 | chpasswd
59
60juju-log "IBM DB2: Created the user ids for db2 installation"
61juju-log "IBM DB2: End Install hook"
62
6320
=== added file 'hooks/leader-elected'
--- hooks/leader-elected 1970-01-01 00:00:00 +0000
+++ hooks/leader-elected 2016-07-14 17:53:24 +0000
@@ -0,0 +1,19 @@
1#!/usr/bin/env python3
2
3# Load modules from $CHARM_DIR/lib
4import sys
5sys.path.append('lib')
6
7from charms.layer import basic
8basic.bootstrap_charm_deps()
9basic.init_config_states()
10
11
12# This will load and run the appropriate @hook and other decorated
13# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
14# and $CHARM_DIR/hooks/relations.
15#
16# See https://jujucharms.com/docs/stable/authors-charm-building
17# for more information on this pattern.
18from charms.reactive import main
19main()
020
=== added file 'hooks/leader-settings-changed'
--- hooks/leader-settings-changed 1970-01-01 00:00:00 +0000
+++ hooks/leader-settings-changed 2016-07-14 17:53:24 +0000
@@ -0,0 +1,19 @@
1#!/usr/bin/env python3
2
3# Load modules from $CHARM_DIR/lib
4import sys
5sys.path.append('lib')
6
7from charms.layer import basic
8basic.bootstrap_charm_deps()
9basic.init_config_states()
10
11
12# This will load and run the appropriate @hook and other decorated
13# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
14# and $CHARM_DIR/hooks/relations.
15#
16# See https://jujucharms.com/docs/stable/authors-charm-building
17# for more information on this pattern.
18from charms.reactive import main
19main()
020
=== added directory 'hooks/relations'
=== added directory 'hooks/relations/db2'
=== added file 'hooks/relations/db2/README.md'
--- hooks/relations/db2/README.md 1970-01-01 00:00:00 +0000
+++ hooks/relations/db2/README.md 2016-07-14 17:53:24 +0000
@@ -0,0 +1,66 @@
1# Overview
2
3This interface layer handles the communication between IBM DB2 and Consumer
4charms. The provider end of this interface provides the IBM DB2 service. The
5consumer part requires the existence of a provider to function.
6
7## Usage
8
9### Provides
10
11This interface layer will set the following states, as appropriate:
12
13- `{relation_name}.connected`: The relation is established, but IBM DB2 may not
14yet have provided any connection or service information.
15
16- `{relation_name}.sshconfigured`: A consumer ssh key has been added to the
17IBM DB2 `authorized_keys` file.
18
19- `{relation_name}.ready`: IBM DB2 has established relation with the consumer
20charm and the SSH key has been exchanged. DB2 has provided its connection
21string information, and is ready to accept requests from the consumer.
22
23- `{relation_name}.departed`: The relation has been removed. Any cleanup
24related to the consumer charm should happen now on the IBM DB2 charm since the
25consumer is going away.
26
27
28### Requires
29
30Consumers like WAS, Mobile First Server, etc require this interface to connect
31to IBM DB2. This interface layer will set the following states, as appropriate:
32
33- `{relation_name}.connected`: The consumer charm has been related to IBM DB2.
34At this point, the consumer charm sends the SSH key to IBM DB2 charm.
35
36 For example, the consumer charm can send the ssh key to IBM DB2 charm as follows:
37
38 ```
39 @when 'db.connected'
40 @when_not 'db.sshconfigured'
41 function configure_sshkeys_dbs() {
42 SSH_PATH=/root/.ssh
43 if [ ! -f $SSH_PATH/id_rsa.pub ]; then
44 juju-log "Setting up SSH keys."
45 ssh-keygen -t rsa -f $SSH_PATH/id_rsa -N ''
46 fi
47 key="`cat $SSH_PATH/id_rsa.pub`"
48 relation_call --state=db.connected set_ssh_keys "$key" || true
49 }
50 ```
51
52- `{relation_name}.ready`: IBM DB2 is ready to send connection information.
53The consumer charm can access the IBM DB2 details from the interface using the
54following methods:
55
56 - get_db2_hostname() - host name of IBM DB2
57 - get_db2_port() - port number of IBM DB2
58 - get_db2_path() - the install location of IBM DB2
59 - get_dbusername() - User name created for the consumer service to connect to DB2
60 - get_dbuserpw() - Password for connecting to DB2
61 - get_db2_instance_name() - Instance name created for the consumer service
62
63
64- `{relation_name}.departed`: The relation has been removed. Any cleanup
65related to IBM DB2 should happen now on the consumer charm since IBM DB2 is
66going away.
067
=== added file 'hooks/relations/db2/__init__.py'
=== added file 'hooks/relations/db2/interface.yaml'
--- hooks/relations/db2/interface.yaml 1970-01-01 00:00:00 +0000
+++ hooks/relations/db2/interface.yaml 2016-07-14 17:53:24 +0000
@@ -0,0 +1,4 @@
1name: db2
2summary: Facilitates communication between IBM DB2 and database consumers
3version: 1
4maintainer: "IBM Juju Support Team <jujusupp@us.ibm.com>"
05
=== added file 'hooks/relations/db2/provides.py'
--- hooks/relations/db2/provides.py 1970-01-01 00:00:00 +0000
+++ hooks/relations/db2/provides.py 2016-07-14 17:53:24 +0000
@@ -0,0 +1,80 @@
1from charms.reactive import hook
2from charms.reactive import RelationBase
3from charms.reactive import scopes
4
5
6class db2Provides(RelationBase):
7 # Every unit connecting will get the same information
8 scope = scopes.SERVICE
9 # convenient way to provide accessor methods
10 auto_accessors = ['db2_path', 'db2_port']
11
12 @hook('{provides:db2}-relation-joined')
13 def joined(self):
14 conversation = self.conversation()
15 conversation.remove_state('{relation_name}.departed')
16 conversation.set_state('{relation_name}.connected')
17
18 @hook('{provides:db2}-relation-changed')
19 def changed(self):
20 conversation = self.conversation()
21 conversation.remove_state('{relation_name}.departed')
22 conversation.set_state('{relation_name}.connected')
23 if str(conversation.get_remote('ssh_key')) != "None":
24 conversation.set_state('{relation_name}.ready')
25
26 @hook('{provides:db2}-relation-departed')
27 def departed(self):
28 conversation = self.conversation()
29 conversation.remove_state('{relation_name}.connected')
30 conversation.remove_state('{relation_name}.ready')
31 conversation.set_state('{relation_name}.departed')
32
33 def dismiss(self, service):
34 conversation = self.conversation(service)
35 conversation.remove_state('{relation_name}.departed')
36
37 def reset_states(self, service):
38 conversation = self.conversation(service)
39 conversation.remove_state('{relation_name}.connected')
40 conversation.remove_state('{relation_name}.departed')
41 conversation.remove_state('{relation_name}.ready')
42
43 def set_db_details(self, service, db2_path, db2_port, hostname,
44 dbusername, dbuserpw, db2_instance_name, dbs_created):
45 conversation = self.conversation(service)
46 conversation.set_remote(data={
47 'db2_ready': True,
48 'db2_path': db2_path,
49 'db2_port': db2_port,
50 'hostname': hostname,
51 'dbusername': dbusername,
52 'dbuserpw': dbuserpw,
53 'db2_instance_name': db2_instance_name,
54 'dbs_created': dbs_created,
55 })
56
57 def set_sshconfigured(self, service):
58 conversation = self.conversation(service)
59 conversation.set_state('{relation_name}.sshconfigured')
60
61 def dismiss_sshconfigured(self, service):
62 conversation = self.conversation(service)
63 conversation.remove_state('{relation_name}.sshconfigured')
64
65 def get_sshkeys(self, service):
66 conversation = self.conversation(service)
67 return conversation.get_remote('ssh_key')
68
69 def get_dbnames(self, service):
70 conversation = self.conversation(service)
71 return conversation.get_remote('db_names')
72
73 def services(self):
74 """
75 Return a list of services requesting databases.
76 """
77 service = []
78 for conversation in self.conversations():
79 service.append(conversation.scope)
80 return service
081
=== added file 'hooks/relations/db2/requires.py'
--- hooks/relations/db2/requires.py 1970-01-01 00:00:00 +0000
+++ hooks/relations/db2/requires.py 2016-07-14 17:53:24 +0000
@@ -0,0 +1,65 @@
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 db2Requires(RelationBase):
19 scope = scopes.GLOBAL
20 auto_accessors = ['ssh_key']
21
22 @hook('{requires:db2}-relation-joined')
23 def joined(self):
24 self.remove_state('{relation_name}.departed')
25 self.set_state('{relation_name}.connected')
26
27 @hook('{requires:db2}-relation-changed')
28 def changed(self):
29 self.remove_state('{relation_name}.departed')
30 self.set_state('{relation_name}.connected')
31 if str(self.get_remote('db2_port')) != "None":
32 self.set_state('{relation_name}.ready')
33
34 @hook('{requires:db2}-relation-departed')
35 def departed(self):
36 self.remove_state('{relation_name}.connected')
37 self.remove_state('{relation_name}.ready')
38 self.set_state('{relation_name}.departed')
39
40 def get_db2_port(self):
41 return self.get_remote('db2_port')
42
43 def get_db2_path(self):
44 return self.get_remote('db2_path')
45
46 def get_db2_hostname(self):
47 return self.get_remote('hostname')
48
49 def get_dbusername(self):
50 return self.get_remote('dbusername')
51
52 def get_dbuserpw(self):
53 return self.get_remote('dbuserpw')
54
55 def get_db2_instance_name(self):
56 return self.get_remote('db2_instance_name')
57
58 def get_db2_dbnames(self):
59 return self.get_remote('dbs_created')
60
61 def set_ssh_keys(self, ssh_key):
62 self.set_remote('ssh_key', ssh_key)
63
64 def set_dbs(self, db_names):
65 self.set_remote('db_names', db_names)
066
=== modified file 'hooks/start'
--- hooks/start 2016-01-12 08:17:38 +0000
+++ hooks/start 2016-07-14 17:53:24 +0000
@@ -1,48 +1,19 @@
1#!/bin/bash1#!/usr/bin/env python3
22
33# Load modules from $CHARM_DIR/lib
4set -e4import sys
5juju-log "IBM DB2: Begin Start hook"5sys.path.append('lib')
6DB2_USER=db2inst16
7DB2_INSTALL_PATH=/opt/ibm/db2/V10.57from charms.layer import basic
8cfgusername=`config-get db2_user`8basic.bootstrap_charm_deps()
9#If user is not set, make "db2usr1" as default user9basic.init_config_states()
10if [ "cfgusername" == "" ]; then10
11 cfgusername="db2usr1"11
12fi12# This will load and run the appropriate @hook and other decorated
1313# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
14if [ -d $DB2_INSTALL_PATH/bin ]; then14# and $CHARM_DIR/hooks/relations.
15 service_name=`su - $DB2_USER -c 'db2 get dbm cfg|grep -i svce|cut -d"=" -f2'`15#
16 PORT_NUM=`grep $service_name /etc/services | cut -d"/" -f1 | cut -f2`16# See https://jujucharms.com/docs/stable/authors-charm-building
17 #remove white space17# for more information on this pattern.
18 PORT_NUM=`echo $PORT_NUM | xargs`18from charms.reactive import main
19 if su - $DB2_USER -c 'netstat -an | grep '$PORT_NUM;19main()
20 then
21 juju-log "IBM DB2: DB2 already running on port $PORT_NUM for the instance $DB2_USER"
22 else
23 su - db2inst1 -c 'db2start'
24 if su - $DB2_USER -c 'netstat -an | grep '$PORT_NUM;
25 then
26 juju-log "IBM DB2: DB2 started on port $PORT_NUM for the instance $DB2_USER"
27 else
28 juju-log "IBM DB2: DB2 not started on port $PORT_NUM for the instance $DB2_USER"
29 exit 1
30 fi
31 fi
32 #Start the service for the db2 user configured
33 if su - $cfgusername -c 'ps -eaf|grep -i "\bdb2sysc 0\b" |grep -i '$cfgusername
34 then
35 juju-log "IBM DB2: DB2 already running for the instance $cfgusername"
36 else
37 su - $cfgusername -c 'db2start'
38 if su - $cfgusername -c 'ps -eaf|grep -i "\bdb2sysc 0\b" |grep -i '$cfgusername
39 then
40 juju-log "IBM DB2: DB2 started for the instance $cfgusername"
41 else
42 juju-log "IBM DB2: DB2 not started for the instance $cfgusername"
43 exit 1
44 fi
45 fi
46fi
47
48juju-log "IBM DB2: End Start hook"
4920
=== modified file 'hooks/stop'
--- hooks/stop 2016-01-12 08:17:38 +0000
+++ hooks/stop 2016-07-14 17:53:24 +0000
@@ -1,30 +1,19 @@
1#!/bin/bash1#!/usr/bin/env python3
22
3set -e3# Load modules from $CHARM_DIR/lib
4juju-log "IBM DB2: Begin Stop hook"4import sys
5DB2_USER=db2inst15sys.path.append('lib')
6DB2_INSTALL_PATH=/opt/ibm/db2/V10.56
7if [ -d $DB2_INSTALL_PATH/bin ]; then7from charms.layer import basic
8 service_name=`su - $DB2_USER -c 'db2 get dbm cfg|grep -i svce|cut -d"=" -f2'`8basic.bootstrap_charm_deps()
9 PORT_NUM=`grep $service_name /etc/services | cut -d"/" -f1 | cut -f2`9basic.init_config_states()
10 #remove white space10
11 PORT_NUM=`echo $PORT_NUM | xargs`11
12 if su - $DB2_USER -c 'netstat -an | grep '$PORT_NUM;12# This will load and run the appropriate @hook and other decorated
13 then13# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
14 su - db2inst1 -c 'db2stop'14# and $CHARM_DIR/hooks/relations.
15 juju-log "IBM DB2: DB2 stopped for the instance $DB2_USER"15#
16 else16# See https://jujucharms.com/docs/stable/authors-charm-building
17 juju-log "IBM DB2: DB2 is already stopped for the instance $DB2_USER"17# for more information on this pattern.
18 fi18from charms.reactive import main
19 19main()
20 #Stopping for the db2 user configured
21 if su - $cfgusername -c 'ps -eaf|grep -i "\bdb2sysc 0\b" |grep -i '$cfgusername
22 then
23 su - $cfgusername -c 'db2stop'
24 juju-log "IBM DB2: DB2 stopped for instance $cfgusername"
25 else
26 juju-log "IBM DB2: DB2 is already stopped for the instance $cfgusername"
27 fi
28
29fi
30juju-log "IBM DB2: End Stop hook"
3120
=== added file 'hooks/update-status'
--- hooks/update-status 1970-01-01 00:00:00 +0000
+++ hooks/update-status 2016-07-14 17:53:24 +0000
@@ -0,0 +1,19 @@
1#!/usr/bin/env python3
2
3# Load modules from $CHARM_DIR/lib
4import sys
5sys.path.append('lib')
6
7from charms.layer import basic
8basic.bootstrap_charm_deps()
9basic.init_config_states()
10
11
12# This will load and run the appropriate @hook and other decorated
13# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
14# and $CHARM_DIR/hooks/relations.
15#
16# See https://jujucharms.com/docs/stable/authors-charm-building
17# for more information on this pattern.
18from charms.reactive import main
19main()
020
=== added file 'hooks/upgrade-charm'
--- hooks/upgrade-charm 1970-01-01 00:00:00 +0000
+++ hooks/upgrade-charm 2016-07-14 17:53:24 +0000
@@ -0,0 +1,28 @@
1#!/usr/bin/env python3
2
3# Load modules from $CHARM_DIR/lib
4import os
5import sys
6sys.path.append('lib')
7
8# This is an upgrade-charm context, make sure we install latest deps
9if not os.path.exists('wheelhouse/.upgrade'):
10 open('wheelhouse/.upgrade', 'w').close()
11 if os.path.exists('wheelhouse/.bootstrapped'):
12 os.unlink('wheelhouse/.bootstrapped')
13else:
14 os.unlink('wheelhouse/.upgrade')
15
16from charms.layer import basic
17basic.bootstrap_charm_deps()
18basic.init_config_states()
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/authors-charm-building
26# for more information on this pattern.
27from charms.reactive import main
28main()
029
=== added file 'layer.yaml'
--- layer.yaml 1970-01-01 00:00:00 +0000
+++ layer.yaml 2016-07-14 17:53:24 +0000
@@ -0,0 +1,22 @@
1"includes":
2- "layer:basic"
3- "layer:apt"
4- "layer:leadership"
5- "layer:basic"
6- "layer:ibm-base"
7- "interface:db2"
8"options":
9 "basic":
10 # Setting options for the basic layer.
11 "packages":
12 - "curl"
13 - "binutils"
14 - "pwgen"
15 - "tar"
16 "use_venv": !!bool "false"
17 "include_system_packages": !!bool "false"
18 "ibm-base": {}
19 "leadership": {}
20 "ibm-db2": {}
21"repo": "bzr+ssh://bazaar.launchpad.net/~ibmcharmers/charms/trusty/layer-ibm-db2/trunk/"
22"is": "ibm-db2"
023
=== added directory 'lib'
=== added directory 'lib/charms'
=== added file 'lib/charms/__init__.py'
--- lib/charms/__init__.py 1970-01-01 00:00:00 +0000
+++ lib/charms/__init__.py 2016-07-14 17:53:24 +0000
@@ -0,0 +1,2 @@
1from pkgutil import extend_path
2__path__ = extend_path(__path__, __name__)
03
=== added file 'lib/charms/apt.py'
--- lib/charms/apt.py 1970-01-01 00:00:00 +0000
+++ lib/charms/apt.py 2016-07-14 17:53:24 +0000
@@ -0,0 +1,182 @@
1# Copyright 2015-2016 Canonical Ltd.
2#
3# This file is part of the Apt layer for Juju.
4#
5# This program is free software: you can redistribute it and/or modify
6# it under the terms of the GNU General Public License version 3, as
7# published by the Free Software Foundation.
8#
9# This program is distributed in the hope that it will be useful, but
10# WITHOUT ANY WARRANTY; without even the implied warranties of
11# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
12# PURPOSE. See the GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17'''
18charms.reactive helpers for dealing with deb packages.
19
20Add apt package sources using add_source(). Queue deb packages for
21installation with install(). Configure and work with your software
22once the apt.installed.{packagename} state is set.
23'''
24import itertools
25import subprocess
26
27from charmhelpers import fetch
28from charmhelpers.core import hookenv, unitdata
29from charms import reactive
30
31
32__all__ = ['add_source', 'update', 'queue_install', 'install_queued',
33 'installed', 'purge', 'ensure_package_status']
34
35
36def add_source(source, key=None):
37 '''Add an apt source.
38
39 Sets the apt.needs_update state.
40
41 A source may be either a line that can be added directly to
42 sources.list(5), or in the form ppa:<user>/<ppa-name> for adding
43 Personal Package Archives, or a distribution component to enable.
44
45 The package signing key should be an ASCII armoured GPG key. While
46 GPG key ids are also supported, the retrieval mechanism is insecure.
47 There is no need to specify the package signing key for PPAs or for
48 the main Ubuntu archives.
49 '''
50 # Maybe we should remember which sources have been added already
51 # so we don't waste time re-adding them. Is this time significant?
52 fetch.add_source(source, key)
53 reactive.set_state('apt.needs_update')
54
55
56def queue_install(packages, options=None):
57 """Queue one or more deb packages for install.
58
59 The `apt.installed.{name}` state is set once the package is installed.
60
61 If a package has already been installed it will not be reinstalled.
62
63 If a package has already been queued it will not be requeued, and
64 the install options will not be changed.
65
66 Sets the apt.queued_installs state.
67 """
68 if isinstance(packages, str):
69 packages = [packages]
70 # Filter installed packages.
71 store = unitdata.kv()
72 queued_packages = store.getrange('apt.install_queue.', strip=True)
73 packages = {package: options for package in packages
74 if not (package in queued_packages or
75 reactive.helpers.is_state('apt.installed.' + package))}
76 if packages:
77 unitdata.kv().update(packages, prefix='apt.install_queue.')
78 reactive.set_state('apt.queued_installs')
79
80
81def installed():
82 '''Return the set of deb packages completed install'''
83 return set(state.split('.', 2)[2] for state in reactive.bus.get_states()
84 if state.startswith('apt.installed.'))
85
86
87def purge(packages):
88 """Purge one or more deb packages from the system"""
89 fetch.apt_purge(packages, fatal=True)
90 store = unitdata.kv()
91 store.unsetrange(packages, prefix='apt.install_queue.')
92 for package in packages:
93 reactive.remove_state('apt.installed.{}'.format(package))
94
95
96def update():
97 """Update the apt cache.
98
99 Removes the apt.needs_update state.
100 """
101 status_set(None, 'Updating apt cache')
102 fetch.apt_update(fatal=True) # Friends don't let friends set fatal=False
103 reactive.remove_state('apt.needs_update')
104
105
106def install_queued():
107 '''Installs queued deb packages.
108
109 Removes the apt.queued_installs state and sets the apt.installed state.
110
111 On failure, sets the unit's workload state to 'blocked' and returns
112 False. Package installs remain queued.
113
114 On success, sets the apt.installed.{packagename} state for each
115 installed package and returns True.
116 '''
117 store = unitdata.kv()
118 queue = sorted((options, package)
119 for package, options in store.getrange('apt.install_queue.',
120 strip=True).items())
121
122 installed = set()
123 for options, batch in itertools.groupby(queue, lambda x: x[0]):
124 packages = [b[1] for b in batch]
125 try:
126 status_set(None, 'Installing {}'.format(','.join(packages)))
127 fetch.apt_install(packages, options, fatal=True)
128 store.unsetrange(packages, prefix='apt.install_queue.')
129 installed.update(packages)
130 except subprocess.CalledProcessError:
131 status_set('blocked',
132 'Unable to install packages {}'
133 .format(','.join(packages)))
134 return False # Without setting reactive state.
135
136 for package in installed:
137 reactive.set_state('apt.installed.{}'.format(package))
138
139 reactive.remove_state('apt.queued_installs')
140 return True
141
142
143def ensure_package_status():
144 '''Hold or unhold packages per the package_status configuration option.
145
146 All packages installed using this module and handlers are affected.
147
148 An mechanism may be added in the future to override this for a
149 subset of installed packages.
150 '''
151 packages = installed()
152 if not packages:
153 return
154 config = hookenv.config()
155 package_status = config['package_status']
156 changed = reactive.helpers.data_changed('apt.package_status',
157 (package_status, sorted(packages)))
158 if changed:
159 if package_status == 'hold':
160 hookenv.log('Holding packages {}'.format(','.join(packages)))
161 fetch.apt_hold(packages)
162 else:
163 hookenv.log('Unholding packages {}'.format(','.join(packages)))
164 fetch.apt_unhold(packages)
165 reactive.remove_state('apt.needs_hold')
166
167
168def status_set(state, message):
169 """Set the unit's workload status.
170
171 Set state == None to keep the same state and just change the message.
172 """
173 if state is None:
174 state = hookenv.status_get()[0]
175 if state == 'unknown':
176 state = 'maintenance' # Guess
177 if state in ('error', 'blocked'):
178 lvl = hookenv.WARNING
179 else:
180 lvl = hookenv.INFO
181 hookenv.status_set(state, message)
182 hookenv.log('{}: {}'.format(state, message), lvl)
0183
=== added directory 'lib/charms/layer'
=== added file 'lib/charms/layer/__init__.py'
--- lib/charms/layer/__init__.py 1970-01-01 00:00:00 +0000
+++ lib/charms/layer/__init__.py 2016-07-14 17:53:24 +0000
@@ -0,0 +1,21 @@
1import os
2
3
4class LayerOptions(dict):
5 def __init__(self, layer_file, section=None):
6 import yaml # defer, might not be available until bootstrap
7 with open(layer_file) as f:
8 layer = yaml.safe_load(f.read())
9 opts = layer.get('options', {})
10 if section and section in opts:
11 super(LayerOptions, self).__init__(opts.get(section))
12 else:
13 super(LayerOptions, self).__init__(opts)
14
15
16def options(section=None, layer_file=None):
17 if not layer_file:
18 base_dir = os.environ.get('CHARM_DIR', os.getcwd())
19 layer_file = os.path.join(base_dir, 'layer.yaml')
20
21 return LayerOptions(layer_file, section)
022
=== added file 'lib/charms/layer/basic.py'
--- lib/charms/layer/basic.py 1970-01-01 00:00:00 +0000
+++ lib/charms/layer/basic.py 2016-07-14 17:53:24 +0000
@@ -0,0 +1,159 @@
1import os
2import sys
3import shutil
4import platform
5from glob import glob
6from subprocess import check_call
7
8from charms.layer.execd import execd_preinstall
9
10
11def bootstrap_charm_deps():
12 """
13 Set up the base charm dependencies so that the reactive system can run.
14 """
15 # execd must happen first, before any attempt to install packages or
16 # access the network, because sites use this hook to do bespoke
17 # configuration and install secrets so the rest of this bootstrap
18 # and the charm itself can actually succeed. This call does nothing
19 # unless the operator has created and populated $CHARM_DIR/exec.d.
20 execd_preinstall()
21 # ensure that $CHARM_DIR/bin is on the path, for helper scripts
22 os.environ['PATH'] += ':%s' % os.path.join(os.environ['CHARM_DIR'], 'bin')
23 venv = os.path.abspath('../.venv')
24 vbin = os.path.join(venv, 'bin')
25 vpip = os.path.join(vbin, 'pip')
26 vpy = os.path.join(vbin, 'python')
27 if os.path.exists('wheelhouse/.bootstrapped'):
28 from charms import layer
29 cfg = layer.options('basic')
30 if cfg.get('use_venv') and '.venv' not in sys.executable:
31 # activate the venv
32 os.environ['PATH'] = ':'.join([vbin, os.environ['PATH']])
33 reload_interpreter(vpy)
34 return
35 # bootstrap wheelhouse
36 if os.path.exists('wheelhouse'):
37 with open('/root/.pydistutils.cfg', 'w') as fp:
38 # make sure that easy_install also only uses the wheelhouse
39 # (see https://github.com/pypa/pip/issues/410)
40 charm_dir = os.environ['CHARM_DIR']
41 fp.writelines([
42 "[easy_install]\n",
43 "allow_hosts = ''\n",
44 "find_links = file://{}/wheelhouse/\n".format(charm_dir),
45 ])
46 apt_install(['python3-pip', 'python3-setuptools', 'python3-yaml'])
47 from charms import layer
48 cfg = layer.options('basic')
49 # include packages defined in layer.yaml
50 apt_install(cfg.get('packages', []))
51 # if we're using a venv, set it up
52 if cfg.get('use_venv'):
53 if not os.path.exists(venv):
54 distname, version, series = platform.linux_distribution()
55 if series in ('precise', 'trusty'):
56 apt_install(['python-virtualenv'])
57 else:
58 apt_install(['virtualenv'])
59 cmd = ['virtualenv', '-ppython3', '--never-download', venv]
60 if cfg.get('include_system_packages'):
61 cmd.append('--system-site-packages')
62 check_call(cmd)
63 os.environ['PATH'] = ':'.join([vbin, os.environ['PATH']])
64 pip = vpip
65 else:
66 pip = 'pip3'
67 # save a copy of system pip to prevent `pip3 install -U pip`
68 # from changing it
69 if os.path.exists('/usr/bin/pip'):
70 shutil.copy2('/usr/bin/pip', '/usr/bin/pip.save')
71 # need newer pip, to fix spurious Double Requirement error:
72 # https://github.com/pypa/pip/issues/56
73 check_call([pip, 'install', '-U', '--no-index', '-f', 'wheelhouse',
74 'pip'])
75 # install the rest of the wheelhouse deps
76 check_call([pip, 'install', '-U', '--no-index', '-f', 'wheelhouse'] +
77 glob('wheelhouse/*'))
78 if not cfg.get('use_venv'):
79 # restore system pip to prevent `pip3 install -U pip`
80 # from changing it
81 if os.path.exists('/usr/bin/pip.save'):
82 shutil.copy2('/usr/bin/pip.save', '/usr/bin/pip')
83 os.remove('/usr/bin/pip.save')
84 os.remove('/root/.pydistutils.cfg')
85 # flag us as having already bootstrapped so we don't do it again
86 open('wheelhouse/.bootstrapped', 'w').close()
87 # Ensure that the newly bootstrapped libs are available.
88 # Note: this only seems to be an issue with namespace packages.
89 # Non-namespace-package libs (e.g., charmhelpers) are available
90 # without having to reload the interpreter. :/
91 reload_interpreter(vpy if cfg.get('use_venv') else sys.argv[0])
92
93
94def reload_interpreter(python):
95 """
96 Reload the python interpreter to ensure that all deps are available.
97
98 Newly installed modules in namespace packages sometimes seemt to
99 not be picked up by Python 3.
100 """
101 os.execle(python, python, sys.argv[0], os.environ)
102
103
104def apt_install(packages):
105 """
106 Install apt packages.
107
108 This ensures a consistent set of options that are often missed but
109 should really be set.
110 """
111 if isinstance(packages, (str, bytes)):
112 packages = [packages]
113
114 env = os.environ.copy()
115
116 if 'DEBIAN_FRONTEND' not in env:
117 env['DEBIAN_FRONTEND'] = 'noninteractive'
118
119 cmd = ['apt-get',
120 '--option=Dpkg::Options::=--force-confold',
121 '--assume-yes',
122 'install']
123 check_call(cmd + packages, env=env)
124
125
126def init_config_states():
127 import yaml
128 from charmhelpers.core import hookenv
129 from charms.reactive import set_state
130 from charms.reactive import toggle_state
131 config = hookenv.config()
132 config_defaults = {}
133 config_defs = {}
134 config_yaml = os.path.join(hookenv.charm_dir(), 'config.yaml')
135 if os.path.exists(config_yaml):
136 with open(config_yaml) as fp:
137 config_defs = yaml.load(fp).get('options', {})
138 config_defaults = {key: value.get('default')
139 for key, value in config_defs.items()}
140 for opt in config_defs.keys():
141 if config.changed(opt):
142 set_state('config.changed')
143 set_state('config.changed.{}'.format(opt))
144 toggle_state('config.set.{}'.format(opt), config.get(opt))
145 toggle_state('config.default.{}'.format(opt),
146 config.get(opt) == config_defaults[opt])
147 hookenv.atexit(clear_config_states)
148
149
150def clear_config_states():
151 from charmhelpers.core import hookenv, unitdata
152 from charms.reactive import remove_state
153 config = hookenv.config()
154 remove_state('config.changed')
155 for opt in config.keys():
156 remove_state('config.changed.{}'.format(opt))
157 remove_state('config.set.{}'.format(opt))
158 remove_state('config.default.{}'.format(opt))
159 unitdata.kv().flush()
0160
=== added file 'lib/charms/layer/execd.py'
--- lib/charms/layer/execd.py 1970-01-01 00:00:00 +0000
+++ lib/charms/layer/execd.py 2016-07-14 17:53:24 +0000
@@ -0,0 +1,138 @@
1# Copyright 2014-2016 Canonical Limited.
2#
3# This file is part of layer-basic, the reactive base layer for Juju.
4#
5# charm-helpers is free software: you can redistribute it and/or modify
6# it under the terms of the GNU Lesser General Public License version 3 as
7# published by the Free Software Foundation.
8#
9# charm-helpers is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU Lesser General Public License for more details.
13#
14# You should have received a copy of the GNU Lesser General Public License
15# along with charm-helpers. If not, see <http://www.gnu.org/licenses/>.
16
17# This module may only import from the Python standard library.
18import os
19import sys
20import subprocess
21import time
22
23'''
24execd/preinstall
25
26It is often necessary to configure and reconfigure machines
27after provisioning, but before attempting to run the charm.
28Common examples are specialized network configuration, enabling
29of custom hardware, non-standard disk partitioning and filesystems,
30adding secrets and keys required for using a secured network.
31
32The reactive framework's base layer invokes this mechanism as
33early as possible, before any network access is made or dependencies
34unpacked or non-standard modules imported (including the charms.reactive
35framework itself).
36
37Operators needing to use this functionality may branch a charm and
38create an exec.d directory in it. The exec.d directory in turn contains
39one or more subdirectories, each of which contains an executable called
40charm-pre-install and any other required resources. The charm-pre-install
41executables are run, and if successful, state saved so they will not be
42run again.
43
44 $CHARM_DIR/exec.d/mynamespace/charm-pre-install
45
46An alternative to branching a charm is to compose a new charm that contains
47the exec.d directory, using the original charm as a layer,
48
49A charm author could also abuse this mechanism to modify the charm
50environment in unusual ways, but for most purposes it is saner to use
51charmhelpers.core.hookenv.atstart().
52'''
53
54
55def default_execd_dir():
56 return os.path.join(os.environ['CHARM_DIR'], 'exec.d')
57
58
59def execd_module_paths(execd_dir=None):
60 """Generate a list of full paths to modules within execd_dir."""
61 if not execd_dir:
62 execd_dir = default_execd_dir()
63
64 if not os.path.exists(execd_dir):
65 return
66
67 for subpath in os.listdir(execd_dir):
68 module = os.path.join(execd_dir, subpath)
69 if os.path.isdir(module):
70 yield module
71
72
73def execd_submodule_paths(command, execd_dir=None):
74 """Generate a list of full paths to the specified command within exec_dir.
75 """
76 for module_path in execd_module_paths(execd_dir):
77 path = os.path.join(module_path, command)
78 if os.access(path, os.X_OK) and os.path.isfile(path):
79 yield path
80
81
82def execd_sentinel_path(submodule_path):
83 module_path = os.path.dirname(submodule_path)
84 execd_path = os.path.dirname(module_path)
85 module_name = os.path.basename(module_path)
86 submodule_name = os.path.basename(submodule_path)
87 return os.path.join(execd_path,
88 '.{}_{}.done'.format(module_name, submodule_name))
89
90
91def execd_run(command, execd_dir=None, stop_on_error=True, stderr=None):
92 """Run command for each module within execd_dir which defines it."""
93 if stderr is None:
94 stderr = sys.stdout
95 for submodule_path in execd_submodule_paths(command, execd_dir):
96 # Only run each execd once. We cannot simply run them in the
97 # install hook, as potentially storage hooks are run before that.
98 # We cannot rely on them being idempotent.
99 sentinel = execd_sentinel_path(submodule_path)
100 if os.path.exists(sentinel):
101 continue
102
103 try:
104 subprocess.check_call([submodule_path], stderr=stderr,
105 universal_newlines=True)
106 with open(sentinel, 'w') as f:
107 f.write('{} ran successfully {}\n'.format(submodule_path,
108 time.ctime()))
109 f.write('Removing this file will cause it to be run again\n')
110 except subprocess.CalledProcessError as e:
111 # Logs get the details. We can't use juju-log, as the
112 # output may be substantial and exceed command line
113 # length limits.
114 print("ERROR ({}) running {}".format(e.returncode, e.cmd),
115 file=stderr)
116 print("STDOUT<<EOM", file=stderr)
117 print(e.output, file=stderr)
118 print("EOM", file=stderr)
119
120 # Unit workload status gets a shorter fail message.
121 short_path = os.path.relpath(submodule_path)
122 block_msg = "Error ({}) running {}".format(e.returncode,
123 short_path)
124 try:
125 subprocess.check_call(['status-set', 'blocked', block_msg],
126 universal_newlines=True)
127 if stop_on_error:
128 sys.exit(0) # Leave unit in blocked state.
129 except Exception:
130 pass # We care about the exec.d/* failure, not status-set.
131
132 if stop_on_error:
133 sys.exit(e.returncode or 1) # Error state for pre-1.24 Juju
134
135
136def execd_preinstall(execd_dir=None):
137 """Run charm-pre-install for each module within execd_dir."""
138 execd_run('charm-pre-install', execd_dir=execd_dir)
0139
=== added file 'lib/charms/leadership.py'
--- lib/charms/leadership.py 1970-01-01 00:00:00 +0000
+++ lib/charms/leadership.py 2016-07-14 17:53:24 +0000
@@ -0,0 +1,58 @@
1# Copyright 2015-2016 Canonical Ltd.
2#
3# This file is part of the Leadership Layer for Juju.
4#
5# This program is free software: you can redistribute it and/or modify
6# it under the terms of the GNU General Public License version 3, as
7# published by the Free Software Foundation.
8#
9# This program is distributed in the hope that it will be useful, but
10# WITHOUT ANY WARRANTY; without even the implied warranties of
11# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
12# PURPOSE. See the GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17from charmhelpers.core import hookenv
18from charmhelpers.core import unitdata
19
20from charms import reactive
21from charms.reactive import not_unless
22
23
24__all__ = ['leader_get', 'leader_set']
25
26
27@not_unless('leadership.is_leader')
28def leader_set(settings=None, **kw):
29 '''Change leadership settings, per charmhelpers.core.hookenv.leader_set.
30
31 The leadership.set.{key} reactive state will be set while the
32 leadership hook environment setting remains set.
33
34 Changed leadership settings will set the leadership.changed.{key}
35 and leadership.changed states. These states will remain set until
36 the following hook.
37
38 These state changes take effect immediately on the leader, and
39 in future hooks run on non-leaders. In this way both leaders and
40 non-leaders can share handlers, waiting on these states.
41 '''
42 settings = settings or {}
43 settings.update(kw)
44 previous = unitdata.kv().getrange('leadership.settings.', strip=True)
45
46 for key, value in settings.items():
47 if value != previous.get(key):
48 reactive.set_state('leadership.changed.{}'.format(key))
49 reactive.set_state('leadership.changed')
50 reactive.helpers.toggle_state('leadership.set.{}'.format(key),
51 value is not None)
52 hookenv.leader_set(settings)
53 unitdata.kv().update(settings, prefix='leadership.settings.')
54
55
56def leader_get(attribute=None):
57 '''Return leadership settings, per charmhelpers.core.hookenv.leader_get.'''
58 return hookenv.leader_get(attribute)
059
=== modified file 'metadata.yaml'
--- metadata.yaml 2015-12-07 02:57:11 +0000
+++ metadata.yaml 2016-07-14 17:53:24 +0000
@@ -1,14 +1,21 @@
1name: ibm-db21"name": "ibm-db2"
2summary: IBM DB22"summary": "IBM DB2 Product"
3maintainer: IBM Juju Support Team <jujusupp@us.ibm.com>3"maintainer": "IBM Juju Support Team <jujusupp@us.ibm.com>"
4description: |4"description": |
5 IBM DB2 Enterprise Server Edition provides scalable database server software to handle the demanding workloads of large and midsize enterprise servers. 5 IBM DB2 Enterprise Server Edition provides scalable database server software to handle the demanding workloads of large and midsize enterprise servers.
6tags:6"tags":
7 - misc7- "ibm"
8 - database8- "apt"
9 - ibm 9- "leadership"
10subordinate: false10- "ibm"
11provides:11- "db2"
12 db:12- "database"
13 interface: db213- "misc"
1414"provides":
15 "db":
16 "interface": "db2"
17"min-juju-version": "2.0-beta1"
18"series":
19- "trusty"
20- "xenial"
21"subordinate": !!bool "false"
1522
=== added directory 'reactive'
=== added file 'reactive/__init__.py'
=== added file 'reactive/apt.py'
--- reactive/apt.py 1970-01-01 00:00:00 +0000
+++ reactive/apt.py 2016-07-14 17:53:24 +0000
@@ -0,0 +1,112 @@
1# Copyright 2015-2016 Canonical Ltd.
2#
3# This file is part of the Apt layer for Juju.
4#
5# This program is free software: you can redistribute it and/or modify
6# it under the terms of the GNU General Public License version 3, as
7# published by the Free Software Foundation.
8#
9# This program is distributed in the hope that it will be useful, but
10# WITHOUT ANY WARRANTY; without even the implied warranties of
11# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
12# PURPOSE. See the GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17'''
18charms.reactive helpers for dealing with deb packages.
19
20Add apt package sources using add_source(). Queue deb packages for
21installation with install(). Configure and work with your software
22once the apt.installed.{packagename} state is set.
23'''
24from charmhelpers import fetch
25from charmhelpers.core import hookenv
26from charms import layer
27from charms import reactive
28from charms.reactive import when, when_not
29
30import charms.apt
31# Aliases for backwards compatibility
32from charms.apt import add_source, queue_install, installed, purge
33
34
35__all__ = ['add_source', 'update', 'queue_install', 'install_queued',
36 'installed', 'purge', 'ensure_package_status']
37
38
39@when('apt.needs_update')
40def update():
41 charms.apt.update()
42
43
44@when('apt.queued_installs')
45@when_not('apt.needs_update')
46def install_queued():
47 charms.apt.install_queued()
48
49
50@when_not('apt.queued_installs')
51def ensure_package_status():
52 charms.apt.ensure_package_status()
53
54
55def configure_sources():
56 """Add user specified package sources from the service configuration.
57
58 See charmhelpers.fetch.configure_sources for details.
59 """
60 hookenv.log('Initializing Apt Layer')
61 config = hookenv.config()
62
63 # We don't have enums, so we need to validate this ourselves.
64 package_status = config.get('package_status')
65 if package_status not in ('hold', 'install'):
66 charms.apt.status_set('blocked',
67 'Unknown package_status {}'
68 ''.format(package_status))
69 # Die before further hooks are run. This isn't very nice, but
70 # there is no other way to inform the operator that they have
71 # invalid configuration.
72 raise SystemExit(0)
73
74 sources = config.get('install_sources')
75 keys = config.get('install_keys')
76 if reactive.helpers.data_changed('apt.configure_sources', (sources, keys)):
77 fetch.configure_sources(update=False,
78 sources_var='install_sources',
79 keys_var='install_keys')
80 reactive.set_state('apt.needs_update')
81
82 extra_packages = sorted(config.get('extra_packages', '').split())
83 if extra_packages:
84 queue_install(extra_packages)
85
86
87def queue_layer_packages():
88 """Add packages listed in build-time layer options."""
89 # Both basic and apt layer. basic layer will have already installed
90 # its defined packages, but rescheduling it here gets the apt layer
91 # state set and they will pinned as any other apt layer installed
92 # package.
93 opts = layer.options()
94 for section in ['basic', 'apt']:
95 if section in opts and 'packages' in opts[section]:
96 queue_install(opts[section]['packages'])
97
98
99# Per https://github.com/juju-solutions/charms.reactive/issues/33,
100# this module may be imported multiple times so ensure the
101# initialization hook is only registered once. I have to piggy back
102# onto the namespace of a module imported before reactive discovery
103# to do this.
104if not hasattr(reactive, '_apt_registered'):
105 # We need to register this to run every hook, not just during install
106 # and config-changed, to protect against race conditions. If we don't
107 # do this, then the config in the hook environment may show updates
108 # to running hooks well before the config-changed hook has been invoked
109 # and the intialization provided an opertunity to be run.
110 hookenv.atstart(configure_sources)
111 hookenv.atstart(queue_layer_packages)
112 reactive._apt_registered = True
0113
=== added file 'reactive/ibm-base.sh'
--- reactive/ibm-base.sh 1970-01-01 00:00:00 +0000
+++ reactive/ibm-base.sh 2016-07-14 17:53:24 +0000
@@ -0,0 +1,107 @@
1#!/bin/bash
2source charms.reactive.sh
3set -e
4
5
6# Utility function to verify a downloaded resource
7# :param: file name
8# :param: checksum type
9# :param: checksum value
10function verify_curl_resource() {
11 local FILE=$1
12 local TYPE=$2
13 local EXPECTED_SUM=$3
14 local CALCULATED_SUM=""
15 local PROG=""
16
17 if [ ! -r ${FILE} ]; then
18 status-set blocked "ibm-base: could not read ${FILE}"
19 juju-log "Could not verify the downloaded resource. File could not be read: ${FILE}"
20 fi
21
22 # Set our checksum utility based on the requested type
23 case "${TYPE}" in
24 md5)
25 PROG='md5sum'
26 ;;
27 sha256)
28 PROG='sha256sum'
29 ;;
30 sha512)
31 PROG='sha512sum'
32 ;;
33 *)
34 status-set blocked "ibm-base: checksum type must be md5, sha215, or sha512"
35 juju-log "Could not verify the downloaded resource ${FILE}. Unknown checksum type: ${TYPE}"
36 return 1
37 esac
38
39 CALCULATED_SUM=`${PROG} ${FILE} | awk '{print $1}'`
40 if [ "${CALCULATED_SUM}" = "${EXPECTED_SUM}" ]; then
41 juju-log "Checksum verified for ${FILE}."
42 return 0
43 else
44 status-set blocked "ibm-base: checksums did not match"
45 juju-log "Checksum mismatch for ${FILE}. Expected ${EXPECTED_SUM}, got ${CALCULATED_SUM}"
46 return 1
47 fi
48}
49
50
51# Fetch curl resources if a URL is configured
52@when 'config.set.curl_url'
53@when_any 'config.new.curl_url' 'config.changed.curl_url' 'config.new.curl_opts' 'config.changed.curl_opts'
54function fetch_curl_resource() {
55 local ARCHIVE_DIR="${CHARM_DIR}/files/archives"
56 local CURL_URL=$(config-get 'curl_url')
57 local CURL_OPTS=$(config-get 'curl_opts')
58
59 status-set maintenance "ibm-base: fetching resource(s)"
60
61 mkdir -p ${ARCHIVE_DIR}
62 cd ${ARCHIVE_DIR}
63 # Multiple URLs may be separated by a space, so loop.
64 for URL_STRING in ${CURL_URL}
65 do
66 # For each URL_STRING, set the url, checksum type, and checksum value.
67 local URL=${URL_STRING%%\?*} # string before the first '?'
68 local FILE_NAME=${URL##*\/} # string after the last '/'
69 local SUM_STRING=${URL_STRING#*\?} # string after the first '?'
70 local SUM_TYPE=${SUM_STRING%%\=*} # string before the first '='
71 local SUM_VALUE=${SUM_STRING#*\=} # string after the first '='
72
73 if [ -z ${FILE_NAME} ]; then
74 FILE_NAME="juju-${RANDOM}"
75 fi
76 curl --silent --show-error ${CURL_OPTS} -o ${FILE_NAME} ${URL}
77
78 # Verify our resource checksum. If this fails, let verify_resource log
79 # the reason and exit successfully. Exiting non-zero would fail the hook,
80 # so return 0 and simply inform the user that verification failed.
81 verify_curl_resource ${FILE_NAME} ${SUM_TYPE} ${SUM_VALUE} || return 0
82 done
83 cd -
84
85 set_state 'ibm-base.curl.resource.fetched'
86 status-set active "ibm-base: curl resource(s) fetched"
87 juju-log 'Curl resource fetched'
88}
89
90
91# Handle license acceptance
92@when 'config.changed.license_accepted'
93function check_license_acceptance() {
94 local LIC_ACCEPTED=$(config-get 'license_accepted')
95
96 # compare lowercase LIC_ACCEPTED (requires bash > 4)
97 if [ "${LIC_ACCEPTED,,}" = "true" ]; then
98 set_state 'ibm-base.license.accepted'
99 juju-log 'License accepted'
100 else
101 remove_state 'ibm-base.license.accepted'
102 juju-log 'License NOT accepted'
103 fi
104}
105
106# Main reactive entry point
107reactive_handler_main
0108
=== added file 'reactive/ibm-db2.sh'
--- reactive/ibm-db2.sh 1970-01-01 00:00:00 +0000
+++ reactive/ibm-db2.sh 2016-07-14 17:53:24 +0000
@@ -0,0 +1,799 @@
1#!/bin/bash
2set -e
3
4source charms.reactive.sh
5
6ARCHITECTURE=`uname -m`
7ARCHIVE_DIR=$CHARM_DIR/files/archives
8DB2_ARCHIVE_DIR=`pwd`
9DB2_USER=db2inst1
10DB2_USER_PW=`pwgen -N 1 15`
11DB2_DAS_USER=dasusr1
12DB2_DAS_USER_PW=`pwgen -N 1 15`
13DB2_FENCE_USER=db2fenc1
14DB2_FENCE_USER_PW=`pwgen -N 1 15`
15DB2_INSTALL_PATH=/opt/ibm/db2/V10.5
16AUTH_KEY_FILE=/root/.ssh/authorized_keys
17TEMP_KEY_FILE=key.txt
18
19cfgusername=""
20
21remoteunit=$cfgusername
22cfgpasswd=""
23dbs_created=""
24
25isdbcreated=0
26#Get the cfguser name based on the remote unit name
27get_cfgusername()
28{
29 usr="usr"
30 passwd=`pwgen -N 1 15`
31 db="db"
32 cfgusername=$1
33 cfgusername=`echo $cfgusername | cut -d"/" -f1`
34 cfgusername=`echo "$cfgusername" | sed -r 's/-//g' | sed -r 's/ibm//g'`
35 cfgusername=`echo "$cfgusername" | awk '{print substr($0,0,5)}'`
36 remoteunit=$cfgusername
37 cfgusername="$cfgusername$usr"
38 cfgpasswd="$cfgusername$passwd"
39 remoteunitdbname="$remoteunit$db"
40
41}
42# Check whether DB2 is installed
43is_db2_installed()
44{
45 if [ -d $DB2_INSTALL_PATH/bin ]; then
46 echo "True"
47 else
48 echo "False"
49 fi
50}
51
52
53# Remove DB2, if installed
54remove_software()
55{
56 db2_inst=`is_db2_installed`
57 if [ $db2_inst == "True" ]; then
58 juju-log "IBM DB2: Removing IBM DB2 software."
59 status-set maintenance "Removing IBM DB2"
60
61 #finding the DB alias names to be dropped and dropping all Databases in that
62 for queue1 in `su - $DB2_USER -c 'db2ilist'`;
63 do
64 juju-log "IBM DB2: Dropping the Databases for the instance $queue1"
65 #if db2 is not running, we need to start it first, otherwise db2 drop command will fail
66 if su - $queue1 -c 'ps -eaf|grep -i "\bdb2sysc 0\b" |grep -i '$queue1;
67 then
68 juju-log "IBM DB2: DB2 already started for the user $queue1"
69 else
70 su - $queue1 -c 'db2start'
71 juju-log "IBM DB2: DB2 is started"
72 fi
73
74 for queue in `su - $queue1 -c 'db2 list db directory | grep "Database alias" | cut -d"=" -f2'`;
75 do
76 queue=`echo $queue | xargs`
77 juju-log "IBM DB2: Dropping the DB $queue"
78 su - $queue1 -c 'db2 drop database '$queue
79 if [ $? -eq 0 ]; then
80 juju-log "IBM DB2: Dropped the DB $queue"
81 else
82 juju-log "IBM DB2: Dropping the DB $queue failed"
83 status-set blocked "Dropping the DB failed"
84 exit 0
85 fi
86 done
87 juju-log "IBM DB2: Stopping the DB for $queue1"
88
89 if su - $queue1 -c 'ps -eaf|grep -i "\bdb2sysc 0\b" |grep -i '$queue1
90 then
91 su - $queue1 -c 'db2 force application all'
92 su - $queue1 -c 'db2stop'
93 if [ $? -eq 0 ]; then
94 juju-log "IBM DB2: Stopped the DB for the instance $queue1"
95 else
96 juju-log "IBM DB2: Stopping the DB for $queue1 failed"
97 status-set blocked "Stopping the DB for $queue1 failed"
98 exit 0
99 fi
100
101 else
102 juju-log "IBM DB2: DB2 is already stopped"
103 fi
104 done
105
106 #drop the das
107 cd $DB2_INSTALL_PATH/instance
108 juju-log "IBM DB2: Dropping the DAS"
109 ./dasdrop
110 if [ $? -eq 0 ]; then
111 juju-log "IBM DB2: Dropped the DAS"
112 else
113 juju-log "IBM DB2: Dropping the DAS failed"
114 status-set blocked "Dropping the DAS failed"
115 exit 0
116 fi
117
118 #delete the instances
119 su - $DB2_USER -c 'db2ilist'
120 for queue1 in `su - $DB2_USER -c 'db2ilist'`;
121 do
122 juju-log "IBM DB2: Deleting the instance $queue1"
123 $DB2_INSTALL_PATH/instance/db2idrop $queue1
124 if [ $? -eq 0 ]; then
125 juju-log "IBM DB2: Deleted the instance $queue1"
126 else
127 juju-log "IBM DB2: Deleting the instance $queue1 failed"
128 status-set blocked "Deleting the instance $queue1 failed"
129 exit 0
130 fi
131
132 done
133
134 #Delete the instance entries from /etc/services file
135 juju-log "IBM DB2: Deleting the entries from /etc/services"
136 sed -i '/db2c_/d' /etc/services
137 if [ $? -eq 0 ]; then
138 juju-log "IBM DB2: Deleted the entries from /etc/services"
139 else
140 juju-log "IBM DB2: Deletion of the entries from /etc/services failed"
141 status-set blocked "Deletion of the entries from /etc/services failed"
142 exit 0
143 fi
144
145 #uninstall
146 juju-log "IBM DB2: Uninstall "
147 cd $DB2_INSTALL_PATH/install
148 set +e
149 ./db2_deinstall -a
150 if [ $? -eq 0 ]; then
151 juju-log "IBM DB2: Uninstall of db2 successful"
152 else
153 juju-log "IBM DB2: Uninstall of db2 failed"
154 status-set blocked "IBM DB2 Uninstallation failed"
155 exit 0
156 fi
157 set -e
158 cd /opt/ibm
159 rm -rf db2
160 juju-log "IBM DB2: Finished Uninstalling......."
161 status-set blocked "IBM DB2 Uninstalled"
162
163 else
164 juju-log "IBM DB2: DB2 not installed"
165 fi
166
167}
168
169# Update system configuration after installing DB2
170configure_system()
171{
172 juju-log "IBM DB2: Updating system configuration."
173 cd $DB2_INSTALL_PATH/instance
174 su - $DB2_USER -c 'db2set DB2COMM=tcpip'
175
176 #Start DB for the DB2_user
177 if su - $DB2_USER -c 'ps -eaf|grep -i "\bdb2sysc 0\b" |grep -i '$DB2_USER;
178 then
179 juju-log "IBM DB2: DB2 already started for the user $DB2_USER"
180 else
181 su - $DB2_USER -c 'db2start'
182 juju-log "IBM DB2: DB2 is started"
183 fi
184
185 service_name=`su - $DB2_USER -c 'db2 get dbm cfg|grep -i svce|cut -d"=" -f2'`
186 port_num=`grep $service_name /etc/services | cut -d"/" -f1 | cut -f2`
187 port_num=`echo $port_num | xargs`
188 if su - $DB2_USER -c 'netstat -an | grep '$port_num;
189 then
190 juju-log "IBM DB2: DB2 started on port $port_num"
191 else
192 juju-log "IBM DB2: DB2 not started on port $port_num"
193 exit 1
194 fi
195
196 juju-log "IBM DB2: Updated system configuration."
197
198}
199
200#Configure dftdbpath
201configure_dftdbpath()
202{
203 db2_inst=`is_db2_installed`
204 if [ $db2_inst == "True" ]; then
205 cfgdbpath=`config-get dftdbpath`
206 #If null, assign the default value
207 if [ "cfgdbpath" == "" ]
208 then
209 cfgdbpath="/tmp"
210 fi
211
212 for queue1 in `su - $DB2_USER -c 'db2ilist'`;
213 do
214 #if db2 is not running don't do anything
215 if su - $queue1 -c 'ps -eaf|grep -i "\bdb2sysc 0\b" |grep -i '$queue1;
216 then
217 su - $queue1 -c 'db2 attach to '$queue1
218 dbpath=`su - $queue1 -c 'db2 get dbm cfg|grep -i DFTDBPATH|cut -d"=" -f2'`
219 cfgdbpath=`echo $cfgdbpath | xargs`
220 dbpath=`echo $dbpath | xargs`
221 if [ "$cfgdbpath" != "$dbpath" ]; then
222 if [ -d "$cfgdbpath" ]; then
223 su - $queue1 -c 'db2 update dbm cfg using DFTDBPATH '$cfgdbpath
224 if [ $? -eq 0 ]; then
225 juju-log "IBM DB2: DFTDBPATH changed to $cfgdbpath"
226 else
227 juju-log "IBM DB2: Unable to set DFTDBPATH to $cfgdbpath"
228 exit 0
229 fi
230 else
231 juju-log "IBM DB2: Not a valid path. Please check the path and run the command again"
232 exit 0
233 fi
234 fi
235 fi
236 done
237 else
238 juju-log "IBM DB2: DB2 is not installed. Install DB2 to change the dbpath"
239 exit 0
240 fi
241}
242
243# Edit the response file for UID
244edit_responsefile()
245{
246 rsp_file=db2server_temp.rsp
247 if [ "$ARCHITECTURE" = "x86_64" ]; then
248 orgrsp_file=db2server.rsp
249 else
250 orgrsp_file=db2server_ppcle.rsp
251 fi
252 cp $CHARM_DIR/files/archives/$orgrsp_file $CHARM_DIR/files/archives/$rsp_file
253
254 db2uid=`id $DB2_USER | cut -d"=" -f2 | cut -d"(" -f1`
255 sed -i s/db2inst1_uid/$db2uid/g $CHARM_DIR/files/archives/$rsp_file
256 sed -i s/db2inst1_gid/$db2uid/g $CHARM_DIR/files/archives/$rsp_file
257 sed -i s/db2inst1_homedir/$DB2_USER/g $CHARM_DIR/files/archives/$rsp_file
258 sed -i s/db2inst1_password/$DB2_USER_PW/g $CHARM_DIR/files/archives/$rsp_file
259
260 db2fenid=`id $DB2_FENCE_USER | cut -d"=" -f2 | cut -d"(" -f1`
261 sed -i s/db2fenc1_uid/$db2fenid/g $CHARM_DIR/files/archives/$rsp_file
262 sed -i s/db2fenc1_gid/$db2fenid/g $CHARM_DIR/files/archives/$rsp_file
263
264 dasuid=`id $DB2_DAS_USER | cut -d"=" -f2 | cut -d"(" -f1`
265 sed -i s/das_uid/$dasuid/g $CHARM_DIR/files/archives/$rsp_file
266 sed -i s/das_gid/$dasuid/g $CHARM_DIR/files/archives/$rsp_file
267
268}
269
270create_user()
271{
272 servicename=$1
273 user_exists=0
274 instance_exists=0
275 db2_inst=`is_db2_installed`
276 get_cfgusername $servicename
277 if [ $db2_inst == "True" ]; then
278 status-set maintenance "Creating DB user and instance"
279 #Find the group id for db2inst1 user which is used to install db2 and find all
280 #users belonging to this user
281 db2inst1grpid=`id $DB2_USER | cut -d" " -f2`
282
283 #If the user is already available, just log the information.
284 for queue2 in `awk -F':' '{ print $1}' /etc/passwd`;
285 do
286 gid=`id $queue2 | cut -d" " -f2`
287 if [ $gid == $db2inst1grpid ]; then
288 if [ $queue2 != "$DB2_USER" ]; then
289 if [ $cfgusername == $queue2 ]; then
290 juju-log "IBM DB2: User $cfgusername already exists"
291 user_exists=1
292 fi
293 fi
294 fi
295 done
296
297 #If not available, add a new user
298 if [ $user_exists -ne 1 ]; then
299 juju-log "IBM DB2: Creating New user"
300 create_newuser $servicename
301 juju-log "IBM DB2: Created New user"
302 juju-log $cfgusername
303 fi
304
305 #Creating a new instance for the new user if not existing
306 for queue1 in `su - $DB2_USER -c 'db2ilist'`;
307 do
308 if [ $queue1 == $cfgusername ]; then
309 juju-log "IBM DB2: Instance $cfgusername already exists"
310 instance_exists=1
311 fi
312 done
313 if [ $instance_exists -ne 1 ]; then
314 juju-log "IBM DB2: Creating new instance for the user"
315 $DB2_INSTALL_PATH/instance/db2icrt -u $cfgusername $cfgusername
316 if [ $? = 0 ]; then
317 juju-log "IBM DB2: Created new instance for the user"
318 else
319 juju-log "IBM DB2: Creation of new instance failed"
320 exit 0
321 fi
322 fi
323
324 #Do the configuration for the new instance created
325 new_port=50001
326 free_port=0
327 is_free=0
328 #Check whether the port number is already in etc/services file, and then add it
329 cd /etc
330 if grep -q "db2c_$cfgusername" services
331 then
332 juju-log "IBM DB2: Services file already updated"
333 else
334 while [ $free_port -eq 0 ]
335 do
336 is_free=`netstat -lnp | grep $new_port | cut -d":" -f2 | cut -d" " -f1`
337 if [ "$is_free" != "$new_port" ]; then
338 free_port=1
339 else
340 new_port=$((new_port+1))
341 fi
342 done
343 juju-log "IBM DB2:Updating Services file"
344 echo -e "db2c_$cfgusername $new_port/tcp" >> /etc/services
345 su - $cfgusername -c 'set db2instance=$cfgusername'
346 su - $cfgusername -c 'db2set DB2COMM=tcpip'
347 new_port=`echo $new_port | xargs`
348 #port_num_consumer=$new_port
349 su - $cfgusername -c 'db2 update dbm cfg using svcename '$new_port
350 $DB2_INSTALL_PATH/instance/db2iupdt $cfgusername
351 fi
352 cd -
353
354 #Start DB for the new user
355 if su - $cfgusername -c 'ps -eaf|grep -i "\bdb2sysc 0\b" |grep -i '$cfgusername;
356 then
357 juju-log "IBM DB2: DB2 already started for the user $cfgusername"
358 else
359 su - $cfgusername -c 'db2start'
360 juju-log "IBM DB2: DB2 is started"
361 fi
362 #set_state 'db.dbstarted'
363
364 else
365 juju-log "IBM DB2: DB2 is not installed. Install DB2 before creating users"
366 exit 0
367
368 fi
369 status-set active "Completed DB user and instance creation"
370}
371
372create_newuser()
373{
374 servicename=$1
375 dbcreated="False"
376 #Add the new user
377 get_cfgusername $servicename
378 useradd -g db2grp1 -G dasadm1 -m $cfgusername
379 if [ $? -ne 0 ]; then
380 juju-log "IBM DB2: Addition of user $queue2 failed."
381 status-set blocked "Addition of new used failed, Try again"
382 exit 0
383 fi
384 #Set the password for the new user
385 echo $cfgusername:$cfgpasswd | chpasswd
386 if [ $? -ne 0 ]; then
387 juju-log "IBM DB2: Setting password for user $queue2 failed."
388 status-set blocked "Setting the password for user failed, Try again"
389 exit 0
390 fi
391 #Check whether test DB already exists. If not create it
392
393 dbname=`su - $DB2_USER -c 'db2 list db directory' | grep "Database name" | grep -i "\bTEST\b" | cut -d"=" -f2`
394 dbname=`echo $dbname | xargs`
395 if [ "$dbname" != "TEST" ]; then
396 juju-log "IBM DB2: Creating DB Test"
397 su - $DB2_USER -c 'db2 create database test'
398 if [ $? -ne 0 ]; then
399 juju-log "IBM DB2: DB creation failed"
400 status-set blocked "DB creation failed, Try again"
401 exit 0
402 fi
403 juju-log "IBM DB2: Created DB Test"
404 fi
405 #Connect to the DB and grant data access
406 su - $DB2_USER -c 'db2 connect to test;db2 grant dataaccess on database to user '$cfgusername
407 if [ $? -ne 0 ]; then
408 juju-log "IBM DB2: Grant access failed"
409 status-set blocked "Grant dataaccess on database failed, Try again"
410 exit 0
411 fi
412 su - $DB2_USER -c 'db2 connect to test;db2 disconnect test'
413 if [ $? -ne 0 ]; then
414 juju-log "IBM DB2: Disconnect DB failed"
415 status-set blocked "Disconnect DB failed"
416 exit 0
417 fi
418
419}
420
421create_database()
422{
423 isdbcreated=0
424 dbtocreate=$1
425 servicename=$2
426 get_cfgusername $servicename
427 #create the db for $dbnametocreate if it doesn't exist
428 dbname=`su - $cfgusername -c 'db2 list db directory' | grep "Database name" | grep -i "\b$dbtocreate\b" | cut -d"=" -f2`
429 dbname=`echo $dbname | xargs`
430 dbname=`echo "$dbname" | awk '{ print tolower($1) }'`
431 dbtocreate=`echo "$dbtocreate" | awk '{ print tolower($1) }'`
432 #check whether dbname is more than 8 chars
433 if [ ${#dbtocreate} -gt 8 ]; then
434 juju-log "IBM DB2: Failed to create DB $dbtocreate. DB name should be <= 8 chars"
435 #status-set blocked "DB creation for $dbtocreate failed as it contains more than 8 chars"
436 else
437 if [ "$dbname" != "$dbtocreate" ]; then
438 juju-log "IBM DB2: Creating DB $dbtocreate"
439 su - $cfgusername -c 'db2 create database '$dbtocreate
440 if [ $? -ne 0 ]; then
441 juju-log "IBM DB2: DB creation failed"
442 status-set blocked "DB creation failed, Try again"
443 exit 0
444 fi
445 juju-log "IBM DB2: Created DB $dbtocreate"
446 isdbcreated=1
447 else
448 juju-log "IBM DB2: DB $dbtocreate already exists"
449 fi
450 fi
451}
452
453# Must be called from a 'db.ready' state handler
454create_dbs()
455{
456dbs_created=""
457servicename=$1
458dbnames=$(relation_call --state=db.ready get_dbnames $servicename) || true
459
460#If dbnames is null, create a default DB as per service name. Else create the DBs requested by the related charm
461if [ -z "$dbnames" -o "$dbnames" == "None" ] ; then
462 juju-log "IBM DB2: Creating a default DB $remoteunitdbname based on remote service name"
463 create_database $remoteunitdbname $servicename
464 if [ $isdbcreated -eq 1 ] ; then
465 dbs_created+=$remoteunitdbname
466 dbs_created+="."
467 fi
468else
469 juju-log "IBM DB2: Creating the DB names as passed by consumer"
470 if [ `echo $dbnames | grep -c "," ` -gt 0 ]
471 then
472 #parse the $dbnames string to get the names of dbs to be created
473 count=1
474 db_to_create="test"
475 while [ "$db_to_create" != "" ]
476 do
477 db_to_create=`echo $dbnames | cut -d"," -f$count`
478 juju-log "IBM DB2:db_to_create is $db_to_create"
479 if [ "$db_to_create" != "" ] ; then
480 create_database $db_to_create $servicename
481 juju-log "Created DB $db_to_create"
482 if [ $isdbcreated -eq 1 ] ; then
483 dbs_created+=$db_to_create
484 dbs_created+="."
485 fi
486 fi
487 ((count=count+1))
488 done
489 else
490 create_database $dbnames $servicename
491 juju-log "Created DB $dbnames"
492 dbs_created+=$dbnames
493 dbs_created+="."
494 fi
495fi
496}
497
498remove_sshkeys()
499{
500 servicename=$1
501 #Read the key from the key.txt file and see whether it exists
502 if grep -q "$servicename" $TEMP_KEY_FILE
503 then
504 key=`cat $TEMP_KEY_FILE | grep $servicename | cut -d":" -f2`
505 grep -v "$key" $AUTH_KEY_FILE > tempfile.txt || touch tempfile.txt
506 mv tempfile.txt $AUTH_KEY_FILE
507 if grep -q "$key" $AUTH_KEY_FILE
508 then
509 juju-log "IBM DB2: SSH Key not deleted from $AUTH_KEY_FILE"
510 else
511 juju-log "IBM DB2: SSH Key deleted from $AUTH_KEY_FILE"
512 fi
513 #Remove from the temporary file as well
514 grep -v "$servicename:$key" $TEMP_KEY_FILE > tempfile1.txt
515 mv tempfile1.txt $TEMP_KEY_FILE
516 if grep -q "$key" $TEMP_KEY_FILE
517 then
518 juju-log "IBM DB2: SSH Key not deleted from $TEMP_KEY_FILE"
519 else
520 juju-log "IBM DB2: SSH Key deleted from $TEMP_KEY_FILE"
521 fi
522
523fi
524
525}
526
527
528@when_not 'config.set.license_accepted'
529function report_missing_license(){
530 juju-log "IBM DB2: license_accepted is not set."
531 status-set blocked "license_accepted must be set"
532}
533
534
535@when_not 'config.set.curl_url'
536function report_missing_curl(){
537 juju-log "IBM DB2: curl config options are not set."
538 status-set blocked "curl options must be set"
539}
540
541
542@when 'ibm-db2.installed'
543@when_not 'ibm-base.license.accepted'
544function uninstall(){
545 juju-log "IBM DB2: Removing IBM DB2 (if installed) as the license agreement is not accepted."
546 status-set maintenance "IBM DB2 is getting uninstalled"
547 remove_software
548 remove_state 'ibm-db2.installed'
549 status-set maintenance "IBM DB2 is uninstalled"
550 rm -rf $TEMP_KEY_FILE
551
552}
553
554#Setting the interface states after uninstall
555@when 'db.connected'
556@when_not 'ibm-db2.installed'
557function reset_interface_states(){
558 services=$(relation_call --state=db.connected services) || true
559 for service in $services; do
560 juju-log "IBM DB2: Resetting states for the service $service"
561 relation_call --state=db.connected dismiss_sshconfigured $service || true
562 relation_call --state=db.connected reset_states $service || true
563 done
564
565}
566
567
568@when_not 'ibm-db2.prereqsinstalled'
569function init() {
570 if [ "$ARCHITECTURE" != "x86_64" -a "$ARCHITECTURE" != "ppc64le" ]; then
571 juju-log "IBM DB2: Unsupported platform. IBM DB2 installed with this Charm supports only the x86_64 and POWER LE (ppc64le) platforms."
572 exit 1
573 fi
574 set -e
575 juju-log "IBM DB2: Begin Install."
576 status-set maintenance "Installing pre requisites for IBM DB2"
577 apt-get update
578
579 if [ "$ARCHITECTURE" == "x86_64" ]; then
580 juju-log "IBM DB2: Installing 32 bit libstdc++.so.6"
581 apt-get install lib32stdc++6 -y
582 juju-log "IBM DB2: Installed 32 bit libstdc++.so.6"
583 fi
584 if [ "$ARCHITECTURE" == "ppc64le" ]; then
585 juju-log "IBM DB2: Installing libnuma package for POWER LE (ppc64le) platforms."
586 apt-get install libnuma-dev -y
587 #Installing XL compiler runtime packages for Linux on Power as this is one of the prerequisite software/configuration requirements
588 echo "deb http://public.dhe.ibm.com/software/server/POWER/Linux/rte/xlcpp/le/ubuntu $(lsb_release -s -c) main" | tee -a /etc/apt/sources.list.d/ibm-xlcpp-rte.list
589 apt-get update
590 apt-get install libxlc -y --force-yes
591 juju-log "IBM DB2: Installed libnuma package for POWER LE (ppc64le) platforms."
592 fi
593
594 juju-log "IBM DB2: Creating the user ids for db2 installation"
595 groupadd db2grp1
596 groupadd dasadm1
597 groupadd db2fgrp1
598
599 useradd -g db2grp1 -G dasadm1 -m $DB2_USER
600 echo $DB2_USER:$DB2_USER_PW | chpasswd
601 useradd -g dasadm1 -G db2grp1 -m $DB2_DAS_USER
602 echo $DB2_DAS_USER:$DB2_DAS_USER_PW | chpasswd
603 useradd -g db2fgrp1 -m $DB2_FENCE_USER
604 echo $DB2_FENCE_USER:$DB2_FENCE_USER_PW | chpasswd
605
606 juju-log "IBM DB2: Created the user ids for db2 installation"
607 status-set maintenance "Installed pre requisites for IBM DB2"
608 set_state 'ibm-db2.prereqsinstalled'
609
610}
611
612
613@when 'ibm-db2.prereqsinstalled' 'ibm-base.license.accepted' 'ibm-base.curl.resource.fetched'
614@when_not 'ibm-db2.installed'
615function install() {
616 juju-log "IBM DB2: License accepted"
617 db2_inst=`is_db2_installed`
618 if [[ ! -d $ARCHIVE_DIR ]]; then
619 mkdir $ARCHIVE_DIR
620 fi
621 #Install if download succeeded
622 if [ $db2_inst == "False" ]; then
623 if [ -f $ARCHIVE_DIR/*.gz ]; then
624
625 cd $CHARM_DIR/files/archives
626 tar -zxvf $ARCHIVE_DIR/*.gz
627 if [ $? -ne 0 ]; then
628 juju-log "IBM DB2: Unable to extract the DB2 package content. Verify whether the package is corrupt."
629 status-set maintenance "Unable to extract the DB2 package content"
630 #Remove corrupt archive file
631 rm -rf $ARCHIVE_DIR/*.gz
632 exit 0
633 fi
634 if [ "$ARCHITECTURE" = "x86_64" ]; then
635 rsp_file=db2server.rsp
636 else
637 rsp_file=db2server_ppcle.rsp
638 fi
639 edit_responsefile
640 cd $CHARM_DIR/files/archives/server*
641 juju-log "IBM DB2: Edited the response file"
642
643 juju-log "IBM DB2: Checking etc/hosts file."
644 private_address=`unit-get private-address`
645 if grep -q "$private_address" /etc/hosts; then
646 juju-log "IBM DB2: Host file already updated"
647 else
648 juju-log "IBM DB2: Updating Host file"
649 echo "$private_address `hostname`" >> /etc/hosts
650 fi
651
652 juju-log "IBM DB2: Installing db2 package."
653 status-set maintenance "Installing IBM DB2"
654 ./db2setup -r $CHARM_DIR/files/archives/$rsp_file
655 juju-log "IBM DB2: Installation of db2 complete."
656 fi
657 fi
658 # Configure system values for Db2
659 configure_system
660 #Configure DFTDBPATH
661 configure_dftdbpath
662 echo "Tempory Key File" > $TEMP_KEY_FILE
663 set_state 'ibm-db2.installed'
664 status-set active "IBM DB2 Installed"
665}
666
667@when 'config.changed.dftdbpath'
668function configurevalues(){
669 configure_dftdbpath
670}
671
672@when 'ibm-db2.installed'
673@when_not 'db.connected'
674function report_waiting_on_consumers(){
675 status-set active "IBM DB2 Ready (waiting for consumers)"
676}
677
678@when 'ibm-db2.installed'
679@when 'db.connected'
680function configure_sshkeys(){
681 services=$(relation_call --state=db.connected services)
682 for service in $services; do
683 key=$(relation_call --state=db.connected get_sshkeys $service) || true
684 juju-log "IBM DB2: Received the ssh key $key from the service $service"
685
686 if [ "$key" == "None" ]; then
687 juju-log "IBM DB2: No data sent yet"
688 continue
689 fi
690
691 # Add the key to the authorized_keys file, if it exists
692 set +e
693 #Create a temp key file if it doesn't exist
694 if [ -f $TEMP_KEY_FILE ]; then
695 juju-log "IBM DB2: Temp file already exists"
696 else
697 echo "Temp Key File" > $TEMP_KEY_FILE
698 fi
699 if [ -f $AUTH_KEY_FILE ]; then
700 # Append only if the key is not present
701 juju-log "IBM DB2: Updating the key file"
702 grep "$key" $AUTH_KEY_FILE > /dev/null
703 if [ $? -ne 0 ]; then
704 juju-log "IBM DB2: Updating authorized keys file"
705 echo "$key" >> $AUTH_KEY_FILE
706 echo "$service:$key" >> $TEMP_KEY_FILE
707 else
708 juju-log "IBM DB2: Key already present"
709 fi
710 else
711 juju-log "IBM DB2: Creating authorized keys file"
712 echo "$key" > $AUTH_KEY_FILE
713 echo "$service:$key" > $TEMP_KEY_FILE
714 fi
715 relation_call --state=db.connected set_sshconfigured $service || true
716 juju-log "IBM DB2: Completed updating the authorized key"
717 set -e
718 done
719}
720
721@when 'ibm-db2.installed'
722@when 'db.ready'
723@when 'db.sshconfigured'
724function create_consumer_dbs(){
725 services=$(relation_call --state=db.ready services)
726 for service in $services; do
727
728 key=$(relation_call --state=db.ready get_sshkeys $service) || true
729 juju-log "IBM DB2: In create_consumer_dbs function, Received the ssh key $key from the service $service"
730
731 if [ "$key" == "None" ]; then
732 juju-log "IBM DB2: No data sent yet"
733 continue
734 fi
735
736
737 #Create the user for the remote unit connected
738 juju-log "IBM DB2: Creating the users for the consumer $service"
739 create_user $service
740 juju-log "IBM DB2: Create users completed"
741
742 #Create the DBs after parsing
743 juju-log "IBM DB2: Creating DBs for the consumer $service"
744 create_dbs $service
745 juju-log "IBM DB2: Create DBs completed"
746
747 # If we created a new db, send relation data. Otherwise, the db already
748 # existed, so there is no need to send the data.
749 if [ $isdbcreated -eq 1 ] ; then
750 get_cfgusername $service
751 service_name=`su - $cfgusername -c 'db2 get dbm cfg|grep -i svce|cut -d"=" -f2'`
752 db2_port=`grep $service_name /etc/services | cut -d"/" -f1 | grep "db2c_$cfgusername" | cut -f2`
753 db2_path="/opt/ibm/db2"
754 hostname=`unit-get private-address`
755 dbusername=$cfgusername
756 dbuserpw=$cfgpasswd
757 db2_instance_name=$cfgusername
758
759
760 juju-log "IBM DB2: Sending the DB details to the consumer $service"
761 juju-log "Port number: $db2_port"
762 juju-log "Hostname: $hostname"
763 juju-log "DBusername: $dbusername DBuserpw: $dbuserpw"
764 juju-log "DB Instance name: $db2_instance_name"
765 juju-log "Service: $service_name"
766 juju-log "DBname: $dbs_created"
767
768 relation_call --state=db.ready set_db_details $service $db2_path $db2_port $hostname $dbusername $dbuserpw $db2_instance_name $dbs_created || true
769 fi
770
771 status-set active "IBM DB2 Ready"
772 done
773}
774
775@when 'ibm-db2.installed'
776@when 'db.departed'
777function stop_db2(){
778 juju-log "IBM DB2: Stopping the DB when relation is broken"
779 services=$(relation_call --state=db.departed services) || true
780 for service in $services; do
781 juju-log "IBM DB2: Service name is $service"
782 get_cfgusername $service
783 if su - $cfgusername -c 'ps -eaf|grep -i "\bdb2sysc 0\b" |grep -i '$cfgusername
784 then
785 su - $cfgusername -c 'db2 force applications all'
786 su - $cfgusername -c 'db2stop'
787 juju-log "IBM DB2: DB2 stopped for instance $cfgusername"
788 else
789 juju-log "IBM DB2: DB2 is already stopped for the instance $cfgusername"
790 fi
791 #Remove the ssh key entry from ssh keys file
792 remove_sshkeys $service
793 relation_call --state=db.departed dismiss_sshconfigured $service || true
794 relation_call --state=db.departed dismiss $service || true
795 done
796}
797
798
799reactive_handler_main
0800
=== added file 'reactive/leadership.py'
--- reactive/leadership.py 1970-01-01 00:00:00 +0000
+++ reactive/leadership.py 2016-07-14 17:53:24 +0000
@@ -0,0 +1,68 @@
1# Copyright 2015-2016 Canonical Ltd.
2#
3# This file is part of the Leadership Layer for Juju.
4#
5# This program is free software: you can redistribute it and/or modify
6# it under the terms of the GNU General Public License version 3, as
7# published by the Free Software Foundation.
8#
9# This program is distributed in the hope that it will be useful, but
10# WITHOUT ANY WARRANTY; without even the implied warranties of
11# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
12# PURPOSE. See the GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17from charmhelpers.core import hookenv
18from charmhelpers.core import unitdata
19
20from charms import reactive
21from charms.leadership import leader_get, leader_set
22
23
24__all__ = ['leader_get', 'leader_set'] # Backwards compatibility
25
26
27def initialize_leadership_state():
28 '''Initialize leadership.* states from the hook environment.
29
30 Invoked by hookenv.atstart() so states are available in
31 @hook decorated handlers.
32 '''
33 is_leader = hookenv.is_leader()
34 if is_leader:
35 hookenv.log('Initializing Leadership Layer (is leader)')
36 else:
37 hookenv.log('Initializing Leadership Layer (is follower)')
38
39 reactive.helpers.toggle_state('leadership.is_leader', is_leader)
40
41 previous = unitdata.kv().getrange('leadership.settings.', strip=True)
42 current = hookenv.leader_get()
43
44 # Handle deletions.
45 for key in set(previous.keys()) - set(current.keys()):
46 current[key] = None
47
48 any_changed = False
49 for key, value in current.items():
50 reactive.helpers.toggle_state('leadership.changed.{}'.format(key),
51 value != previous.get(key))
52 if value != previous.get(key):
53 any_changed = True
54 reactive.helpers.toggle_state('leadership.set.{}'.format(key),
55 value is not None)
56 reactive.helpers.toggle_state('leadership.changed', any_changed)
57
58 unitdata.kv().update(current, prefix='leadership.settings.')
59
60
61# Per https://github.com/juju-solutions/charms.reactive/issues/33,
62# this module may be imported multiple times so ensure the
63# initialization hook is only registered once. I have to piggy back
64# onto the namespace of a module imported before reactive discovery
65# to do this.
66if not hasattr(reactive, '_leadership_registered'):
67 hookenv.atstart(initialize_leadership_state)
68 reactive._leadership_registered = True
069
=== added file 'requirements.txt'
--- requirements.txt 1970-01-01 00:00:00 +0000
+++ requirements.txt 2016-07-14 17:53:24 +0000
@@ -0,0 +1,2 @@
1flake8
2pytest
03
=== modified file 'tests/00-setup'
--- tests/00-setup 2015-12-07 02:57:11 +0000
+++ tests/00-setup 2016-07-14 17:53:24 +0000
@@ -1,31 +1,17 @@
1#!/bin/bash1#!/bin/bash
22
33
4SFTP_USER_NAME=${SFTP_USER_NAME?Error: Need SFTP user name for logging into to sftp server}4DB2_CURL_URL=${DB2_CURL_URL?Error: IBM IM curl_url be defined in tests/00-setup}
5SFTP_PASSWORD=${SFTP_PASSWORD?Error: Need SFTP password for logging into to sftp server}5DB2_CURL_OPTS=${DB2_CURL_OPTS?Error: IBM IM curl_OPTS be defined in tests/00-setup}
6PACKAGE_NAME=${DIR_NAME?Error: The path on sftp server for the packages for $CHARM_NAME}6
7SFTP_HOST=${SFTP_HOST?Error: Need SFTP server Domain name}
8PACKAGE_DIR=${PACKAGE_DIR?Error: Need Package Directory name}
97
10# Add a local configuration file8# Add a local configuration file
11cat << EOF > local.yaml9cat << EOF > local.yaml
12ibm-repo:10ibm-repo:
13 sftp_user_name: "$SFTP_USER_NAME"11 db2_curl_url: "$DB2_CURL_URL"
14 sftp_password: "$SFTP_PASSWORD"12 db2_curl_opts: "$DB2_CURL_OPTS"
15 package_name: "$PACKAGE_NAME"13EOF
16 sftp_host: "$SFTP_HOST"14
17 package_dir: "$PACKAGE_DIR"15sudo add-apt-repository ppa:juju/stable -y
18EOF16sudo apt-get update
1917sudo apt-get install amulet python3 -y
20DB2_SHA_DISTRIBUTION_PKG=${DB2_SHA_DISTRIBUTION_PKG?Error: Checksum value for Distribution package must be defined in tests/00-setup}
21
22# Add a local configuration file
23cat << EOF >> local.yaml
24ibm-db2:
25 db2distribution_pkg_sha: "$DB2_SHA_DISTRIBUTION_PKG"
26
27EOF
28
29add-apt-repository ppa:juju/stable -y
30apt-get update
31apt-get install amulet -y
3218
=== modified file 'tests/10-bundles-test.py'
--- tests/10-bundles-test.py 2015-12-07 03:38:45 +0000
+++ tests/10-bundles-test.py 2016-07-14 17:53:24 +0000
@@ -8,8 +8,9 @@
8import amulet8import amulet
9import sys9import sys
10import time10import time
11import requests
1112
12seconds_to_wait = 100013seconds_to_wait = 20000
1314
1415
15class BundleTest(unittest.TestCase):16class BundleTest(unittest.TestCase):
@@ -17,7 +18,7 @@
17 @classmethod18 @classmethod
18 def setUpClass(cls):19 def setUpClass(cls):
19 """ Set up an amulet deployment using the bundle. """20 """ Set up an amulet deployment using the bundle. """
20 d = amulet.Deployment()21 d = amulet.Deployment(juju_env='local', series='trusty')
21 # We have a contextual test, if no config is present, initialze the22 # We have a contextual test, if no config is present, initialze the
22 # test with an empty configuration set23 # test with an empty configuration set
23 config = {}24 config = {}
@@ -25,61 +26,28 @@
25 with open(local_path, "r") as fd:26 with open(local_path, "r") as fd:
26 config = yaml.safe_load(fd)27 config = yaml.safe_load(fd)
2728
28 sftphost = config.get('ibm-repo').get('sftp_host')29 curl_url = config.get('ibm-repo').get('db2_curl_url')
29 if not sftphost:30 if not curl_url:
30 message = 'Please provide the host name from where the package can be downloaded.'31 message = 'Please provide the curl url from where the package can be downloaded.'
31 amulet.raise_status(amulet.FAIL, msg=message)32 amulet.raise_status(amulet.FAIL, msg=message)
32 sys.exit(1)33 sys.exit(1)
33 34
34 packagedir = config.get('ibm-repo').get('package_dir')35 curl_opts = config.get('ibm-repo').get('db2_curl_opts')
35 if not packagedir:36 if not curl_opts:
36 message = 'Please provide the directory from where the package can be downloaded.'37 message = 'Please provide the curl_opts to specify the credentials to download the packages.'
37 amulet.raise_status(amulet.FAIL, msg=message)38 amulet.raise_status(amulet.FAIL, msg=message)
38 sys.exit(1)39 sys.exit(1)
3940
40 packagename = config.get('ibm-repo').get('package_name')41
41 if not packagename:42 d.add('ibm-db2')
42 message = 'Please provide the package name to download.'43
43 amulet.raise_status(amulet.FAIL, msg=message)44 d.configure('ibm-db2', { 'license_accepted': True,
44 sys.exit(1)45 'curl_url': curl_url,
4546 'curl_opts': curl_opts })
46 sftpusername = config.get('ibm-repo').get('sftp_user_name')
47 if not sftpusername:
48 message = 'Please provide the user name to log into the sftp server for downloading the package.'
49 amulet.raise_status(amulet.FAIL, msg=message)
50 sys.exit(1)
51
52 sftppasswd = config.get('ibm-repo').get('sftp_password')
53 if not sftppasswd:
54 message = 'Please provide the password to log into the sftp server for downloading the package.'
55 amulet.raise_status(amulet.FAIL, msg=message)
56 sys.exit(1)
57
58 db2distributionpkgsha = config.get('ibm-db2').get('db2distribution_pkg_sha')
59 print('Using SHA sum for distribution package %s' % db2distributionpkgsha)
60
61 if not db2distributionpkgsha:
62 message = 'Please provide the sha value to proceed further. Exiting before completing rest of the verification tests.'
63 amulet.raise_status(amulet.FAIL, msg=message)
64
65 bundle_path = os.path.join(os.path.dirname(__file__), 'bundles.yaml')
66 with open(bundle_path, 'r') as bundle_file:
67 contents = yaml.safe_load(bundle_file)
68 d.load(contents)
69
70
71 d.setup(seconds_to_wait)47 d.setup(seconds_to_wait)
72 d.sentry.wait(seconds_to_wait)48 d.sentry.wait(seconds_to_wait)
73 cls.d = d49 cls.d = d
7450
75 d.configure('ibm-db2', { 'accept-ibm-db2-license': True,
76 'host': sftphost,
77 'package_dir': packagedir,
78 'username': sftpusername,
79 'password': sftppasswd,
80 'db2_package_name': packagename,
81 'sha': db2distributionpkgsha })
82 time.sleep(300)
8351
8452
85 def test_deployed(self):53 def test_deployed(self):
8654
=== added file 'tox.ini'
--- tox.ini 1970-01-01 00:00:00 +0000
+++ tox.ini 2016-07-14 17:53:24 +0000
@@ -0,0 +1,12 @@
1[tox]
2skipsdist=True
3envlist = py34, py35
4skip_missing_interpreters = True
5
6[testenv]
7commands = py.test -v
8deps =
9 -r{toxinidir}/requirements.txt
10
11[flake8]
12exclude=docs
013
=== added directory 'wheelhouse'
=== added file 'wheelhouse/Jinja2-2.8.tar.gz'
1Binary files wheelhouse/Jinja2-2.8.tar.gz 1970-01-01 00:00:00 +0000 and wheelhouse/Jinja2-2.8.tar.gz 2016-07-14 17:53:24 +0000 differ14Binary files wheelhouse/Jinja2-2.8.tar.gz 1970-01-01 00:00:00 +0000 and wheelhouse/Jinja2-2.8.tar.gz 2016-07-14 17:53:24 +0000 differ
=== added file 'wheelhouse/MarkupSafe-0.23.tar.gz'
2Binary files wheelhouse/MarkupSafe-0.23.tar.gz 1970-01-01 00:00:00 +0000 and wheelhouse/MarkupSafe-0.23.tar.gz 2016-07-14 17:53:24 +0000 differ15Binary files wheelhouse/MarkupSafe-0.23.tar.gz 1970-01-01 00:00:00 +0000 and wheelhouse/MarkupSafe-0.23.tar.gz 2016-07-14 17:53:24 +0000 differ
=== added file 'wheelhouse/PyYAML-3.11.zip'
3Binary files wheelhouse/PyYAML-3.11.zip 1970-01-01 00:00:00 +0000 and wheelhouse/PyYAML-3.11.zip 2016-07-14 17:53:24 +0000 differ16Binary files wheelhouse/PyYAML-3.11.zip 1970-01-01 00:00:00 +0000 and wheelhouse/PyYAML-3.11.zip 2016-07-14 17:53:24 +0000 differ
=== added file 'wheelhouse/Tempita-0.5.2.tar.gz'
4Binary files wheelhouse/Tempita-0.5.2.tar.gz 1970-01-01 00:00:00 +0000 and wheelhouse/Tempita-0.5.2.tar.gz 2016-07-14 17:53:24 +0000 differ17Binary files wheelhouse/Tempita-0.5.2.tar.gz 1970-01-01 00:00:00 +0000 and wheelhouse/Tempita-0.5.2.tar.gz 2016-07-14 17:53:24 +0000 differ
=== added file 'wheelhouse/charmhelpers-0.8.0.tar.gz'
5Binary files wheelhouse/charmhelpers-0.8.0.tar.gz 1970-01-01 00:00:00 +0000 and wheelhouse/charmhelpers-0.8.0.tar.gz 2016-07-14 17:53:24 +0000 differ18Binary files wheelhouse/charmhelpers-0.8.0.tar.gz 1970-01-01 00:00:00 +0000 and wheelhouse/charmhelpers-0.8.0.tar.gz 2016-07-14 17:53:24 +0000 differ
=== added file 'wheelhouse/charms.reactive-0.4.4.tar.gz'
6Binary files wheelhouse/charms.reactive-0.4.4.tar.gz 1970-01-01 00:00:00 +0000 and wheelhouse/charms.reactive-0.4.4.tar.gz 2016-07-14 17:53:24 +0000 differ19Binary files wheelhouse/charms.reactive-0.4.4.tar.gz 1970-01-01 00:00:00 +0000 and wheelhouse/charms.reactive-0.4.4.tar.gz 2016-07-14 17:53:24 +0000 differ
=== added file 'wheelhouse/netaddr-0.7.18.tar.gz'
7Binary files wheelhouse/netaddr-0.7.18.tar.gz 1970-01-01 00:00:00 +0000 and wheelhouse/netaddr-0.7.18.tar.gz 2016-07-14 17:53:24 +0000 differ20Binary files wheelhouse/netaddr-0.7.18.tar.gz 1970-01-01 00:00:00 +0000 and wheelhouse/netaddr-0.7.18.tar.gz 2016-07-14 17:53:24 +0000 differ
=== added file 'wheelhouse/pip-8.1.2.tar.gz'
8Binary files wheelhouse/pip-8.1.2.tar.gz 1970-01-01 00:00:00 +0000 and wheelhouse/pip-8.1.2.tar.gz 2016-07-14 17:53:24 +0000 differ21Binary files wheelhouse/pip-8.1.2.tar.gz 1970-01-01 00:00:00 +0000 and wheelhouse/pip-8.1.2.tar.gz 2016-07-14 17:53:24 +0000 differ
=== added file 'wheelhouse/pyaml-15.8.2.tar.gz'
9Binary files wheelhouse/pyaml-15.8.2.tar.gz 1970-01-01 00:00:00 +0000 and wheelhouse/pyaml-15.8.2.tar.gz 2016-07-14 17:53:24 +0000 differ22Binary files wheelhouse/pyaml-15.8.2.tar.gz 1970-01-01 00:00:00 +0000 and wheelhouse/pyaml-15.8.2.tar.gz 2016-07-14 17:53:24 +0000 differ
=== added file 'wheelhouse/six-1.10.0.tar.gz'
10Binary files wheelhouse/six-1.10.0.tar.gz 1970-01-01 00:00:00 +0000 and wheelhouse/six-1.10.0.tar.gz 2016-07-14 17:53:24 +0000 differ23Binary files wheelhouse/six-1.10.0.tar.gz 1970-01-01 00:00:00 +0000 and wheelhouse/six-1.10.0.tar.gz 2016-07-14 17:53:24 +0000 differ

Subscribers

People subscribed via source and target branches

to all changes: