tool to read .ini-dist and generate .ini files

RESOLVED WONTFIX

Status

RESOLVED WONTFIX
4 years ago
8 months ago

People

(Reporter: rhelmer, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

4 years ago
Every person I've talked to who is installing Socorro lately has tripped over the fact that config/alembic.ini has a config for Jenkins in it - this is because alembic does not use configman and doesn't provide a way to override this (as configman does).

Right now the test-socorro Makefile target has a for-loop to copy .ini-dist -> .ini if the .ini does not already exist.

There should be a tool that instead reads each .ini-dist and writes to .ini, optionally modifying it. This could be used as a setup tool to configure/reconfigure things like database hostname, IP addresses, etc. etc.

Comment 1

4 years ago
Doesn't alembic have some form of variable substitution using ConfigParser?
(Reporter)

Comment 2

4 years ago
(In reply to Chris Lonnen :lonnen from comment #1)
> Doesn't alembic have some form of variable substitution using ConfigParser?

Huh yeah that looks interesting.. from a quick look at the docs, I think there are only predefined tokens, but perhaps there's a way to get things from command-line arguments or environment variables into there?

BTW didn't mean to take this - not working on it right now.
Assignee: rhelmer → nobody

Comment 3

4 years ago
If we're feeling lively we could alternatively use an alembic-ini-template and run it through jinja or python string interp.
There are two simple solutions I see for this:
1) Replace the jenkins specific hostname in alembic.ini with localhost, and use sed just before testing to override the name.
2) Ship a separate jenkins specific alembic config file and point to it when running database setup/migrations.
try using ConfigObj (or ConfigParser) to read the ini-dist - the give the result to Configman as a Definition Source.  Then use a dict (or DotDict or anything that is a collections.Mapping) to make the value substitutions.  Then tell configman to write out the resultant ini file.  That's about 3 lines of code + the list of value substitutions...
See Also: → bug 1044183
Blocks: 1044183
See Also: bug 1044183
Assignee: nobody → tbramwell
Assignee: tbramwell → nobody
I'm pretty sure this problem isn't a problem anymore. Marking as WONTFIX.

If there's a compelling reason to re-open this and figure it out, please re-open with a comment updating the current status of the bug.
Status: NEW → RESOLVED
Last Resolved: 8 months ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.