Skip to content

Instantly share code, notes, and snippets.

@nickanderson
nickanderson / example.org
Created August 16, 2022 14:37
Example iterating over list of urls and checking return code of url_get
bundle agent __main__
{
  methods:
      "example_down_detector";
}
bundle agent example_down_detector
{
  vars:

this.promiser does work in files promises. but not necessarily EVERYWHERE, so where it does not work you need to open a ticket. It’s really helpful if you provide standalone examples illustrating specific places it does not work, and better yet if they come in the form of an acceptance test.

bundle agent __main__
{
  files:
    "/tmp/test0.txt" content => "Goodbye";
For me it's harder to read and differentiate the list members from the attributes.
#+begin_src cfengine3 :include-stdlib t :log-level info :exports both
bundle agent __main__
{
vars:
"people"
slist => {
"Obi-Wan Kenobi",
"Luke Skywalker",
@nickanderson
nickanderson / jefe.org
Last active August 2, 2022 23:10
Aborting execution
bundle agent main
{
  methods:
      "One"
        usebundle => test1;
      "Two"
        usebundle => test2;
      "Three"
bundle agent __main__
{
   vars:
     "d" data => '{"vars": { "sendmail": { "milters": { "clamav-milter": { "thing": "value" } }}}}';

    "l" slist => getindices( "d[vars][sendmail][milters]" );
    reports: "$(l)";
@nickanderson
nickanderson / sys.augments
Last active June 8, 2022 15:01
sys.augments data container?
{
"absent": [
"/etc/augment2.json"
],
"failed": [
{
"hash": "12345",
"hash_type": "md5",
"path": "/etc/augment2.json"
}
@nickanderson
nickanderson / org-file-export-subtree-containing-broken-links.org
Last active May 6, 2022 14:54
Example org-mode file trying to export with a subtree where broken links are allowed.
@nickanderson
nickanderson / README.org
Created December 20, 2021 21:05
Access key values in mustache with cfengine with data like { "aliases": "key": "value", "key2": "value2" }
bundle agent __main__
{
  
vars:
    "d" data => '{
"aliases": {
  "alice.alyson": "alice",
@nickanderson
nickanderson / README.org
Created December 20, 2021 20:33
Accessing current iterated dict key name and key values with Mustache in CFEngine
  • @ Renders the currently iterated key
  • . Accesses a value

    So, if you are iterating over the dict aliases which is a dict of dicts:

    {
        "aliases": {
            "key1": {
                "msg": "Hello from 1",
        
@nickanderson
nickanderson / README.org
Created December 10, 2021 16:31
To Sparky (sparkee) on irc.libera.chat

Sparky (Sparkee), irc.libera.chatAPP 10:06 AM

here is the scenario: if a server has both freebsd_12 and freebsd_12_2 classes, for freebsd_12 /etc/ssh/ssh_config is version A, for freebsd_12_2 /etc/ssh/ssh_config is version B on that specific server with matches both classes which etc/ssh/ssh_config will be distributed if I don’t specify freebsd_12.!freebsd_12_2:: like would this be enough https://private.sparky.red?85a67d927d23cc2e#HRUoMYCXRwrerz3WEaAwoq4f5SMW2zphnoyAcGRnTVrb ?

bundle agent __main__