Is there any way to do a multiline regex check for a file in CFEngine? There is no function for searching a file for content. The grep() function operates on lists, not files. However using readfile() and regcmp() I was sill able to search for a multi-line string using only native functionaity In the example below we first create a file with content that spans multiple lines. Then we read that file content into a variable and use a regular expression on the variable content.
If I have a promise with a copy_from promise where the body specifies that permissions should be preserved and I also have a perms body on the same promise what is expected to happen? The files type promises documentation describes the normal order of files promise attributes during promise actuation. The documentation notes: file presence ( create | copy | link ) permissions file content So the explicitly specified permissions should win in the end.
> How can my hosts self organize into different groups? In cfengine 3 select_class can be used for partitioning hosts into separate groups without central coordination. Given the same list of options in the same order each host will always choose the same option. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 bundle agent demo_select_class { vars: "options" slist => { "one", "two" }, meta => { "inventory", "attribute_name=Select Class Options" }; # Prefix the options with "select_class_" as select_class will define # untagged classes that we will use to define a class tagged for # inventory.
It's easy to export an org document to html and get a table of contents, but sometimes it's nice to have a table of contents inside of an org-mode file. The [[https://github.com/snosov1/toc-org][toc-org]] package makes this automatic. Simply tag a headline with :TOC: and the headline will auto fill an index with all following headlines. <img src="" alt="" width="100%"/>
What's the simplest, easiest, no-fuss way to wrap up standalone example? I use ob-cfengine3 with org-mode inside of spacemacs for most of my self contained examples and when I start prototyping new policy. When I have a cfengine3 SRC block and I execute it body file control is magically inserted to load the stdlib. 1 2 3 4 5 6 7 bundle agent main { reports: "$(this.promise_filename):" printfile => cat( $(this.
How can I use set_line_based to manage a space separated file like /etc/services but include more than one space to make the config a bit easier to read. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 bundle agent main { vars: "map[hpss_d_mvr1]" string => "65501/tcp"; # Include padding in the value itself "map[hpss_d_mvr2]" string => " 65503/tcp"; files: "/tmp/services" create => "true"; # Use more than one space in the second field for the minimum number of # spaces between columns "/tmp/services" edit_line => set_line_based( "$(this.
When I first tried using Emacs it was to play with Orgmode. I loved Orgmode but being a staunch vim user I really struggled with the key bindings. Ultimately my first attempt to use Orgmode fell by the wayside. When I learned about evil mode I gave it another go. I stumbled my way through just enough to get evil-mode working and Orgmode became much more usable. I still primarily interacted with Orgmode via direct files.
> How can I make sure a package is always up to date? 1 2 3 4 5 6 7 8 9 10 11 12 bundle agent main { vars: "latest_pkgs" slist => { "singularity", "singularity-devel" }; packages: "$(latest_pkgs)" policy => "present", comment => "Important to automatically track the latest and greatest because ....", version => "latest"; } The packages promise implementation shown above has been available since 3.7.0.
cf-agent -Kf ./example.cf error: readjson: data error parsing JSON file '/tmp/mydata.json': No data error: readjson: data error parsing JSON file '/tmp/mydata.json': No data error: readjson: data error parsing JSON file '/tmp/mydata.json': No data error: readjson: data error parsing JSON file '/tmp/mydata.json': No data error: readjson: data error parsing JSON file '/tmp/mydata.json': No data error: readjson: data error parsing JSON file '/tmp/mydata.json': No data error: readjson: data error parsing JSON file '/tmp/mydata.
When using the acl_method overwrite you must supply user, group, all ( aka other ), and mask for a complete ACL specification. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 bundle agent main { vars: "acl" slist => { "user:*:rwx", # System owner should have read write and execute access "group:*:rw", # System group should have read and write access but not execute "all:r", # All other users should have read access "mask:rwx", # The mask should be read write and execute "user:nickanderson:r", # The user nickanderson should explicitly have read access "user:a10042:---", # The user a10042 should explicitly have no access }; files: "/tmp/acl/dir" acl => posix_acl_default_access( "overwrite", @(acl) ); } body acl posix_acl_default_access( method, rules ) { acl_method => "$(method)"; acl_type => "posix"; acl_default => "access"; aces => { @(acl) }; } We can use getfacl to inspect the permissions are as desired.