Merge lp:~mistotebe/charms/precise/openerp-server/proper-hooks into lp:charms/openerp-server
- Precise Pangolin (12.04)
- proper-hooks
- Merge into trunk
Proposed by
mistotebe
Status: | Merged |
---|---|
Merged at revision: | 42 |
Proposed branch: | lp:~mistotebe/charms/precise/openerp-server/proper-hooks |
Merge into: | lp:charms/openerp-server |
Diff against target: |
941 lines (+649/-131) 16 files modified
README (+36/-47) config.yaml (+40/-13) hooks/config-changed (+58/-0) hooks/db-relation-departed (+9/-0) hooks/db-relation-joined (+19/-53) hooks/install (+22/-15) hooks/restart (+9/-0) hooks/start (+4/-0) hooks/stop (+4/-2) hooks/tools/bzr (+50/-0) hooks/tools/common (+52/-0) icon.svg (+291/-0) metadata.yaml (+2/-0) revision (+1/-1) tests/00test.sh (+6/-0) tests/deploy.test (+46/-0) |
To merge this branch: | bzr merge lp:~mistotebe/charms/precise/openerp-server/proper-hooks |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
charmers | Pending | ||
Peter Petrakis | Pending | ||
Review via email: mp+215380@code.launchpad.net |
Commit message
Description of the change
This fixes the openerp-server charm. Also, it allows the user to set their own version in case they want to use OCB branches or custom code.
To post a comment you must log in.
Revision history for this message
Matt Bruzek (mbruzek) wrote : | # |
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'README' |
2 | --- README 2012-03-25 17:55:07 +0000 |
3 | +++ README 2014-07-01 15:19:11 +0000 |
4 | @@ -1,54 +1,43 @@ |
5 | Juju charm OpenERP |
6 | ================== |
7 | |
8 | -:Author: Patrick Hetu <patrick@koumbit.org> |
9 | +:Author: Patrick Hetu <patrick@koumbit.org>, Ondrej Kuznik <ondrej.kuznik@credativ.co.uk> |
10 | + |
11 | +OpenERP is a comprehensive open source management system. It has a large, |
12 | +active community, which has developed modules to handle all facets of company |
13 | +management. |
14 | + |
15 | +These include, amongst others: Sales Management, CRM, Manufacturing, Stock, |
16 | +Accounting, Human Resources, Project Management, Logistics, Productivity and |
17 | +Document Management. |
18 | + |
19 | +OpenERP allows you to start easily with one module to fit a specific need then |
20 | +add additional modules as and when you need them enabling you to have a |
21 | +powerful feature rich Enterprise Resource Planner. |
22 | |
23 | Example deployment |
24 | ------------------ |
25 | |
26 | -1. First bootstrap your environment:: |
27 | - |
28 | - juju bootstrap |
29 | - |
30 | -2. On a diffent terminal starts the log collection with the command:: |
31 | - |
32 | - juju debug-log |
33 | - |
34 | -3. Then in the first terminal create the services and expose them to the Internet:: |
35 | - |
36 | - juju deploy postgresql |
37 | - juju deploy openerp-web |
38 | - juju deploy openerp-server |
39 | - |
40 | - juju add-relation openerp-server:db postgresql:db-admin |
41 | - juju add-relation openerp-web openerp-server |
42 | - |
43 | - juju expose openerp-web |
44 | - juju expose openerp-server |
45 | - |
46 | -4. Accessing your openerp: |
47 | - |
48 | - For the web interface, it should be ready at:: |
49 | - |
50 | - http://<your_server_address> |
51 | - |
52 | - To find out the public address of openerp-web, look for it in the output of the |
53 | - `juju status` command. |
54 | - |
55 | - For the XML-RPC interface look for the public address of openerp-server. It |
56 | - is running there on port 8070. |
57 | - |
58 | -3. If you have not set a master password: |
59 | - |
60 | - To be able to create database via the web interface, you must know the |
61 | - master password. You will found it in the logs collected by the `juju debug-log` |
62 | - command. If you need it later, the password is in the `/etc/openerp-server.conf` |
63 | - configuration file. You can read it by running this command: |
64 | - |
65 | - cat /etc/openerp-server.conf |
66 | - |
67 | - after have logged in the openerp-server server. The command will show you a |
68 | - line with the password looking like this: |
69 | - |
70 | - admin_passwd = <the_password> |
71 | - |
72 | +After you have bootstrapped your deployment, do the following: |
73 | + - deploy the openerp-server and postgresql charms to your environment |
74 | + - add a relation between them (pick the 'db-admin' one) |
75 | + - if you have not chosen the admin password for the openerp-server charm yet, |
76 | + do it now |
77 | + - expose the openerp-server charm (there is also the openerp-web charm in |
78 | + case you want to achieve better scalability by separating the roles) |
79 | + |
80 | +Accessing your OpenERP: |
81 | +----------------------- |
82 | + |
83 | +If you have exposed this charm, you can access your server by visiting |
84 | +http://<your-address>:8069. If you have set up openerp-web or even a web |
85 | +proxy/load balancer, consult their documentation to find out how to expose |
86 | +and connect to them. |
87 | + |
88 | +If this charm is exposed, the NETRPC/XML-RPC interface is available at port |
89 | +8070. |
90 | + |
91 | +The first time you access the charm, a wizard will greet you that lets you |
92 | +create a new database, you will need the password you configured for that. If |
93 | +you have not set it during deployment, you will have to specify it to be able |
94 | +to create new databases. |
95 | |
96 | === modified file 'config.yaml' |
97 | --- config.yaml 2012-04-05 01:08:51 +0000 |
98 | +++ config.yaml 2014-07-01 15:19:11 +0000 |
99 | @@ -3,24 +3,51 @@ |
100 | type: string |
101 | default: "" |
102 | description: | |
103 | - This is master password that allows database operation. Leave |
104 | - it empty will generate one for you. Note the this |
105 | - configuration is only valid at installation time and cannot be changed |
106 | - afterwards. |
107 | + This is master password that allows database operation. While empty, |
108 | + the service will not be started. |
109 | origin: |
110 | type: string |
111 | default: "lp" |
112 | description: | |
113 | This is the location to download OpenERP. It can be the keyword: distro, |
114 | - or lp. With lp you can set a version number. Note the this |
115 | - configuration is only valid at installation time and cannot be changed |
116 | - afterwards. |
117 | + lp, or lp-ocb. With lp you can set a version number. Note that when |
118 | + changing this configuration you lose most customizations done already. |
119 | version: |
120 | type: string |
121 | - default: "/6.1" |
122 | - description: | |
123 | - This set the version of the code to install. Empty string will download |
124 | - the trunk version. Don't forget the / at the beginning if you set a |
125 | - version number. Note the this configuration is only valid at |
126 | - installation time and cannot be changed afterwards. |
127 | + default: "/7.0" |
128 | + description: | |
129 | + This sets the version of the code to install when source is lp or |
130 | + lp-ocb. Empty string will download the trunk version. Don't forget |
131 | + the / at the beginning if you set a version number. Note that when |
132 | + changing this configuration you lose most customizations done |
133 | + already. |
134 | + bzr_url_server: |
135 | + type: string |
136 | + default: "" |
137 | + description: | |
138 | + If set and origin starts with "lp", this a URL from which to download |
139 | + the sources of OpenERP core server. Use it if you want to use sources |
140 | + from a custom repository. Note that when changing this configuration |
141 | + you lose most customizations done already. |
142 | + bzr_url_addons: |
143 | + type: string |
144 | + default: "" |
145 | + description: | |
146 | + If set and origin starts with "lp", this a URL from which to download |
147 | + the sources of OpenERP core addons. Use it if you want to use sources |
148 | + from a custom repository. Note that when changing this configuration |
149 | + you lose most customizations done already. |
150 | + bzr_url_web: |
151 | + type: string |
152 | + default: "" |
153 | + description: | |
154 | + If set and origin starts with "lp", this a URL from which to download |
155 | + the sources of OpenERP web frontend. Use it if you want to use sources |
156 | + from a custom repository. Note that when changing this configuration |
157 | + you lose most customizations done already. |
158 | + extra_packages: |
159 | + type: string |
160 | + default: "" |
161 | + description: | |
162 | + Extra packages to be installed on the system. |
163 | |
164 | |
165 | === added file 'hooks/config-changed' |
166 | --- hooks/config-changed 1970-01-01 00:00:00 +0000 |
167 | +++ hooks/config-changed 2014-07-01 15:19:11 +0000 |
168 | @@ -0,0 +1,58 @@ |
169 | +#!/bin/bash |
170 | +# vim: et ai ts=2 sw=2: |
171 | + |
172 | +PATH="$PATH:$CHARM_DIR/hooks/tools" |
173 | +. $CHARM_DIR/hooks/tools/common |
174 | +. $CHARM_DIR/hooks/tools/bzr |
175 | + |
176 | +is_config_valid || exit 0 |
177 | + |
178 | +set -e # -x for verbose logging to juju debug-log |
179 | + |
180 | +install_packages $(config-get extra_packages) |
181 | + |
182 | +if is_launchpad; then |
183 | + if is_package_installed openerp-server; then |
184 | + apt-get remove openerp-server |
185 | + fi |
186 | + |
187 | + add_user |
188 | + resolve_config_urls |
189 | + resolve_current_urls |
190 | + |
191 | + cd /srv/ |
192 | + if [[ $CURRENT_SERVER_URL == $SERVER_URL ]]; then |
193 | + cd openobject-server/ |
194 | + |
195 | + if [[ $CURRENT_ADDONS_URL != $ADDONS_URL ]]; then |
196 | + rm -rf addons |
197 | + bzr_checkout "${ADDONS_URL}" addons |
198 | + fi |
199 | + |
200 | + if [[ $CURRENT_WEB_URL != $WEB_URL ]]; then |
201 | + rm -r web |
202 | + bzr_checkout "${WEB_URL}" web |
203 | + fi |
204 | + else |
205 | + rm -rf openobject-server |
206 | + |
207 | + bzr_checkout "${SERVER_URL}" openobject-server |
208 | + |
209 | + cd openobject-server/ |
210 | + bzr_checkout "${ADDONS_URL}" addons |
211 | + bzr_checkout "${WEB_URL}" web |
212 | + fi |
213 | +else |
214 | + if [[ -e /srv/openobject-server ]]; then |
215 | + juju-log "Removing juju checkout" |
216 | + rm -rf /srv/openobject-server |
217 | + fi |
218 | + |
219 | + juju-log "Installing with distro packages" |
220 | + install_packages openerp-server python-ldap python-imaging |
221 | +fi |
222 | + |
223 | +generate_config |
224 | + |
225 | +juju-log "(Re)Starting OpenERP service" |
226 | +$CHARM_DIR/hooks/restart |
227 | |
228 | === added file 'hooks/db-relation-departed' |
229 | --- hooks/db-relation-departed 1970-01-01 00:00:00 +0000 |
230 | +++ hooks/db-relation-departed 2014-07-01 15:19:11 +0000 |
231 | @@ -0,0 +1,9 @@ |
232 | +#!/bin/bash |
233 | +# vim: et ai ts=2 sw=2: |
234 | + |
235 | +set -e # -x for verbose logging to juju debug-log |
236 | + |
237 | +rm -f /etc/openerp-server.conf /etc/openerp_db.conf |
238 | + |
239 | +juju-log "Stopping OpenERP service" |
240 | +$CHARM_DIR/hooks/stop |
241 | |
242 | === modified file 'hooks/db-relation-joined' |
243 | --- hooks/db-relation-joined 2012-03-28 19:45:05 +0000 |
244 | +++ hooks/db-relation-joined 2014-07-01 15:19:11 +0000 |
245 | @@ -1,56 +1,32 @@ |
246 | #!/bin/bash |
247 | - |
248 | -set -eu # -x for verbose logging to juju debug-log |
249 | - |
250 | -ORIGIN=$(config-get origin) |
251 | - |
252 | -ADMIN_PASSWD=`config-get admin_passwd` |
253 | +# vim: et ai ts=2 sw=2: |
254 | + |
255 | +PATH="$PATH:$CHARM_DIR/hooks/tools" |
256 | +. $CHARM_DIR/hooks/tools/common |
257 | + |
258 | +set -e # -x for verbose logging to juju debug-log |
259 | + |
260 | database_user=`relation-get user` |
261 | database_password=`relation-get password` |
262 | database_host=`relation-get host` |
263 | +database_port=`relation-get port` |
264 | database_name=`relation-get database` |
265 | |
266 | # All values are set together, so checking on a single value is enough |
267 | # If $user is not set, DB is still setting itself up, we exit awaiting next run |
268 | [ -z "$database_user" ] && exit 0 |
269 | |
270 | -if [[ -z $ADMIN_PASSWD ]] && \ |
271 | - [[ true == $(grep admin_passwd /etc/openerp-server.conf > /dev/null || echo "true") ]]; then |
272 | - |
273 | - juju-log "No password set, generating one" |
274 | - ADMIN_PASSWD=`pwgen -s 16` |
275 | - juju-log "Password: ${ADMIN_PASSWD}" |
276 | - |
277 | -elif [[ true == $(grep admin_passwd /etc/openerp-server.conf > /dev/null && echo "true") ]]; then |
278 | - |
279 | - juju-log "A password is in the config file set using this one" |
280 | - line=$(grep admin_passwd /etc/openerp-server.conf) |
281 | - ADMIN_PASSWD=$(echo ${line} | cut -d" " -f 3) |
282 | - |
283 | -fi |
284 | - |
285 | - |
286 | -cat > /etc/openerp-server.conf <<EOF |
287 | -[options] |
288 | -admin_passwd = ${ADMIN_PASSWD} |
289 | +cat >/etc/openerp_db.conf <<EOF |
290 | db_user = ${database_user} |
291 | db_password = ${database_password} |
292 | db_host = ${database_host} |
293 | -db_port = 5432 |
294 | +db_port = ${database_port} |
295 | EOF |
296 | |
297 | - |
298 | -if [[ $ORIGIN == lp ]]; then |
299 | - USERNAME=openerp |
300 | - |
301 | - juju-log "Adding openerp user" |
302 | - |
303 | - if ! getent passwd $USERNAME >/dev/null; then |
304 | - adduser --quiet --disabled-password \ |
305 | - --gecos "OpenERP User" \ |
306 | - $USERNAME |
307 | - fi |
308 | - |
309 | +add_user |
310 | +generate_config |
311 | + |
312 | +if is_launchpad; then |
313 | cat > /etc/init/openerp-server.conf << EOF |
314 | description "OpenERP web interface." |
315 | |
316 | @@ -62,22 +38,12 @@ |
317 | chdir /srv/openobject-server |
318 | exec su -c "./openerp-server --config=/etc/openerp-server.conf --addons-path=addons,web/addons --load=web" openerp |
319 | EOF |
320 | - |
321 | - juju-log "Starting OpenERP service" |
322 | - |
323 | - start openerp-server || restart openerp-server |
324 | - |
325 | -else |
326 | - |
327 | - juju-log "Starting OpenERP service" |
328 | - |
329 | - service openerp-server start || service openerp-server restart |
330 | - |
331 | fi |
332 | |
333 | +is_config_valid || exit 0 |
334 | + |
335 | +juju-log "(Re)Starting OpenERP service" |
336 | +$CHARM_DIR/hooks/restart |
337 | + |
338 | open-port 8069/tcp |
339 | open-port 8070/tcp |
340 | - |
341 | -chown openerp /etc/openerp-server.conf |
342 | -chmod 640 /etc/openerp-server.conf |
343 | - |
344 | |
345 | === modified file 'hooks/install' |
346 | --- hooks/install 2012-03-25 17:37:23 +0000 |
347 | +++ hooks/install 2014-07-01 15:19:11 +0000 |
348 | @@ -1,36 +1,43 @@ |
349 | #!/bin/bash |
350 | - |
351 | -set -eu # -x for verbose logging to juju debug-log |
352 | +# vim: et ai ts=2 sw=2: |
353 | + |
354 | +PATH="$PATH:$CHARM_DIR/hooks/tools" |
355 | +. $CHARM_DIR/hooks/tools/common |
356 | +. $CHARM_DIR/hooks/tools/bzr |
357 | + |
358 | +set -e # -x for verbose logging to juju debug-log |
359 | |
360 | ORIGIN=$(config-get origin) |
361 | VERSION=$(config-get version) |
362 | |
363 | +install_packages |
364 | apt-get -y install debconf debconf-utils bzr pwgen |
365 | - |
366 | -if [[ $ORIGIN == lp ]]; then |
367 | - |
368 | - juju-log "Installing with openerp reposirory at version: ${VERSION}" |
369 | - |
370 | - apt-get -y update |
371 | - apt-get install -y python-zsi python-werkzeug python-vobject python-vatnumber \ |
372 | +install_packages $(config-get extra_packages) |
373 | + |
374 | +if is_launchpad; then |
375 | + juju-log "Installing with launchpad" |
376 | + resolve_config_urls |
377 | + |
378 | + install_packages \ |
379 | +python-zsi python-werkzeug python-vobject python-vatnumber \ |
380 | python-simplejson python-reportlab python-yaml python-webdav python-tz \ |
381 | python-openid python-dateutil python-pydot python-psycopg2 python-mako \ |
382 | python-lxml python-gdata python-feedparser python-babel python-setuptools \ |
383 | python-pychart python-markupsafe python-ldap python-imaging python-libxslt1 \ |
384 | -python-xlwt --no-install-recommends |
385 | +python-xlwt python-unittest2 python-mock python-docutils |
386 | |
387 | cd /srv/ |
388 | - bzr checkout --lightweight lp:openobject-server${VERSION} openobject-server |
389 | + bzr_checkout "${SERVER_URL}" openobject-server |
390 | + |
391 | cd openobject-server/ |
392 | - bzr checkout --lightweight lp:openobject-addons${VERSION} addons |
393 | - bzr checkout --lightweight lp:openerp-web${VERSION} web |
394 | + bzr_checkout "${ADDONS_URL}" addons |
395 | + bzr_checkout "${WEB_URL}" web |
396 | |
397 | else |
398 | |
399 | juju-log "Installing with distro packages" |
400 | |
401 | - apt-get -y update |
402 | - apt-get install -y openerp-server python-ldap python-imaging --no-install-recommends |
403 | + install_packages openerp-server python-ldap python-imaging |
404 | |
405 | fi |
406 | |
407 | |
408 | === added file 'hooks/restart' |
409 | --- hooks/restart 1970-01-01 00:00:00 +0000 |
410 | +++ hooks/restart 2014-07-01 15:19:11 +0000 |
411 | @@ -0,0 +1,9 @@ |
412 | +#!/bin/bash |
413 | + |
414 | +PATH="$PATH:$CHARM_DIR/hooks/tools" |
415 | +. $CHARM_DIR/hooks/tools/common |
416 | +is_config_valid && [[ -e /etc/openerp-server.conf ]] || exit 0 |
417 | + |
418 | +set -eu # -x for verbose logging to juju debug-log |
419 | + |
420 | +service openerp-server start || service openerp-server restart |
421 | |
422 | === modified file 'hooks/start' |
423 | --- hooks/start 2012-04-05 02:00:21 +0000 |
424 | +++ hooks/start 2014-07-01 15:19:11 +0000 |
425 | @@ -1,5 +1,9 @@ |
426 | #!/bin/bash |
427 | |
428 | +PATH="$PATH:$CHARM_DIR/hooks/tools" |
429 | +. $CHARM_DIR/hooks/tools/common |
430 | +is_config_valid && [[ -e /etc/openerp-server.conf ]] || exit 0 |
431 | + |
432 | set -eu # -x for verbose logging to juju debug-log |
433 | |
434 | service openerp-server start || true |
435 | |
436 | === modified file 'hooks/stop' |
437 | --- hooks/stop 2012-04-05 02:00:21 +0000 |
438 | +++ hooks/stop 2014-07-01 15:19:11 +0000 |
439 | @@ -1,6 +1,8 @@ |
440 | -i#!/bin/bash |
441 | +#!/bin/bash |
442 | + |
443 | +PATH="$PATH:$CHARM_DIR/hooks/tools" |
444 | +. $CHARM_DIR/hooks/tools/common |
445 | |
446 | set -eu # -x for verbose logging to juju debug-log |
447 | |
448 | - |
449 | service openerp-server stop |
450 | |
451 | === added directory 'hooks/tools' |
452 | === added file 'hooks/tools/bzr' |
453 | --- hooks/tools/bzr 1970-01-01 00:00:00 +0000 |
454 | +++ hooks/tools/bzr 2014-07-01 15:19:11 +0000 |
455 | @@ -0,0 +1,50 @@ |
456 | +#!/bin/bash |
457 | +# vim: et ai ts=2 sw=2: |
458 | + |
459 | +resolve_config_urls() { |
460 | + ORIGIN=$(config-get origin) |
461 | + VERSION=$(config-get version) |
462 | + |
463 | + SERVER_URL=$(config-get bzr_url_server) |
464 | + ADDONS_URL=$(config-get bzr_url_addons) |
465 | + WEB_URL=$(config-get bzr_url_web) |
466 | + |
467 | + if [[ $ORIGIN == lp-ocb ]]; then |
468 | + SERVER_URL=${SERVER_URL:-"lp:ocb-server${VERSION}"} |
469 | + ADDONS_URL=${ADDONS_URL:-"lp:ocb-addons${VERSION}"} |
470 | + WEB_URL=${WEB_URL:-"lp:ocb-web${VERSION}"} |
471 | + fi |
472 | + |
473 | + # otherwise use upstream |
474 | + SERVER_URL=${SERVER_URL:-"lp:openobject-server${VERSION}"} |
475 | + ADDONS_URL=${ADDONS_URL:-"lp:openobject-addons${VERSION}"} |
476 | + WEB_URL=${WEB_URL:-"lp:openerp-web${VERSION}"} |
477 | + |
478 | + juju-log "Server URL is '${SERVER_URL}'" |
479 | + juju-log "Addons URL is '${ADDONS_URL}'" |
480 | + juju-log "Web frontend URL is '${WEB_URL}'" |
481 | +} |
482 | + |
483 | +resolve_current_urls() { |
484 | + CURRENT_SERVER_URL="" |
485 | + CURRENT_ADDONS_URL="" |
486 | + CURRENT_WEB_URL="" |
487 | + |
488 | + if [[ -d /srv/openobject-server ]]; then |
489 | + cd /srv/openobject-server/ |
490 | + CURRENT_SERVER_URL=$(< .url) || true |
491 | + CURRENT_ADDONS_URL=$(< addons/.url) || true |
492 | + CURRENT_WEB_URL=$(< web/.url) || true |
493 | + fi |
494 | +} |
495 | + |
496 | +bzr_checkout() { |
497 | + local URL DIR |
498 | + URL="$1" |
499 | + # by default the directory is the last part of url path |
500 | + DIR=$( IFS=/ SPLIT=( $URL ); echo "${SPLIT[-1]}" ) |
501 | + DIR="${2:-"$DIR"}" |
502 | + |
503 | + bzr checkout --lightweight "${URL}" "${DIR}" |
504 | + echo "${URL}" >"${DIR}/.url" |
505 | +} |
506 | |
507 | === added file 'hooks/tools/common' |
508 | --- hooks/tools/common 1970-01-01 00:00:00 +0000 |
509 | +++ hooks/tools/common 2014-07-01 15:19:11 +0000 |
510 | @@ -0,0 +1,52 @@ |
511 | +#!/bin/bash |
512 | +# vim: et ai ts=2 sw=2: |
513 | + |
514 | +is_config_valid() { |
515 | + [[ -n $(config-get admin_passwd) ]] |
516 | +} |
517 | + |
518 | +is_launchpad() { |
519 | + [[ $(config-get origin) =~ lp* ]] |
520 | +} |
521 | + |
522 | +is_packaged() { |
523 | + ! is_launchpad |
524 | +} |
525 | + |
526 | +is_package_installed() { |
527 | + [[ -n $(dpkg --get-selections openerp-server 2>/dev/null) ]] |
528 | +} |
529 | + |
530 | +add_user() { |
531 | + local USERNAME=${1:-openerp} |
532 | + |
533 | + juju-log "Adding user $USERNAME" |
534 | + |
535 | + # OpenERP package removes the user in post-remove |
536 | + if ! getent passwd $USERNAME >/dev/null; then |
537 | + adduser --quiet --disabled-password \ |
538 | + --gecos "OpenERP User" \ |
539 | + $USERNAME |
540 | + fi |
541 | +} |
542 | + |
543 | +install_packages() { |
544 | + if [[ -z $UPDATES_RUN ]]; then |
545 | + apt-get -y update |
546 | + UPDATES_RUN=yes |
547 | + fi |
548 | + |
549 | + apt-get install -y --no-install-recommends "$@" |
550 | +} |
551 | + |
552 | +generate_config() { |
553 | + [[ -e /etc/openerp_db.conf ]] || return 0 |
554 | + |
555 | + cat - /etc/openerp_db.conf >/etc/openerp-server.conf <<EOF |
556 | +[options] |
557 | +admin_passwd = $(config-get admin_passwd) |
558 | +EOF |
559 | + |
560 | + chown openerp: /etc/openerp-server.conf |
561 | + chmod 640 /etc/openerp-server.conf |
562 | +} |
563 | |
564 | === added file 'icon.svg' |
565 | --- icon.svg 1970-01-01 00:00:00 +0000 |
566 | +++ icon.svg 2014-07-01 15:19:11 +0000 |
567 | @@ -0,0 +1,291 @@ |
568 | +<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
569 | +<!-- Created with Inkscape (http://www.inkscape.org/) --> |
570 | + |
571 | +<svg |
572 | + xmlns:dc="http://purl.org/dc/elements/1.1/" |
573 | + xmlns:cc="http://creativecommons.org/ns#" |
574 | + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
575 | + xmlns:svg="http://www.w3.org/2000/svg" |
576 | + xmlns="http://www.w3.org/2000/svg" |
577 | + xmlns:xlink="http://www.w3.org/1999/xlink" |
578 | + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" |
579 | + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" |
580 | + width="96" |
581 | + height="96" |
582 | + id="svg6517" |
583 | + version="1.1" |
584 | + inkscape:version="0.48.4 r9939" |
585 | + sodipodi:docname="icon.svg"> |
586 | + <defs |
587 | + id="defs6519"> |
588 | + <linearGradient |
589 | + inkscape:collect="always" |
590 | + xlink:href="#Background" |
591 | + id="linearGradient6461" |
592 | + gradientUnits="userSpaceOnUse" |
593 | + x1="142.50002" |
594 | + y1="973.29779" |
595 | + x2="1.5e-05" |
596 | + y2="973.29779" |
597 | + gradientTransform="matrix(0,-0.66666669,0.6660448,0,-866.25992,731.29077)" /> |
598 | + <linearGradient |
599 | + id="Background"> |
600 | + <stop |
601 | + id="stop4178" |
602 | + offset="0" |
603 | + style="stop-color:#b8b8b8;stop-opacity:1" /> |
604 | + <stop |
605 | + id="stop4180" |
606 | + offset="1" |
607 | + style="stop-color:#bcbcbc;stop-opacity:1" /> |
608 | + </linearGradient> |
609 | + <filter |
610 | + style="color-interpolation-filters:sRGB;" |
611 | + inkscape:label="Inner Shadow" |
612 | + id="filter1121"> |
613 | + <feFlood |
614 | + flood-opacity="0.59999999999999998" |
615 | + flood-color="rgb(0,0,0)" |
616 | + result="flood" |
617 | + id="feFlood1123" /> |
618 | + <feComposite |
619 | + in="flood" |
620 | + in2="SourceGraphic" |
621 | + operator="out" |
622 | + result="composite1" |
623 | + id="feComposite1125" /> |
624 | + <feGaussianBlur |
625 | + in="composite1" |
626 | + stdDeviation="1" |
627 | + result="blur" |
628 | + id="feGaussianBlur1127" /> |
629 | + <feOffset |
630 | + dx="0" |
631 | + dy="2" |
632 | + result="offset" |
633 | + id="feOffset1129" /> |
634 | + <feComposite |
635 | + in="offset" |
636 | + in2="SourceGraphic" |
637 | + operator="atop" |
638 | + result="composite2" |
639 | + id="feComposite1131" /> |
640 | + </filter> |
641 | + <filter |
642 | + style="color-interpolation-filters:sRGB;" |
643 | + inkscape:label="Drop Shadow" |
644 | + id="filter950"> |
645 | + <feFlood |
646 | + flood-opacity="0.25" |
647 | + flood-color="rgb(0,0,0)" |
648 | + result="flood" |
649 | + id="feFlood952" /> |
650 | + <feComposite |
651 | + in="flood" |
652 | + in2="SourceGraphic" |
653 | + operator="in" |
654 | + result="composite1" |
655 | + id="feComposite954" /> |
656 | + <feGaussianBlur |
657 | + in="composite1" |
658 | + stdDeviation="1" |
659 | + result="blur" |
660 | + id="feGaussianBlur956" /> |
661 | + <feOffset |
662 | + dx="0" |
663 | + dy="1" |
664 | + result="offset" |
665 | + id="feOffset958" /> |
666 | + <feComposite |
667 | + in="SourceGraphic" |
668 | + in2="offset" |
669 | + operator="over" |
670 | + result="composite2" |
671 | + id="feComposite960" /> |
672 | + </filter> |
673 | + <clipPath |
674 | + clipPathUnits="userSpaceOnUse" |
675 | + id="clipPath873"> |
676 | + <g |
677 | + transform="matrix(0,-0.66666667,0.66604479,0,-258.25992,677.00001)" |
678 | + id="g875" |
679 | + inkscape:label="Layer 1" |
680 | + style="fill:#ff00ff;fill-opacity:1;stroke:none;display:inline"> |
681 | + <path |
682 | + style="fill:#ff00ff;fill-opacity:1;stroke:none;display:inline" |
683 | + d="m 46.702703,898.22775 50.594594,0 C 138.16216,898.22775 144,904.06497 144,944.92583 l 0,50.73846 c 0,40.86071 -5.83784,46.69791 -46.702703,46.69791 l -50.594594,0 C 5.8378378,1042.3622 0,1036.525 0,995.66429 L 0,944.92583 C 0,904.06497 5.8378378,898.22775 46.702703,898.22775 Z" |
684 | + id="path877" |
685 | + inkscape:connector-curvature="0" |
686 | + sodipodi:nodetypes="sssssssss" /> |
687 | + </g> |
688 | + </clipPath> |
689 | + <filter |
690 | + inkscape:collect="always" |
691 | + id="filter891" |
692 | + inkscape:label="Badge Shadow"> |
693 | + <feGaussianBlur |
694 | + inkscape:collect="always" |
695 | + stdDeviation="0.71999962" |
696 | + id="feGaussianBlur893" /> |
697 | + </filter> |
698 | + </defs> |
699 | + <sodipodi:namedview |
700 | + id="base" |
701 | + pagecolor="#ffffff" |
702 | + bordercolor="#666666" |
703 | + borderopacity="1.0" |
704 | + inkscape:pageopacity="0.0" |
705 | + inkscape:pageshadow="2" |
706 | + inkscape:zoom="1.17" |
707 | + inkscape:cx="-25.412417" |
708 | + inkscape:cy="49.018169" |
709 | + inkscape:document-units="px" |
710 | + inkscape:current-layer="layer1" |
711 | + showgrid="true" |
712 | + fit-margin-top="0" |
713 | + fit-margin-left="0" |
714 | + fit-margin-right="0" |
715 | + fit-margin-bottom="0" |
716 | + inkscape:window-width="1920" |
717 | + inkscape:window-height="1041" |
718 | + inkscape:window-x="0" |
719 | + inkscape:window-y="17" |
720 | + inkscape:window-maximized="1" |
721 | + showborder="true" |
722 | + showguides="true" |
723 | + inkscape:guide-bbox="true" |
724 | + inkscape:showpageshadow="false"> |
725 | + <inkscape:grid |
726 | + type="xygrid" |
727 | + id="grid821" /> |
728 | + <sodipodi:guide |
729 | + orientation="1,0" |
730 | + position="16,48" |
731 | + id="guide823" /> |
732 | + <sodipodi:guide |
733 | + orientation="0,1" |
734 | + position="64,80" |
735 | + id="guide825" /> |
736 | + <sodipodi:guide |
737 | + orientation="1,0" |
738 | + position="80,40" |
739 | + id="guide827" /> |
740 | + <sodipodi:guide |
741 | + orientation="0,1" |
742 | + position="64,16" |
743 | + id="guide829" /> |
744 | + </sodipodi:namedview> |
745 | + <metadata |
746 | + id="metadata6522"> |
747 | + <rdf:RDF> |
748 | + <cc:Work |
749 | + rdf:about=""> |
750 | + <dc:format>image/svg+xml</dc:format> |
751 | + <dc:type |
752 | + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> |
753 | + <dc:title></dc:title> |
754 | + </cc:Work> |
755 | + </rdf:RDF> |
756 | + </metadata> |
757 | + <g |
758 | + inkscape:label="BACKGROUND" |
759 | + inkscape:groupmode="layer" |
760 | + id="layer1" |
761 | + transform="translate(268,-635.29076)" |
762 | + style="display:inline"> |
763 | + <path |
764 | + style="fill:url(#linearGradient6461);fill-opacity:1;stroke:none;display:inline;filter:url(#filter1121)" |
765 | + d="m -268,700.15563 0,-33.72973 c 0,-27.24324 3.88785,-31.13513 31.10302,-31.13513 l 33.79408,0 c 27.21507,0 31.1029,3.89189 31.1029,31.13513 l 0,33.72973 c 0,27.24325 -3.88783,31.13514 -31.1029,31.13514 l -33.79408,0 C -264.11215,731.29077 -268,727.39888 -268,700.15563 Z" |
766 | + id="path6455" |
767 | + inkscape:connector-curvature="0" |
768 | + sodipodi:nodetypes="sssssssss" /> |
769 | + <text |
770 | + xml:space="preserve" |
771 | + style="font-size:84px;font-style:italic;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#800000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans Italic" |
772 | + x="-253.71799" |
773 | + y="713.83649" |
774 | + id="text3839" |
775 | + sodipodi:linespacing="125%" |
776 | + inkscape:transform-center-y="4.422863"><tspan |
777 | + sodipodi:role="line" |
778 | + id="tspan3841" |
779 | + x="-253.71799" |
780 | + y="713.83649">O</tspan></text> |
781 | + </g> |
782 | + <g |
783 | + inkscape:groupmode="layer" |
784 | + id="layer3" |
785 | + inkscape:label="PLACE YOUR PICTOGRAM HERE" |
786 | + style="display:inline" /> |
787 | + <g |
788 | + inkscape:groupmode="layer" |
789 | + id="layer2" |
790 | + inkscape:label="BADGE" |
791 | + style="display:none" |
792 | + sodipodi:insensitive="true"> |
793 | + <g |
794 | + style="display:inline" |
795 | + transform="translate(-340.00001,-581)" |
796 | + id="g4394" |
797 | + clip-path="none"> |
798 | + <g |
799 | + id="g855"> |
800 | + <g |
801 | + inkscape:groupmode="maskhelper" |
802 | + id="g870" |
803 | + clip-path="url(#clipPath873)" |
804 | + style="opacity:0.6;filter:url(#filter891)"> |
805 | + <path |
806 | + transform="matrix(1.4999992,0,0,1.4999992,-29.999795,-237.54282)" |
807 | + d="m 264,552.36218 a 12,12 0 1 1 -24,0 A 12,12 0 1 1 264,552.36218 Z" |
808 | + sodipodi:ry="12" |
809 | + sodipodi:rx="12" |
810 | + sodipodi:cy="552.36218" |
811 | + sodipodi:cx="252" |
812 | + id="path844" |
813 | + style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" |
814 | + sodipodi:type="arc" /> |
815 | + </g> |
816 | + <g |
817 | + id="g862"> |
818 | + <path |
819 | + sodipodi:type="arc" |
820 | + style="color:#000000;fill:#f5f5f5;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" |
821 | + id="path4398" |
822 | + sodipodi:cx="252" |
823 | + sodipodi:cy="552.36218" |
824 | + sodipodi:rx="12" |
825 | + sodipodi:ry="12" |
826 | + d="m 264,552.36218 a 12,12 0 1 1 -24,0 A 12,12 0 1 1 264,552.36218 Z" |
827 | + transform="matrix(1.4999992,0,0,1.4999992,-29.999795,-238.54282)" /> |
828 | + <path |
829 | + transform="matrix(1.25,0,0,1.25,33,-100.45273)" |
830 | + d="m 264,552.36218 a 12,12 0 1 1 -24,0 A 12,12 0 1 1 264,552.36218 Z" |
831 | + sodipodi:ry="12" |
832 | + sodipodi:rx="12" |
833 | + sodipodi:cy="552.36218" |
834 | + sodipodi:cx="252" |
835 | + id="path4400" |
836 | + style="color:#000000;fill:#dd4814;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" |
837 | + sodipodi:type="arc" /> |
838 | + <path |
839 | + sodipodi:type="star" |
840 | + style="color:#000000;fill:#f5f5f5;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" |
841 | + id="path4459" |
842 | + sodipodi:sides="5" |
843 | + sodipodi:cx="666.19574" |
844 | + sodipodi:cy="589.50385" |
845 | + sodipodi:r1="7.2431178" |
846 | + sodipodi:r2="4.3458705" |
847 | + sodipodi:arg1="1.0471976" |
848 | + sodipodi:arg2="1.6755161" |
849 | + inkscape:flatsided="false" |
850 | + inkscape:rounded="0.1" |
851 | + inkscape:randomized="0" |
852 | + d="m 669.8173,595.77657 c -0.39132,0.22593 -3.62645,-1.90343 -4.07583,-1.95066 -0.44938,-0.0472 -4.05653,1.36297 -4.39232,1.06062 -0.3358,-0.30235 0.68963,-4.03715 0.59569,-4.47913 -0.0939,-0.44198 -2.5498,-3.43681 -2.36602,-3.8496 0.18379,-0.41279 4.05267,-0.59166 4.44398,-0.81759 0.39132,-0.22593 2.48067,-3.48704 2.93005,-3.4398 0.44938,0.0472 1.81505,3.67147 2.15084,3.97382 0.3358,0.30236 4.08294,1.2817 4.17689,1.72369 0.0939,0.44198 -2.9309,2.86076 -3.11469,3.27355 C 669.9821,591.68426 670.20862,595.55064 669.8173,595.77657 Z" |
853 | + transform="matrix(1.511423,-0.16366377,0.16366377,1.511423,-755.37346,-191.93651)" /> |
854 | + </g> |
855 | + </g> |
856 | + </g> |
857 | + </g> |
858 | +</svg> |
859 | |
860 | === modified file 'metadata.yaml' |
861 | --- metadata.yaml 2012-05-23 16:48:38 +0000 |
862 | +++ metadata.yaml 2014-07-01 15:19:11 +0000 |
863 | @@ -10,6 +10,8 @@ |
864 | GUI, customizable reports, and NET-RPC and XML-RPC interfaces. This |
865 | package contains the Open ERP server, install openerp-client package |
866 | for the client. |
867 | +categories: |
868 | + - app-servers |
869 | provides: |
870 | website: |
871 | interface: http |
872 | |
873 | === modified file 'revision' |
874 | --- revision 2012-03-16 18:44:49 +0000 |
875 | +++ revision 2014-07-01 15:19:11 +0000 |
876 | @@ -1,1 +1,1 @@ |
877 | -1 |
878 | +2 |
879 | |
880 | === added directory 'tests' |
881 | === added file 'tests/00test.sh' |
882 | --- tests/00test.sh 1970-01-01 00:00:00 +0000 |
883 | +++ tests/00test.sh 2014-07-01 15:19:11 +0000 |
884 | @@ -0,0 +1,6 @@ |
885 | +#!/bin/bash |
886 | + |
887 | +sudo apt-add-repository ppa:juju/stable -y |
888 | +sudo apt-get update |
889 | + |
890 | +sudo apt-get install -y amulet |
891 | |
892 | === added file 'tests/deploy.test' |
893 | --- tests/deploy.test 1970-01-01 00:00:00 +0000 |
894 | +++ tests/deploy.test 2014-07-01 15:19:11 +0000 |
895 | @@ -0,0 +1,46 @@ |
896 | +#!/usr/bin/env python3 |
897 | + |
898 | +import amulet |
899 | +from time import sleep |
900 | +import requests |
901 | +import configparser |
902 | + |
903 | +seconds = 1800 |
904 | + |
905 | +d = amulet.Deployment() |
906 | + |
907 | +d.add('postgresql') |
908 | +d.add('openerp-server') |
909 | +d.configure('openerp-server', {'admin_passwd': 'password'}) |
910 | +d.relate('openerp-server:db', 'postgresql:db-admin') |
911 | +d.expose('openerp-server') |
912 | + |
913 | +try: |
914 | + d.setup(seconds) |
915 | + #pings every deployed unit |
916 | + d.sentry.wait(seconds) |
917 | +except amulet.helpers.TimeoutError: |
918 | + message = 'The environment did not setup in %d seconds.' % seconds |
919 | + amulet.raise_status(amulet.SKIP, msg=message) |
920 | + |
921 | +oerp_unit = d.sentry.unit['openerp-server/0'] |
922 | +psql_unit = d.sentry.unit['postgresql/0'] |
923 | + |
924 | +db_relation = d.sentry.unit['postgresql/0'].relation('db-admin', 'openerp-server:db') |
925 | + |
926 | +conf = configparser.RawConfigParser() |
927 | +conf.read_string((oerp_unit.file_contents('/etc/openerp-server.conf'))) |
928 | + |
929 | +assert(conf['options']['admin_passwd'] == 'password') |
930 | + |
931 | +for attempt in range(100): |
932 | + try: |
933 | + response = requests.get("http://%s:8069/?db=a" % oerp_unit.info['public-address']) |
934 | + if response.text.lower().find("openerp") > 0: |
935 | + break |
936 | + except requests.ConnectionError: |
937 | + sleep(6) |
938 | +else: |
939 | + amulet.raise_status(amulet.FAIL, msg="OpenERP has not started up in time") |
940 | + |
941 | +#wget --tries=100 --timeout=6 "http://$host:8069/" -O - -a "$datadir/wget.log" | grep -q 'OpenERP' |
mistotebe,
Thank you for the work on the openerp-server charm! This Merge Proposal is an improvement and the charmers appreciate the time and effort put in here.
Thanks for updating the README document! I followed the instructions and was able to deploy openerp based soley on the README. That is excellent work!
README
It would be even better if the README contained more information. Typically we like to see links to the upstream code location, links to documentation and how to file bugs. If you have charm-tools installed run the command: juju charm add readme that will generate a README.ex template that you can use to fill in the missing sections. One section I would highly suggest improving is a description of configuration options (especially the ones you added) and what values would be good to use. I understand the values are described in config.yaml, but the README is the place to describe them too.
I ran our linting tool called charm proof against the charm. There are still some warnings in the charm that we would like to see cleared up:
$ juju charm proof
W: Metadata is missing categories.
W: No icon.svg file.
I: relation openerp has no hooks
W: Metadata is missing categories. /juju.ubuntu. com/docs/ authors- charm-writing. html#make- some-metadata. yaml
The categories is an easy fix, we have some documenation about categories here: https:/
W: No icon.svg file. /juju.ubuntu. com/docs/ authors- charm-icon. html
You can create an icon for this charm and it will be easier to recognize in the GUI. There are instructions here: https:/
I: relation openerp has no hooks
Each relationship should have its own set of hooks. The charm provides an openerp relation but there are no hooks to handle this.
Amulet tests:
Thank you for adding amulet tests for this charm! Repeatable tests are key to make sure our charms are robust and automated tests can be run against our charms.
00test.sh
This tests does not run as root, so you need to add sudo to each of those commands. Also add a -y on apt-get install amulet so it can run automatically. The tests failed to run because of this problem.
Based on the test failure I have to put this Merge Proposal in “Work in Progress”. Please fix the tests, address the other issues. When you are ready move the status back to Needs Review and a charmer will take a look at the changes.
Your changes were very well done and greatly appreciated. Just a few minor changes and it should be ready for the charm store! Thanks again for your efforts I look forward to seeing this charm in the store soon.
If you have questions or need any further information you can find mbruzek on IRC. You can contact us in #juju on irc.freenode.net or email the mailing list <email address hidden>