On Wed, Jun 23, 2010 at 02:07:09PM +0200, Lars Ellenberg wrote:
> On Tue, Jun 22, 2010 at 10:05:10AM -0600, Serge Dubrouski wrote:
> > Yes it is possible to parse it from postgresql.conf of from provided
> > config file.
> 
> Then that should be done, IMO.
> Otherwise it has to be changed in two places again,
> and it will be forgotten in one or the other,
> which will lead to very hard to debug misbehaviour.

It would indeed be better to fetch it from the configuration
file. However, there's also the concern that Serge mentioned on
directories such as /tmp which should be handled differently.

I'd suggest to drop the parameter and get it from the
configuration file and create/modify the directory _only_ in case
the directory doesn't exist. Codewise:

check_socket_dir() {
    if [ ! -d "$1" ]
    then
           mkdir
           chmod
           chown
        fi
}

I think that this should be safe enough.

Thanks,

Dejan

> > Attached is an improved patch with double quotes and error checks.
> > >> > @@ -238,6 +248,11 @@
> > >> >          ocf_log err "PostgreSQL can't write to the log file: 
> > >> > $OCF_RESKEY_logfile"
> > >> >     return $OCF_ERR_GENERIC
> > >> >      fi
> > >> > +    # Check if we need to create a socket directory
> > >> > +    if [ -n "$OCF_RESKEY_socketdir" ]
> > >> > +    then
> > >> > +        check_socket_dir $OCF_RESKEY_socketdir
> 
> double quotes missing here already, btw.
> and as OCF_RESKEY_socketdir is a "global" anyways,
> why pass it as argument to subfunctions at all?
> 
> -- 
> : Lars Ellenberg
> : LINBIT | Your Way to High Availability
> : DRBD/HA support and consulting http://www.linbit.com
> 
> DRBD® and LINBIT® are registered trademarks of LINBIT, Austria.
> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to