Re: regex quirks
"'Vratislav Podzimek' via help-cfengine" <[email protected]>
| Newsgroups | gmane.comp.sysutils.cfengine.general |
|---|---|
| Message-ID | <[email protected]> |
On Wed, 2021-07-28 at 07:29 -0700, Xander Cage wrote: > > hey, > > i'm toying around in making a bundle for crontab editing (add, > modify, remove) and regex is > beginning to bite me. > > i got an "informational" message that my pattern matching skills are > downlevel. > > /var/cfengine/bin/cf-agent -KI -f ./nmon_cron_test.cf > info: Promised replacement '0 0 * * * /usr/bin/nmon -F > /var/log/nmon/`hostname`_`date +'\%y\%m\%d_\%H\%M'`.nmon -s 300 -c > 288 1>/dev/null 2>/dev/null' for pattern '^.*/usr/bin/nmon -F.*$' is > not properly convergent while editing '/var/spool/cron/crontabs/root' > info: Because the regular expression '^.*/usr/bin/nmon -F.*$' > still matches the end-state replacement string '0 0 * * * > /usr/bin/nmon -F /var/log/nmon/`hostname`_`date > +'\%y\%m\%d_\%H\%M'`.nmon -s 300 -c 288 1>/dev/null 2>/dev/null' The 'info' message explains what the problem is -- the anchor regular expression matches the replacement string. That means the promise doesn't converge -- it will make a change every time it is evaluated. That's generally considered a bad pattern in CFEngine (and any engine based on state specification instead of action specification). You can ignore the message or, ideally, change the regex to only match the undesired state. Thanks. -- Vratislav -- 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/f82c407ab99e0f1356fbc14311726ed615d94f84.camel%40northern.tech.
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEENAH7ns+FyuCe6j1XmyV2peQQR/QFAmEJJwUACgkQmyV2peQQ R/SkGQ//Vi10LoXXOlxQCICemDBuYRtcl8Ebv+2mm7WZ3nxQKVavbwT+lEW2UWJC kG2nT0H1UJ+AsfqA26D2gwpxNSRctaXepu3+9Ku6ysFEKJHz+faKLr1WIZLz5ml6 ICuPCi23wGYUOckfUfwGihzSLiX61kBYMrCojufG4y9lT1cib/zJMRmyA5VDRW4h DbOBYNth/xes3L97lyxyOA1U72SoUH50Njd/2RitwefTTnUCsUQbXtLk8kCn6rYQ TdFF9Y4Su8iYBrI2dymCd7XKnTaCQS6v7x8UTJiJRSTx/iHaM4saSB5Wb4u5tvAT HasQMozRl27u9W1z/tORmMYvXVBBCjBvvtqY5cD3o9RR4w1atu9jfPtLeWMjkCHq oRA8MZ//fXzHpzgznrNKl2CcLFI6Xkus/OYjIvGuXt5ziIHQm+vT5VgfcbsDpCQ1 z/mjlcQx3VxPBTkQ/sCC+shj/rg4d2J14gcQP01aDhotAFw7WmxWhD25bZ9e0L4L 6xu8ylFvLTVrtgPkRC3Bv54XzzzT76GrtEV/62x6gPQIfVrFpVTsVMI0An4obmrR HVRkBIRWel7fgJ5dGZ9YDik7RB7X4Kg8bH3/HN4WUyL+YCFkzQ5SgrY9qDU2R+4/ dFdWrU4Wd89PCUtUFyOkYcDH9wZ1aGWh5E/3ewa1X9SVv/2WN98= =Ct/R -----END PGP SIGNATURE-----