CDIST-TYPE__CHECK_MESSAGES(7)

πŸ’– cdist-type__check_messages β€” the cdist manual, section 7 ✨

okay bestie, gather round, because this one is so handy and also so smol. it's cdist-type__check_messages, living in section 7 of the cdist manual, and it's basically the group-chat moderator of your config management: it watches the messages, and if somebody says the wrong thing, it runs a command. iconic behaviour tbh. πŸ’…


🌸 NAME 🌸

cdist-type__check_messages β€” check messages for a pattern and execute a command on a match. that's it, that's the whole job, and she does it flawlessly. πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so, the whole vibe: this type checks messages for a pattern, and when it finds a match, it executes a command. simple. clean. no notes. 🫢

where this really eats is when you've got a bunch of related types chained together using dependencies, and you want to restart a service if at least one of those types changed something. like, one of your little type babies did a thing, and now the service needs a lil refresh. that's the moment this type shows up. main character energy fr fr. πŸ‘‘

want more tea on messages? go read up on cdist messaging. πŸ“¨

want the full lore on dependencies and the order things run in? that's all in the cdist manifest documentation. πŸ“š


✨ REQUIRED PARAMETERS ✨

these are not optional, bestie. you have to bring both of these to the party or nothing happens. πŸ’€

  • pattern β€” an extended regular expression pattern that gets used for the search. lowkey important detail: it's passed straight to grep -E. so write it like grep -E is reading it, because she is. πŸ”
  • execute β€” the command that gets executed when the pattern matches. the payoff. the moment we've all been waiting for. πŸ”₯

🌈 EXAMPLES 🌈

here's the example, verbatim, because I am not about to mess with a single character of this beauty:

__check_messages munin \
    --pattern '^__(file|link|line)/etc/munin/' \
    --execute 'service munin-node restart'

look at her. watching for any __file, __link or __line type touching /etc/munin/, and the second one of them does, she restarts munin-node. slay. 🧚


πŸ‘‘ AUTHORS πŸ‘‘

Ander Punnar <ander-at-kvlt-dot-ee> β€” yes, keeping the email exactly as written, ander-at-kvlt-dot-ee, no de-obfuscating on my watch. πŸ’œ


πŸŽ€ COPYING πŸŽ€

Copyright (C) 2019 Ander Punnar. You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. periodt. πŸ“œ


ungleich GmbH 2021 🫢


okay so real talk for one sec: this is version 7.0.0, dated Jul 31, 2022, from the cdist project. that's the whole sign-off bestie, no cap. now go restart that service. πŸ’–πŸŒΈβœ¨
πŸ“¦ where this page comes from