Re: Re: abort_bundle_classe are not working...somwhat
Xander Cage <[email protected]> Tue, 30 Jul 2024 22:33:03 -0700 (PDT)
| Newsgroups | gmane.comp.sysutils.cfengine.general |
|---|---|
| Message-ID | <[email protected]> |
i fired up your test policy, and no parsing errors are emited. hmm... the only difference i can imagine is that i am using autorun in production...maybe the errors are connectd to the autorun facility? had other problems with autrorun in the past (policy syntax check not working as expected for example) On Tuesday, July 30, 2024 at 5:31:06 PM UTC+2 [email protected] wrote: > Hey there, > > I tried to make a self-contained example to try this out and am not having > any troubles with parsing either with 3.21.5 or latest master (3.25.0a). > > Maybe you could send a complete verbose log of the smallest reproducer you > can manage to the ticket? > https://northerntech.atlassian.net/browse/CFE-3411 > > --- > > Here is my def.json, notice I removed some trailing commas you had. > Probably not an issue but might be worth fixing. I used `jq` to validate it. > > { > > "variables": { > > "default:def.control_agent_abortclasses": { > > "value": [ > > "abort_.*" > > ] > > }, > > "default:def.control_agent_abortbundleclasses": { > > "value": [ > > "bundle_abort_.*" > > ] > > } > > } > > } > > > the self contained policy: > > bundle common def > > { > > vars: > > "control_agent_abortclasses" > > slist => {}, > > if => not( isvariable( "default:def.control_agent_abortclasses" )); > > "control_agent_abortbundleclasses" > > slist => { "abortbundle" }, > > if => not( isvariable( > "default:def.control_agent_abortbundleclasses" )); > > classes: > > "full_name_exists" expression => > isvariable("default:def.control_agent_abortclasses"); > > "short_name_exists" expression => > isvariable("control_agent_abortclasses"); > > } > > > body agent control > > { > > abortclasses => { @(def.control_agent_abortclasses) }; > > > abortbundleclasses => { @(def.control_agent_abortbundleclasses) }; > > } > > > bundle agent main > > { > > reports: "hi"; > > "default:def.control_agent_abortclasses is > $(default:def.control_agent_abortclasses)"; > > "default:def.control_agent_abortbundleclasses is > $(default:def.control_agent_abortbundleclasses)"; > > default:full_name_exists:: > > "default:def.control_agent_abortclasses is a variable in the > context of default:def bundle"; > > default:short_name_exists:: > > "control_agent_abortclasses is a variable in the context of > default:def bundle"; > > } > > and the output: > > cf-agent -KIf ./t.cf > > R: hi > > R: default:def.control_agent_abortclasses is abort_.* > > R: default:def.control_agent_abortbundleclasses is bundle_abort_.* > > R: default:def.control_agent_abortclasses is a variable in the context of > default:def bundle > > R: control_agent_abortclasses is a variable in the context of default:def > bundle > > > And I don't see any parse errors in verbose output: > > > verbose: Setting abort classes from ... > > verbose: Setting abort bundle classes from ... > > verbose: ---------------------------------------------------------------- > > verbose: Begin policy/promise evaluation > > verbose: ---------------------------------------------------------------- > On Tuesday, July 30, 2024 at 7:38:55 AM UTC-5 Xander Cage wrote: > >> i tested with 3.21.5... >> >> abort and abortbundleclasses defined in augments... >> >> "variables": { >> >> "default:def.control_agent_abortclasses": { >> "value": [ >> "abort_.*" >> ], >> } >> >> "default:def.control_agent_abortbundleclasses": { >> "value": [ >> "bundle_abort_.*" >> ], >> } >> } >> >> still parsing errros... >> >> root@aixtest01: /var/cfengine/inputs # /var/cfengine/bin/cf-agent -KIv | >> grep abort >> verbose: Installing augments slist variable >> 'default:def.control_agent_abortclasses' from file >> '/var/cfengine/inputs/def.json' >> verbose: Installing augments slist variable >> 'default:def.control_agent_abortbundleclasses' from file >> '/var/cfengine/inputs/def.json' >> verbose: Skipping promise 'control_agent_abortclasses' because >> constraint 'if => not(isvariable("$(this.promiser)"))' is not met >> verbose: Skipping promise 'control_agent_abortbundleclasses' because >> constraint 'if => not(isvariable("$(this.promiser)"))' is not met >> verbose: Skipping promise 'control_agent_abortclasses' because >> constraint 'if => not(isvariable("$(this.promiser)"))' is not met >> verbose: Skipping promise 'control_agent_abortbundleclasses' because >> constraint 'if => not(isvariable("$(this.promiser)"))' is not met >> verbose: Skipping promise 'control_agent_abortclasses' because >> constraint 'if => not(isvariable("$(this.promiser)"))' is not met >> verbose: Skipping promise 'control_agent_abortbundleclasses' because >> constraint 'if => not(isvariable("$(this.promiser)"))' is not met >> verbose: Skipping promise 'control_agent_abortclasses' because >> constraint 'if => not(isvariable("$(this.promiser)"))' is not met >> verbose: Skipping promise 'control_agent_abortbundleclasses' because >> constraint 'if => not(isvariable("$(this.promiser)"))' is not met >> verbose: Skipping promise 'control_agent_abortclasses' because >> constraint 'if => not(isvariable("$(this.promiser)"))' is not met >> verbose: Skipping promise 'control_agent_abortbundleclasses' because >> constraint 'if => not(isvariable("$(this.promiser)"))' is not met >> >> verbose: Setting abort classes from ... >> verbose: Setting abort bundle classes from ... >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> error: Unable to parse class expression 'bundle_abort_.*' >> >> >> as mentioned numerious time..this only occurs when the abortclasses are >> defined in augments... >> >> when defining it in policy no error are emitted... >> >> body agent control >> { >> # List of regular expressions to match classes. When the class is >> found to >> # be defined, the agent will abort execution of the bundle. >> # >> https://docs.cfengine.com/docs/master/reference-components-cf-agent.html#abortbundleclasses >> >> # BUG: aborbundleclasses errors with regular expressions, wrongly. >> # "abort_bundle_sys_host_not_match_sys_uqhost" >> abortbundleclasses => { "abort_bundle.*" }; >> } >> bundle agent __main__ >> { >> >> methods: >> "bundle1"; >> "bundle2"; >> >> reports: >> "CFEngine: $(sys.cf_version)"; >> } >> bundle agent bundle1 >> { >> >> classes: >> "abort_bundle_sys_fqhost_matches_sys_uqhost" >> expression => strcmp( $(sys.fqhost), $(sys.uqhost) ); >> >> methods: # More bundles, they wont be called because it aborts ... >> reports: "$(this.bundle) here!"; >> } >> bundle agent bundle1_1 >> { >> >> reports: "$(this.bundle) here!"; >> } >> bundle agent bundle2 >> { >> >> classes: >> >> reports: "$(this.bundle) here!"; >> } >> >> : >> >> On Friday, September 11, 2020 at 3:38:52 PM UTC+2 [email protected] >> wrote: >> >>> Yes, I encountered the same error yesterday. If you use specific classes >>> and not regular expressions it should work without emitting the errors >>> about being unable to parse the class expression. >>> >>> I filed an issue for it yesterday: >>> https://tracker.mender.io/browse/CFE-3411 >>> >>> On Friday, September 11, 2020 at 6:56:37 AM UTC-5 Xander Cage wrote: >>> >>>> i noticed one more little thing..since upgrade to the new mpf version >>>> this error is printed. it >>>> >>>> verbose: C: BEGIN classes / conditions (pass 1) >>>> >>>> error: Unable to parse class expression 'ITSV_BUNDLE_ABORT.*' >>>> verbose: C: + Private class: percent_of_runs >>>> error: Unable to parse class expression 'ITSV_BUNDLE_ABORT.*' >>>> >>>> verbose: V: Computing value of 'tags' >>>> verbose: A: Promise was KEPT >>>> verbose: P: END meta promise (tags) >>>> >>>> >>>> first i thouhgt this is caused by the downlevel binary, but 3.12.5 >>>> makes no difference. seems that the wildcard class expression in def.json >>>> is not playing very well. ('ITSV_BUNDLE_ABORT.*') >>>> >>>> On Friday, September 11, 2020 at 1:13:07 PM UTC+2, Xander Cage wrote: >>>>> >>>>> hi nick, >>>>> >>>>> you are absolutley right, after upgrading mpf to 3.12.5 everything >>>>> works fine... >>>>> >>>>> verbose: >>>>> ---------------------------------------------------------------- >>>>> verbose: Begin policy/promise evaluation >>>>> verbose: >>>>> ---------------------------------------------------------------- >>>>> info: Using command line specified bundlesequence >>>>> verbose: Using bundlesequence => {"b0040abort_test"} >>>>> verbose: B: >>>>> ***************************************************************** >>>>> verbose: B: BEGIN bundle b0040abort_test >>>>> verbose: B: >>>>> ***************************************************************** >>>>> verbose: V: Computing value of 'tags' >>>>> verbose: A: Promise was KEPT >>>>> verbose: P: END meta promise (tags) >>>>> verbose: V: ......................................................... >>>>> verbose: V: BEGIN variables (pass 1) >>>>> verbose: V: Computing value of 'userlist' >>>>> verbose: C: ......................................................... >>>>> verbose: C: BEGIN classes / conditions (pass 1) >>>>> verbose: C: + Private class: ITSV_BUNDLE_ABORT_INVALID_USER >>>>> error: Bundle 'b0040abort_test' aborted on defined class >>>>> 'ITSV_BUNDLE_ABORT_INVALID_USER' >>>>> verbose: A: ................................................... >>>>> verbose: A: Bundle Accounting Summary for 'b0040abort_test' in >>>>> namespace default >>>>> verbose: A: Promises kept in 'b0040abort_test' = 2 >>>>> verbose: A: Promises not kept in 'b0040abort_test' = 0 >>>>> verbose: A: Promises repaired in 'b0040abort_test' = 0 >>>>> verbose: A: Aggregate compliance (promises kept/repaired) for bundle >>>>> 'b0040abort_test' = 100.0% >>>>> verbose: A: ................................................... >>>>> verbose: B: >>>>> ***************************************************************** >>>>> verbose: B: END bundle b0040abort_test >>>>> verbose: B: >>>>> ***************************************************************** >>>>> verbose: No lock purging scheduled >>>>> verbose: Logging total compliance, total 'Outcome of version >>>>> CFEngine Promises.cf 3.12.5 (agent-0): Promises observed to be kept >>>>> 100.00%, Promises repaired 0.00%, Promises not repaired 0.00%' >>>>> >>>>> >>>>> thank you... >>>>> >>>>> chris >>>>> >>>>> >>>>> On Thursday, September 10, 2020 at 6:52:14 PM UTC+2, Nick Anderson >>>>> wrote: >>>>>> >>>>>> Xander Cage writes: >>>>>> >>>>>> i tested with an example policy, to reduce clutter… still no bundle >>>>>>> abort… >>>>>>> >>>>>> Hi Christian, >>>>>> >>>>>> From your original post, I can see that you are running 3.12.2. >>>>>> >>>>>> verbose: Logging total compliance, total 'Outcome of version CFEngine Promises.cf 3.12.2 (agent-0): Promises observed to be kept 100.00%, Promises repaired 0.00%, Promises not repaired 0.00%' >>>>>> >>>>>> Are you running the MPF from 3.12.2 as well? >>>>>> >>>>>> I see that augments support for abortbundleclasses and abortclasses >>>>>> were added in 3.12.3. >>>>>> https://github.com/cfengine/masterfiles/commit/e2c4c1c57e51edcb46e80aa906048daea0b75192 >>>>>> >>>>>> What if you pull in controls/cf_agent.cf and controls/def.cf from >>>>>> 3.12.3? >>>>>> >>>>>> >>>>>> https://github.com/cfengine/masterfiles/blob/3.12.3/controls/cf_agent.cf >>>>>> https://github.com/cfengine/masterfiles/blob/3.12.3/controls/def.cf >>>>>> >>>>>> Does it work then? >>>>>> >>>>>> – Nick Anderson | Doer of Things | (+1) 785-550-1767 >>>>>> <(785)%20550-1767> | https://northern.tech >>>>>> >>>>> -- You received this message because you are subscribed to the Google Groups "help-cfengine" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/help-cfengine/3cb24bc8-a818-47c0-a537-1e63b5d7138dn%40googlegroups.com.