-
Notifications
You must be signed in to change notification settings - Fork 200
cfengine format ./examples/ #6204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+6,590
−10,614
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,59 +1,43 @@ | ||
| # Copyright 2021 Northern.tech AS | ||
|
|
||
| # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. | ||
|
|
||
| # This program is free software; you can redistribute it and/or modify it | ||
| # under the terms of the GNU General Public License as published by the | ||
| # Free Software Foundation; version 3. | ||
|
|
||
| # This program is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU General Public License for more details. | ||
|
|
||
| # You should have received a copy of the GNU General Public License | ||
| # along with this program; if not, write to the Free Software | ||
| # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA | ||
|
|
||
| # To the extent this program is licensed as part of the Enterprise | ||
| # versions of Cfengine, the applicable Commercial Open Source License | ||
| # (COSL) may apply to this file if you as a licensee so wish it. See | ||
| # included file COSL.txt. | ||
|
|
||
| #[%+%] | ||
| body common control | ||
|
|
||
| { | ||
| bundlesequence => { "example" }; | ||
| bundlesequence => { "example" }; | ||
| } | ||
|
|
||
| body agent control | ||
|
|
||
| { | ||
| abortbundleclasses => { "invalid" }; | ||
| abortbundleclasses => { "invalid" }; | ||
| } | ||
| #[%-%] | ||
|
|
||
| #[%-%] | ||
| ########################################### | ||
| #[%+%] | ||
|
|
||
| bundle agent example | ||
|
|
||
| { | ||
| vars: | ||
|
|
||
| #"userlist" slist => { "mark", "john" }; # contains all valid entries | ||
| "userlist" slist => { "mark", "john", "thomas" }; # contains one invalid entry | ||
|
|
||
| #"userlist" slist => { "mark", "john" }; # contains all valid entries | ||
| "userlist" slist => { "mark", "john", "thomas" }; # contains one invalid entry | ||
| classes: | ||
|
|
||
| "invalid" not => regcmp("[a-z][a-z][a-z][a-z]","$(userlist)"); # The class 'invalid' is set if the user name does not | ||
| # contain exactly four un-capitalized letters (bundle | ||
| # execution will be aborted if set) | ||
|
|
||
| "invalid" not => regcmp("[a-z][a-z][a-z][a-z]", "$(userlist)"); # The class 'invalid' is set if the user name does not | ||
| # contain exactly four un-capitalized letters (bundle | ||
| # execution will be aborted if set) | ||
| reports: | ||
|
|
||
| !invalid:: | ||
|
|
||
| "User name $(userlist) is valid at 4 letters"; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,51 +1,33 @@ | ||
| # Copyright 2021 Northern.tech AS | ||
|
|
||
| # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. | ||
|
|
||
| # This program is free software; you can redistribute it and/or modify it | ||
| # under the terms of the GNU General Public License as published by the | ||
| # Free Software Foundation; version 3. | ||
|
|
||
| # This program is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU General Public License for more details. | ||
|
|
||
| # You should have received a copy of the GNU General Public License | ||
| # along with this program; if not, write to the Free Software | ||
| # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA | ||
|
|
||
| # To the extent this program is licensed as part of the Enterprise | ||
| # versions of Cfengine, the applicable Commercial Open Source License | ||
| # (COSL) may apply to this file if you as a licensee so wish it. See | ||
| # included file COSL.txt. | ||
|
|
||
| # | ||
| # Show the definition of classes by comparing timestamps | ||
| # | ||
|
|
||
| body common control | ||
|
|
||
| { | ||
| bundlesequence => { "example" }; | ||
| bundlesequence => { "example" }; | ||
| } | ||
|
|
||
| ########################################################### | ||
|
|
||
| bundle agent example | ||
|
|
||
| { | ||
| { | ||
| classes: | ||
|
|
||
| "do_it" and => { | ||
| accessedbefore("/tmp/earlier","/tmp/later") | ||
| }; | ||
| "do_it" and => { accessedbefore("/tmp/earlier", "/tmp/later") }; | ||
|
|
||
| reports: | ||
|
|
||
| do_it:: | ||
|
|
||
| "The earlier file has been accessed before the later"; | ||
|
|
||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,71 +1,54 @@ | ||
| # Copyright 2021 Northern.tech AS | ||
|
|
||
| # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. | ||
|
|
||
| # This program is free software; you can redistribute it and/or modify it | ||
| # under the terms of the GNU General Public License as published by the | ||
| # Free Software Foundation; version 3. | ||
|
|
||
| # This program is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU General Public License for more details. | ||
|
|
||
| # You should have received a copy of the GNU General Public License | ||
| # along with this program; if not, write to the Free Software | ||
| # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA | ||
|
|
||
| # To the extent this program is licensed as part of the Enterprise | ||
| # versions of Cfengine, the applicable Commercial Open Source License | ||
| # (COSL) may apply to this file if you as a licensee so wish it. See | ||
| # included file COSL.txt. | ||
|
|
||
| ######################################################## | ||
| # | ||
| # Simple test processes | ||
| # | ||
| ######################################################## | ||
|
|
||
| body common control | ||
|
|
||
| { | ||
| bundlesequence => { "example" }; | ||
| bundlesequence => { "example" }; | ||
| } | ||
|
|
||
| ######################################################## | ||
|
|
||
| bundle agent example | ||
|
|
||
| { | ||
| processes: | ||
|
|
||
| ".*" | ||
|
|
||
| process_count => anyprocs, | ||
| process_select => proc_finder; | ||
| ".*" | ||
| process_count => anyprocs, | ||
| process_select => proc_finder; | ||
|
|
||
| reports: | ||
|
|
||
| any_procs:: | ||
|
|
||
| "Found processes in range"; | ||
| } | ||
|
|
||
| ######################################################## | ||
|
|
||
| body process_select proc_finder | ||
|
|
||
| { | ||
| ttime_range => irange(accumulated(0,0,0,0,2,0),accumulated(0,0,0,0,20,0)); | ||
| process_result => "ttime"; | ||
| ttime_range => irange( | ||
| accumulated(0, 0, 0, 0, 2, 0), accumulated(0, 0, 0, 0, 20, 0) | ||
| ); | ||
| process_result => "ttime"; | ||
| } | ||
|
|
||
| ######################################################## | ||
|
|
||
| body process_count anyprocs | ||
|
|
||
| { | ||
| match_range => "0,0"; | ||
| out_of_range_define => { "any_procs" }; | ||
| match_range => "0,0"; | ||
| out_of_range_define => { "any_procs" }; | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,70 +1,55 @@ | ||
| # Copyright 2021 Northern.tech AS | ||
|
|
||
| # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. | ||
|
|
||
| # This program is free software; you can redistribute it and/or modify it | ||
| # under the terms of the GNU General Public License as published by the | ||
| # Free Software Foundation; version 3. | ||
|
|
||
| # This program is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU General Public License for more details. | ||
|
|
||
| # You should have received a copy of the GNU General Public License | ||
| # along with this program; if not, write to the Free Software | ||
| # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA | ||
|
|
||
| # To the extent this program is licensed as part of the Enterprise | ||
| # versions of Cfengine, the applicable Commercial Open Source License | ||
| # (COSL) may apply to this file if you as a licensee so wish it. See | ||
| # included file COSL.txt. | ||
|
|
||
|
|
||
| body common control | ||
| { | ||
| bundlesequence => { "acls" }; | ||
| bundlesequence => { "acls" }; | ||
| } | ||
|
|
||
| ######################################### | ||
|
|
||
| bundle agent acls | ||
|
|
||
| { | ||
| files: | ||
|
|
||
| "/media/flash/acl/test_dir" | ||
|
|
||
| "/media/flash/acl/test_dir" | ||
| depth_search => include_base, | ||
| acl => template; | ||
| } | ||
|
|
||
| ######################################### | ||
|
|
||
| body acl template | ||
|
|
||
| { | ||
| acl_method => "overwrite"; | ||
| acl_type => "posix"; | ||
| acl_default => "access"; | ||
| aces => { "user:*:r(wwx),-r:allow", "group:*:+rw:allow", "mask:x:allow", "all:r"}; | ||
| acl_method => "overwrite"; | ||
| acl_type => "posix"; | ||
| acl_default => "access"; | ||
| aces => { | ||
| "user:*:r(wwx),-r:allow", "group:*:+rw:allow", "mask:x:allow", "all:r" | ||
| }; | ||
| } | ||
|
|
||
| ######################################### | ||
|
|
||
| body acl win | ||
|
|
||
| { | ||
| acl_method => "overwrite"; | ||
| acl_type => "ntfs"; | ||
| acl_default => "nochange"; | ||
| aces => { "user:Administrator:rw", "group:Bad:rwx(Dpo):deny" }; | ||
| acl_method => "overwrite"; | ||
| acl_type => "ntfs"; | ||
| acl_default => "nochange"; | ||
| aces => { "user:Administrator:rw", "group:Bad:rwx(Dpo):deny" }; | ||
| } | ||
|
|
||
| ######################################### | ||
|
|
||
| body depth_search include_base | ||
|
|
||
| { | ||
| include_basedir => "true"; | ||
| include_basedir => "true"; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,57 +1,42 @@ | ||
| # Copyright 2021 Northern.tech AS | ||
|
|
||
| # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. | ||
|
|
||
| # This program is free software; you can redistribute it and/or modify it | ||
| # under the terms of the GNU General Public License as published by the | ||
| # Free Software Foundation; version 3. | ||
|
|
||
| # This program is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU General Public License for more details. | ||
|
|
||
| # You should have received a copy of the GNU General Public License | ||
| # along with this program; if not, write to the Free Software | ||
| # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA | ||
|
|
||
| # To the extent this program is licensed as part of the Enterprise | ||
| # versions of Cfengine, the applicable Commercial Open Source License | ||
| # (COSL) may apply to this file if you as a licensee so wish it. See | ||
| # included file COSL.txt. | ||
|
|
||
|
|
||
| body common control | ||
| { | ||
| bundlesequence => { "acls" }; | ||
| bundlesequence => { "acls" }; | ||
| } | ||
|
|
||
| ######################################### | ||
|
|
||
| bundle agent acls | ||
|
|
||
| { | ||
| files: | ||
|
|
||
| "/media/flash/acl/test_dir" | ||
|
|
||
| "/media/flash/acl/test_dir" | ||
| depth_search => include_base, | ||
| acl => test; | ||
| } | ||
|
|
||
| ######################################### | ||
|
|
||
| body acl test | ||
|
|
||
| { | ||
| acl_type => "generic"; | ||
| aces => {"user:bob:rwx", "group:staff:rx", "all:r"}; | ||
| acl_type => "generic"; | ||
| aces => { "user:bob:rwx", "group:staff:rx", "all:r" }; | ||
| } | ||
|
|
||
| ######################################### | ||
|
|
||
| body depth_search include_base | ||
|
|
||
| { | ||
| include_basedir => "true"; | ||
| include_basedir => "true"; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.