Merge lp:~openerp-dev/openobject-server/6.0-bug-750267-xrg into lp:openobject-server/6.0

Proposed by xrg
Status: Rejected
Rejected by: Vo Minh Thu
Proposed branch: lp:~openerp-dev/openobject-server/6.0-bug-750267-xrg
Merge into: lp:openobject-server/6.0
Diff against target: 184 lines (+135/-19)
4 files modified
README (+17/-17)
bin/release.py (+0/-1)
doc/openerp-server.init (+1/-1)
tools/server-check.sh (+117/-0)
To merge this branch: bzr merge lp:~openerp-dev/openobject-server/6.0-bug-750267-xrg
Reviewer Review Type Date Requested Status
Vo Minh Thu (community) Disapprove
Review via email: mp+56160@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Vo Minh Thu (thu) wrote :

I'm happy to know that this script should be autonomous... can we also know what is its purpose and why we would want to add it to the server's repo?

Revision history for this message
Vo Minh Thu (thu) wrote :

You're script is a wrapper for 'createuser'. So instead of expecting the user to know the arguments for 'createuser', she should know the arguments for your script, which are not documented.

The only possibly valuable part of it is that it reads some default parameter from the openerp config file.

Still, I would much prefer some documentation about installing openerp using 'createuser' than some documentation to describe a fragile wrapper.

review: Disapprove

Unmerged revisions

3395. By xrg

bin: non-scripts must be -x, scripts +x

This should solve the corresponding rpmlint errors. Python files with a
shebang must be executable. Non-standalone python shall not have a shebang.
(cherry picked from commit d44bd2dcc03a75864cae7c93020537ac573999fe)

3394. By xrg

readme: convert to unix line terminators
(cherry picked from commit a7f39a511daf67fe6c6acaa8d678e8c8f4ee6e2f)

3393. By xrg

server-check.sh: when doing the 'su' trick, reset the trigger file
(cherry picked from commit 0e9cafa01cd5e658dd99c0b0702ffd450f7c86a3)

3392. By xrg

tools/server-check: support distros with postgres ident authentication

In such distros, we have to run once as root, and once as the postgres
user, which can access the db, not any other file.
(cherry picked from commit e4957f45384b33e5cc7891c4f34de5dc4022d943)

3391. By xrg

tools/server-check: allow createdb

From the origin of this script[1], the new user created didn't have
permission to create dbs, which is required in OpenERP.

[1] a2billing, v200
(cherry picked from commit 24cd824c0ae37180882736ecfe379747624fcf2d)

3390. By xrg

Tools: a script to check pg connectivity for a server installation

To be used in init scripts or package installations.
(cherry picked from commit e489748150371e3b620d53ffa20196d2ed1a2d0f)

3389. By xrg

server-init: simplify syntax for RedHat
(cherry picked from commit 787ad03c0edf15f8dea1f1cff8829676d318ce90)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'README'
2--- README 2010-09-28 18:53:49 +0000
3+++ README 2011-04-04 13:34:16 +0000
4@@ -1,17 +1,17 @@
5-About OpenERP
6----------------
7-
8-OpenERP is a free Enterprise Resource Planning and Customer Relationship
9-Management software. It is mainly developed to meet changing needs.
10-
11-The main functional features are: CRM & SRM, analytic and financial accounting,
12-double-entry stock management, sales and purchases management, tasks automation,
13-help desk, marketing campaign, ... and vertical modules for very specific
14-businesses.
15-
16-Technical features include a distributed server, flexible workflows, an object
17-database, dynamic GUIs, customizable reports, NET-RPC and XML-RPC interfaces, ...
18-
19-For more information, please visit:
20-http://www.openerp.com
21-
22+About OpenERP
23+---------------
24+
25+OpenERP is a free Enterprise Resource Planning and Customer Relationship
26+Management software. It is mainly developed to meet changing needs.
27+
28+The main functional features are: CRM & SRM, analytic and financial accounting,
29+double-entry stock management, sales and purchases management, tasks automation,
30+help desk, marketing campaign, ... and vertical modules for very specific
31+businesses.
32+
33+Technical features include a distributed server, flexible workflows, an object
34+database, dynamic GUIs, customizable reports, NET-RPC and XML-RPC interfaces, ...
35+
36+For more information, please visit:
37+http://www.openerp.com
38+
39
40=== modified file 'bin/release.py'
41--- bin/release.py 2011-04-01 14:25:28 +0000
42+++ bin/release.py 2011-04-04 13:34:16 +0000
43@@ -1,4 +1,3 @@
44-#!/usr/bin/env python
45 # -*- encoding: utf-8 -*-
46 ##############################################################################
47 #
48
49=== modified file 'bin/tools/graph.py' (properties changed: -x to +x)
50=== modified file 'bin/tools/which.py' (properties changed: -x to +x)
51=== modified file 'doc/openerp-server.init'
52--- doc/openerp-server.init 2009-10-23 22:29:25 +0000
53+++ doc/openerp-server.init 2011-04-04 13:34:16 +0000
54@@ -52,7 +52,7 @@
55 start() {
56 if [ -d /etc/openerp/start.d ] ; then
57 echo -n $"Preparing $desc: "
58- run-parts --exit-on-error /etc/openerp/start.d
59+ run-parts /etc/openerp/start.d
60 RETVAL=$?
61 echo
62 [ $RETVAL -ne 0 ] && return $RETVAL
63
64=== added file 'tools/server-check.sh'
65--- tools/server-check.sh 1970-01-01 00:00:00 +0000
66+++ tools/server-check.sh 2011-04-04 13:34:16 +0000
67@@ -0,0 +1,117 @@
68+#!/bin/bash
69+
70+# This script should be autonomous, not require any external
71+# conf files. However, it will try to read the server's conf
72+
73+get_ini ()
74+{
75+ eval $( cat "$1" | grep "^db_\(user\|password\|name\|host\|port\) *=" | \
76+ sed 's/False//;s/\([^ ]*\) *= *\(.*\)$/\U\1\E=\2/' )
77+}
78+
79+DEVEL_MODE=
80+SUCMD=
81+DB_HOST=
82+DB_PORT=
83+DB_USER=openerp
84+DB_PASSWORD=
85+IN_SU=
86+
87+PG_ROOT=postgres
88+
89+while [ -n "$1" ] ; do
90+ case "$1" in
91+ -d)
92+ DEVEL_MODE=y
93+ echo "Devel mode!"
94+ ;;
95+ -s)
96+ SUCMD="su $PG_ROOT - "
97+ ;;
98+ -h)
99+ DB_HOST=$2
100+ shift 1
101+ ;;
102+ -p)
103+ DB_PORT=$2
104+ shift 1
105+ ;;
106+ -U)
107+ DB_USER=$2
108+ shift 1
109+ ;;
110+ -W)
111+ DB_PASSWORD=$2
112+ shift 1
113+ ;;
114+ --in-su)
115+ IN_SU=y
116+ ;;
117+ esac
118+ shift 1
119+done
120+
121+if [ ! -f "/var/run/openerp-server-check" ] && [ -z "$DEVEL_MODE" ] ; then
122+ # only run this if the magic file is there
123+ exit 0
124+fi
125+
126+if [ -n "$DEVEL_MODE" ] && [ -r ~/openerp-server.conf ] ; then
127+ echo "Parsing" ~/openerp-server.conf
128+ get_ini ~/openerp-server.conf
129+elif [ -f "/etc/openerp-server.conf" ] ; then
130+ get_ini "/etc/openerp-server.conf"
131+else
132+ echo "No config file, using defaults"
133+fi
134+
135+if [ -n "$DEVEL_MODE" ] ; then
136+ echo "Using:"
137+ echo "DB_HOST=" $DB_HOST
138+ echo "DB_PORT=" $DB_PORT
139+ echo "DB_USER=" $DB_USER
140+fi
141+
142+DB_CONNS=
143+if [ -n "$DB_HOST" ] ; then
144+ DB_CONNS+=" --host $DB_HOST"
145+fi
146+if [ -n "$DB_PORT" ] ; then
147+ DB_CONNS+=" --port $DB_PORT"
148+fi
149+
150+if [ -n "$SUCMD" ] ; then
151+ CMD="$0 --in-su"
152+ if [ -n "$DB_HOST" ] ; then
153+ CMD="$CMD -h $DB_HOST"
154+ fi
155+ if [ -n "$DB_PORT" ] ; then
156+ CMD="$CMD -p $DB_PORT"
157+ fi
158+ if [ -n "$DB_PASSWORD" ] ; then
159+ CMD="$CMD -W $DB_PASSWORD"
160+ fi
161+ su $PG_ROOT -c "$CMD" || "$?"
162+
163+ if [ -z "$DEVEL_MODE" ] ; then
164+ rm -f "/var/run/openerp-server-check"
165+ fi
166+ exit 0
167+fi
168+
169+if ! (psql -qt -U $PG_ROOT $DB_CONNS -c "SELECT usename FROM pg_user WHERE usename = '$DB_USER';" | \
170+ grep $DB_USER > /dev/null) ; then
171+ if ! $SUCMD createuser -U $PG_ROOT $DB_CONNS -S -d -R -l $DB_USER < /dev/null ; then
172+ echo "Failed to create user $DB_USER"
173+ exit 1
174+ fi
175+else
176+ echo "User $DB_USER already exists."
177+fi
178+
179+echo "OK"
180+if [ -z "$DEVEL_MODE" ] && [ -z "$IN_SU" ] ; then
181+ rm -f "/var/run/openerp-server-check"
182+fi
183+
184+#eof