Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ jobs:
run: pytest promise-types/ -v
- name: Lint policy with CFEngine CLI
run: cfengine lint --strict no ./
- name: Check formatting with CFEngine CLI
run: cfengine format --check
20 changes: 13 additions & 7 deletions examples/gpg/password-store-sync.cf
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,25 @@ bundle agent main
vars:
# for gpg_keys promise, pass a keylist data similar to this proposed standard with the addition of the `ascii` property
# https://datatracker.ietf.org/doc/draft-mccain-keylist/ (from https://github.com/firstlookmedia/gpgsync project)
# "keylist" data => readjson("/home/user/keylist.json");

# "keylist" data => readjson("/home/user/keylist.json");
# Or assembly the information using some policy data manipulation and jq (https://stedolan.github.io/jq/) magic
"fingerprint_files" slist => findfiles("/home/user/.password-store/.pub-keys/*.fp");
"keys[$(fingerprint_files)][fingerprint]" string => readfile( $(fingerprint_files) );
"keys[$(fingerprint_files)][ascii]" string => readfile( regex_replace( $(fingerprint_files), ".fp$", ".asc", "") );
"fingerprint_files"
slist => findfiles("/home/user/.password-store/.pub-keys/*.fp");

"keys[$(fingerprint_files)][fingerprint]"
string => readfile($(fingerprint_files));

"keys[$(fingerprint_files)][ascii]"
string => readfile(
regex_replace($(fingerprint_files), ".fp$", ".asc", "")
);

"keylist" data => mapdata("json_pipe", '$(def.jq) {"keys":[.[]]}', keys);

git:
"/home/user/.password-store"
repository => "https://github.com/user/my-passwords";

gpg_keys:
"/home/user/.gnupg"
keylist => storejson( @(keylist[0]) );
"/home/user/.gnupg" keylist => storejson(@(keylist[0]));
}
40 changes: 23 additions & 17 deletions examples/rss/rss.cf
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

promise agent rss
{
path => "$(example_rss_promise_common.path)";
Expand All @@ -15,29 +14,36 @@ bundle agent example_rss_promise
# @brief Promise a files content to be the =description= of an item selected from a channel in an RSS feed
{
rss:
"/tmp/ISS-oldest.txt" # Contains Item description
# REPAIRED if content on disk changes
# KEPT if content on disk does not need changed
# NOTKEPT if unable to fetch rss, unable to re-write content
"/tmp/ISS-oldest.txt"
# Contains Item description
# REPAIRED if content on disk changes
# KEPT if content on disk does not need changed
# NOTKEPT if unable to fetch rss, unable to re-write content
# Default to newest
feed => "https://blogs.nasa.gov/stationreport/feed/",
select => "oldest"; # Default to newest
select => "oldest";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems wrong that the formatter threw away this comment?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. It pushed it down to the next block. Curious.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did it? Here it looks to me like it moved it before the feed attribtue

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nickanderson look at the commits, I moved it manually in a separate commit.


"/tmp/ISS-random.txt" # Contains Item description
# REPAIRED if content on disk changes
# KEPT if content on disk does not need changed
# NOTKEPT if unable to fetch rss, unable to re-write content
"/tmp/ISS-random.txt"
# Contains Item description
# REPAIRED if content on disk changes
# KEPT if content on disk does not need changed
# NOTKEPT if unable to fetch rss, unable to re-write content
# Default to newest
feed => "https://blogs.nasa.gov/stationreport/feed/",
select => "random"; # Default to newest
select => "random";

"/tmp/ISS-newest-from-local-file-source.txt" # Contains Item description
# REPAIRED if content on disk changes
# KEPT if content on disk does not need changed
# NOTKEPT if unable to fetch rss, unable to re-write content
"/tmp/ISS-newest-from-local-file-source.txt"
# Contains Item description
# REPAIRED if content on disk changes
# KEPT if content on disk does not need changed
# NOTKEPT if unable to fetch rss, unable to re-write content
# Default to newest
feed => "/tmp/iss.xml",
select => "newest"; # Default to newest
select => "newest";
}

bundle agent __main__
{
methods: "example_rss_promise";
methods:
"example_rss_promise";
}
3 changes: 1 addition & 2 deletions examples/site-up/site_up.cf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@ bundle agent site_up_autorun
"http://172.28.128.10";
"https://cfengine.com/";
"https://cfengine2.com/";
"https://unavailable.com"
skip_ssl_verification => "true";
"https://unavailable.com" skip_ssl_verification => "true";
}
Loading
Loading