-
Type:
Bug
-
Status: Rejected
-
Priority:
(None)
-
Resolution: Done
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
In the documentation I read that "are available to all promise types":https://docs.cfengine.com/docs/3.6/reference-promise-types.html#common-attributes. Therefore I expected I could use an action attribute to timeout a vars promise that used execresult.
But that doesn't work. In the following piece of policy:
body common control { bundlesequence => { "test" } ; } bundle agent test { vars: "test" string => execresult("/bin/pwd","noshell"), action => if_elapsed("60") ; classes: "var_is_set" expression => isvariable("test") ; reports: var_is_set:: "variable is set to $(test)" ; !var_is_set:: "variable was not set" ; } body action if_elapsed(x) # @brief Evaluate the promise every `x` minutes # @param x The time in minutes between promise evaluations { ifelapsed => "$(x)"; expireafter => "$(x)"; }
the variable is assigned at the first run and the promise is locked for just one minute, not 60:
2015-08-20T19:02:23+0200 verbose: /default/test/reports/'variable is set to /tmp'[0]: XX Nothing promised here [last.test.reports.-murray.variable_is_se] (0/1 minutes elapsed)
and in fact, running the test again after more than one minute works as like the action attribute was not there. Incidentally, that means that any function that spawns a command to set a variable can't be timed out or locked for a certain time using action.
If this is the expected behavior, the bug is in the documentation.
If this is not expected behavior, the bug is in the code.
- relates to
-
CFE-3072 Ability to time out any individual promises
-
- Open
-