Merge pull request #67 from ifupdown-ng/feature/create-destroy

create/destroy phases for interfaces
This commit is contained in:
Ariadne Conill 2020-09-09 14:41:52 -06:00 committed by GitHub
commit bdc66bcba9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View file

@ -12,7 +12,7 @@ protocol documented in this man page.
# PHASES
Executors are run to react to seven different phases and are not
Executors are run to react to nine different phases and are not
required to take any specific action. These phases are:
*depend*
@ -24,6 +24,10 @@ required to take any specific action. These phases are:
any dependencies, it may simply exit 0 without doing
anything.
*create*
Called before *pre-up*, to explicitly allow for interface
creation if necessary.
*pre-up*
Called before the interface is going to be brought up.
@ -42,6 +46,10 @@ required to take any specific action. These phases are:
*post-down*
Called after the interface was successfully taken down.
*destroy*
Called after *post-down* to allow for explicitly
destroying an interface if necessary.
# ENVIRONMENT
Executors are guaranteed to run with a core set of environment

View file

@ -352,6 +352,9 @@ lif_lifecycle_run(const struct lif_execute_opts *opts, struct lif_interface *ifa
* but, right now neither debian ifupdown or busybox ifupdown do any recovery,
* so we wont right now.
*/
if (!lif_lifecycle_run_phase(opts, iface, "create", lifname, up))
return false;
if (!lif_lifecycle_run_phase(opts, iface, "pre-up", lifname, up))
return false;
@ -376,6 +379,9 @@ lif_lifecycle_run(const struct lif_execute_opts *opts, struct lif_interface *ifa
if (!lif_lifecycle_run_phase(opts, iface, "post-down", lifname, up))
return false;
if (!lif_lifecycle_run_phase(opts, iface, "destroy", lifname, up))
return false;
/* when going up, dependents go down last. */
if (!handle_dependents(opts, iface, collection, state, up))
return false;