Merge lp:~linuxjedi/drizzle/trunk-bug-667360 into lp:drizzle/7.0

Proposed by Andrew Hutchings
Status: Merged
Approved by: Monty Taylor
Approved revision: 1885
Merged at revision: 1884
Proposed branch: lp:~linuxjedi/drizzle/trunk-bug-667360
Merge into: lp:drizzle/7.0
Diff against target: 55 lines (+29/-2)
1 file modified
drizzled/drizzled.cc (+29/-2)
To merge this branch: bzr merge lp:~linuxjedi/drizzle/trunk-bug-667360
Reviewer Review Type Date Requested Status
Monty Taylor Approve
Review via email: mp+39462@code.launchpad.net

Description of the change

1. Make sure defaults-file is processed before options files
2. Processes plugin options again once defaults-files have been processed to make sure things like plugin-add in defaults files works (I don't like the way I had to do this bit, Monty: can you think of a better way?)
3. If --defaults-file doesn't exist on disk, error.

To post a comment you must log in.
Revision history for this message
Monty Taylor (mordred) wrote :

This looks great!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'drizzled/drizzled.cc'
2--- drizzled/drizzled.cc 2010-10-26 19:14:30 +0000
3+++ drizzled/drizzled.cc 2010-10-27 17:32:50 +0000
4@@ -1140,7 +1140,16 @@
5 it != in_options.end();
6 ++it)
7 {
8- defaults_file_list.push_back(*it);
9+ fs::path p(*it);
10+ if (fs::is_regular_file(p))
11+ defaults_file_list.push_back(*it);
12+ else
13+ {
14+ errmsg_printf(ERRMSG_LVL_ERROR,
15+ _("Defaults file '%s' not found\n"), (*it).c_str());
16+ unireg_abort(1);
17+ }
18+
19 }
20 }
21
22@@ -1422,7 +1431,6 @@
23 }
24 }
25
26- process_defaults_files();
27 /* TODO: here is where we should add a process_env_vars */
28
29 /* We need a notify here so that plugin_init will work properly */
30@@ -1438,6 +1446,25 @@
31 internal::my_progname, err.what());
32 unireg_abort(1);
33 }
34+
35+ process_defaults_files();
36+
37+ /* Process with notify a second time because a config file may contain
38+ plugin loader options */
39+
40+ try
41+ {
42+ po::notify(vm);
43+ }
44+ catch (po::validation_error &err)
45+ {
46+ errmsg_printf(ERRMSG_LVL_ERROR,
47+ _("%s: %s.\n"
48+ "Use --help to get a list of available options\n"),
49+ internal::my_progname, err.what());
50+ unireg_abort(1);
51+ }
52+
53 /* At this point, we've read all the options we need to read from files and
54 collected most of them into unknown options - now let's load everything
55 */

Subscribers

People subscribed via source and target branches