diff options
author | slioch <slioch@eng-140.vyatta.com> | 2009-02-27 11:45:47 -0800 |
---|---|---|
committer | slioch <slioch@eng-140.vyatta.com> | 2009-02-27 11:45:47 -0800 |
commit | f0c5876c1203da45081d588fa2daf6b034281cba (patch) | |
tree | e22309e85459e9fa7300316fde978718478fc4cd /src/commit2.c | |
parent | 724b5f960353937d52b2fdcabfb6f011bea1446d (diff) | |
download | vyatta-cfg-f0c5876c1203da45081d588fa2daf6b034281cba.tar.gz vyatta-cfg-f0c5876c1203da45081d588fa2daf6b034281cba.zip |
Added environment variable that can be accessed in executing node.def script to check whether commit is in a delete or set action. The environmental variable is
"COMMIT_ACTION" the value can either be "SET" or "DELETE". The variable is set for the duration of the call being made to the action in the node.def file.
This should allow some simplication of scripts (i.e. such as setting up static routes).
Diffstat (limited to 'src/commit2.c')
-rw-r--r-- | src/commit2.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/commit2.c b/src/commit2.c index 871c085..4c0c342 100644 --- a/src/commit2.c +++ b/src/commit2.c @@ -334,13 +334,19 @@ process_func(GNode *node, gpointer data) fprintf(out_stream,"[START] %lu, %s@%s",(unsigned long)t.tv_sec,ActionNames[result->_action],d->_path); } + if (result->_action == delete_act) { + setenv(ENV_ACTION_NAME,ENV_ACTION_DELETE,1); set_in_delete_action(TRUE); } + else { + setenv(ENV_ACTION_NAME,ENV_ACTION_SET,1); + } status = execute_list(c->_def.actions[result->_action].vtw_list_head,&c->_def); if (result->_action == delete_act) { set_in_delete_action(FALSE); } + unsetenv(ENV_ACTION_NAME); if (g_coverage) { struct timeval t; |