[Dbconfig-common-devel] dbconfig and default values

sean finney seanius at debian.org
Mon Apr 10 17:15:24 UTC 2006


hi radu,

On Mon, Apr 10, 2006 at 06:52:29PM +0300, Radu Spineanu wrote:
> I am trying to setup some default values for dbconfig, however they are
> not taken into consideration:

> ------------
> ## Source debconf library
> . /usr/share/debconf/confmodule
> dbc_first_version="0.6.1-1"
> dbc_load_include="perl:/etc/simba/simba-db.cfg"
> dbc_dbserver="localhost"
> dbc_dbport="3306"
> 
> # source dbconfig-common stuff
> . /usr/share/dbconfig-common/dpkg/config.mysql
> dbc_go simba $@

hrm, i'm not sure off the top of my head.  do you have a source
package you could point me at?


> The program i am trying to package uses perl dbi, and the connection
> needs values for port and host:
> 
> ------------
>   db => {
>     dsn  => 'dbi:mysql:database=mirrors_db;host=localhost;port=3306',
>     user => 'mirrors',
>     pass => 'mirrors',
>   },
> ------------

so is your problem that the dbc_load_include isn't working at all, or
is it only that the default localhost/port values aren't being set
properly?

istr doing some work to be able to provide "unset" values, that is,
values for certain settings when blank.  i'll double check on this
because it was a bit back and i forget how far i got with it.

> On a side note, do you any examples about using dbc_generate_include
> with templates ?

no, i don't think so.  the db-test-mysql-perl package from the examples
directory uses the dbc_generate_include feature, but that's it.
probably worth including one though :)

basically, you do something like

dbc_generate_include="perl:$destinationfile"
dbc_generate_include_args="-f template -o template_infile=$srctemplate"

i'm pretty sure anyway.  i think you can then have srctemplate be
something like:

# local database configuration file:
our $dsn="DBI:mysql:database=_DBC_DBTYPE_;...etc";

alternatively, you can put '-C#' in dbc_generate_include_args 
and then make your template look something like:

...
our $dbport="_DBC_DBPORT_";
...
$dbport="3306" if ! defined($dbport);
...
our $dsn="DBI:mysql:database=$dbname;port=$dbport;...etc";


which i think is ugly because it puts a small amount of logic in
a config file, but at the same time it should work just fine.


	sean

-- 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/dbconfig-common-devel/attachments/20060410/66e9f79f/attachment.pgp


More information about the Dbconfig-common-devel mailing list