lifecycle: expose INTERFACES_FILE env var to executors
This commit is contained in:
parent
0669e897fd
commit
9e4e17707f
4 changed files with 8 additions and 4 deletions
|
@ -30,6 +30,7 @@ struct match_options {
|
|||
static bool up;
|
||||
static struct lif_execute_opts exec_opts = {
|
||||
.executor_path = EXECUTOR_PATH,
|
||||
.interfaces_file = INTERFACES_FILE,
|
||||
};
|
||||
|
||||
void
|
||||
|
@ -129,7 +130,6 @@ ifupdown_main(int argc, char *argv[])
|
|||
{NULL, 0, 0, 0}
|
||||
};
|
||||
struct match_options match_opts = {};
|
||||
char *interfaces_file = INTERFACES_FILE;
|
||||
char *state_file = STATE_FILE;
|
||||
|
||||
for (;;)
|
||||
|
@ -146,7 +146,7 @@ ifupdown_main(int argc, char *argv[])
|
|||
lif_common_version();
|
||||
break;
|
||||
case 'i':
|
||||
interfaces_file = optarg;
|
||||
exec_opts.interfaces_file = optarg;
|
||||
break;
|
||||
case 'a':
|
||||
match_opts.is_auto = true;
|
||||
|
@ -179,9 +179,9 @@ ifupdown_main(int argc, char *argv[])
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (!lif_interface_file_parse(&collection, interfaces_file))
|
||||
if (!lif_interface_file_parse(&collection, exec_opts.interfaces_file))
|
||||
{
|
||||
fprintf(stderr, "%s: could not parse %s\n", argv0, interfaces_file);
|
||||
fprintf(stderr, "%s: could not parse %s\n", argv0, exec_opts.interfaces_file);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ struct lif_execute_opts {
|
|||
bool verbose;
|
||||
bool mock;
|
||||
const char *executor_path;
|
||||
const char *interfaces_file;
|
||||
};
|
||||
|
||||
extern bool lif_execute_fmt(const struct lif_execute_opts *opts, char *const envp[], const char *fmt, ...);
|
||||
|
|
|
@ -233,6 +233,9 @@ lif_lifecycle_run_phase(const struct lif_execute_opts *opts, struct lif_interfac
|
|||
if (opts->verbose)
|
||||
lif_environment_push(&envp, "VERBOSE", "1");
|
||||
|
||||
if (opts->interfaces_file)
|
||||
lif_environment_push(&envp, "INTERFACES_FILE", opts->interfaces_file);
|
||||
|
||||
struct lif_node *iter;
|
||||
bool did_address = false, did_gateway = false;
|
||||
|
||||
|
|
0
tests/executors/static
Normal file → Executable file
0
tests/executors/static
Normal file → Executable file
Loading…
Reference in a new issue