Skip to content
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

3.15.x #4400

Closed
wants to merge 735 commits into from
Closed

3.15.x #4400

wants to merge 735 commits into from

Conversation

favoritelotus
Copy link

Hello,

I don't know where to contact developers. So I'm writing about my problem here. Variables and classes are not evaluated in mustache templates from namespaces other than default. For example, I have a policy file for creating autofs map file, which looks as follows:
`body file control
{
namespace => "autofs";
}

bundle agent autofs
{
vars:
linux::
"template" string => "$(default:sys.workdir)/inputs/templates/ws/autofs.mustache";
"hyperbeam_nodes" slist => expandrange("hyper[001-020]", 1);
classes:
linux::
"hyperbeam_workstation" expression => "alm_test";

...
files:
linux::
"/etc/autofs.map"
create => "true",
perms => set_perms("0644"),
edit_template => "$(template)",
handle => "restart_autofs",
template_method => "mustache";
}
And the template file autofs.mustache:{{#classes.hyperbeam_workstation}}
{{#vars.autofs:autofs.hyperbeam_nodes}}
{{.}}
{{/vars.autofs:autofs.hyperbeam_nodes}}
{{/classes.hyperbeam_workstation}}
`
So the class hyperbeam is not triggered form the namespace autofs when cf-agent is running. The variable hyperbeam_nodes is also not expanding from autofs namespace, using the syntax vars.autofs:autofs.hyperbeam_nodes.

I have read the Cfengine documentation and did not find anything about accessing variables and classes from different namespases in mustache templates.

olehermanse and others added 30 commits September 17, 2019 18:06
Changelog: None
Ticket: CFE-2989
Signed-off-by: Ole Herman Schumacher Elgesem <ole@northern.tech>
(cherry picked from commit 6d94290)
Signed-off-by: Ole Herman Schumacher Elgesem <ole@northern.tech>
(cherry picked from commit bf28100)
This mode prints raw strings (with escapes) and jsonified
structs. In the future, it can be used to dump databases
into a portable JSON file, which can be imported on a
different platform. (Where the sizes of structs and
types differ).

Changelog: None
Ticket: None
Signed-off-by: Ole Herman Schumacher Elgesem <ole@northern.tech>
(cherry picked from commit cdf9b81)
Changelog: None
Ticket: CFE-2989
Signed-off-by: Ole Herman Schumacher Elgesem <ole@northern.tech>
(cherry picked from commit 021489e)
Signed-off-by: Ole Herman Schumacher Elgesem <ole@northern.tech>
(cherry picked from commit 1ce77fd)
#3828

Changelog: None
Ticket: CFE-2989
Signed-off-by: Ole Herman Schumacher Elgesem <ole@northern.tech>
(cherry picked from commit df57bde)
3.12.x doesn't have libntech, so I manually added the bits
we need to libutils, since we want to backport changes to
cf-check.

Changelog: None
Ticket: CFE-2989
Signed-off-by: Ole Herman Schumacher Elgesem <ole@northern.tech>
CFE-3140: An ID of rhel in os-release file will now define both rhel and redhat classes (3.12)
cf-check: Improve portability of --no-fork mode (3.12)
CFE-2989: Human readable JSON5 dumping of LMDB databases (3.12)
This may be causing reporting failures in some cases.

Changelog: title
Ticket: ENT-4921
(cherry picked from commit 23c421d)
Previously, the return code from the process_stop command wrongly did not
influence the result of the promise. With this change, when process_stop command
returns zero, the promise will be considered repaired and when process_stop
returns non-zero the promise will be failed/notkept. Additionally, this change
clarifies existing and adds additional log messages.

Ticket: ENT-4988
Changelog: Title
(cherry picked from commit fa4ea6d)
ENT-4988/3.12.x: Fixed promise result when using process_stop in processes type promises
Ticket: CFE-3165
Changelog: None
(cherry picked from commit 84435ac)
(cherry picked from commit 1f6dc86)
…st()

Ticket: CFE-3172
Changelog: None
(cherry picked from commit bf5cc15)
CFE-3165/3.12.x: Added example illustrating function return types
CFE-3172/3.12.x: Separate examples for readstringlist(), readreallist(), nad readintlist()
Ticket: CFE-3171
Changelog: None
(cherry picked from commit 6d8b521)
CFE-3171/3.12.x: Added tests to exercises multiline mode behavior in data_regextract
* `ps -axo`: truncates the ouptut of ps at the width of terminal.
* `ps -axwwo`: displays the full length of the command and args

Without this patch cf-agent --bootstrap fails with 80 column
terminals, and success with wider terminals. Error message:

```
cf-agent[29746]: CFEngine(agent)  Bootstrapping failed, cf-execd is not running
```

From the `man ps` page of NetBSD (https://netbsd.gw.com/cgi-bin/man-cgi?ps+1):

```
     -w           Use 132 columns to display information instead of the
                  default, which is your window size.  If the -w option is
                  specified more than once, ps will use as many columns as
                  necessary without regard to your window size.
```

Reading the ps man page of OpenBSD seems to have the same problem:

https://man.openbsd.org/ps

Changelog: Title
Ticket: None
Signed-off-by: Ole Herman Schumacher Elgesem <ole@northern.tech>
(cherry picked from commit 0ce7132)
(cherry picked from commit 38e1e0c)
Use file.io instead of transfer.sh (3.12)
Fixed bug in ps parsing on OpenBSD / NetBSD causing bootstrap to fail (3.12)
ENT-4921: Removed stime_range and ttime_range constraints from promise hash (3.12)
Instead of relying on them being zeroes. Having random values in
the 'start' and 'len' fields can result in issues.

(cherry picked from commit 697f84c)
It's useful for all the cf-check commands that support options.

(cherry picked from commit ddf7b6c)
All cf-check commands working with LMDB have to deal with its
error codes.

(cherry picked from commit 17075e9)
Try to backup all files and report how many failed to be backed
up.

(cherry picked from commit e636426)
Backing up an LMDB file can be done in two ways:

1) Copy the contents of the LMDB file to a new place.

2) Read the contents of the LMDB file and write them into a new
   LMDB file.

While option 1) copies over all the potential inconsistencies in
the LMDB file, option 2) only copies the readable data and the
new copy should be in a consistent state.

Changelog: --dump option was added to the 'cf-check backup' command
(cherry picked from commit a701645)
'cf-check repair' should try to preserve the data that can be
preserved. So if an LMDB file is corrupted, it should try to read
as much as it can from it and write it into a new file and then
replace the original file with the new copy. Hence
`replicate_lmdb_file()` and then `rename(orig, new_copy)`.

Also, add a new '--force' option to 'cf-check repair' to repair
all the files no matter if they are reported as corrupted or not.

Ticket: CFE-3127
Changelog: 'cf-check repair' now preserves readable data in corrupted LMDB files
(cherry picked from commit 192e930)
vpodzime and others added 26 commits September 25, 2020 09:13
These rules should not be needed because only processes forked
from the agent should access the folder, but pre-evaluation
causes all our processes accessing the folder.

Ticket: CFE-3240
Changelog: AVCs are no longer produced for CFEngine processes accessing /proc/net
(cherry picked from commit a4f3aae)
[3.12.x] Add SELinux rules for accessing /proc/xen
(cherry picked from commit ee1d03f)
(cherry picked from commit 50c8ecd)
ENT-6200 Disable flaky test on whole Solaris and older suse, also - 3.12.x
Adjusted to more reliable list of servers (3.12.x)
Clean cherry-pick from 3.15.x version, inclued both SHAs below,
for reference.

Changelog: None
Ticket: CFE-3470
Signed-off-by: Ole Herman Schumacher Elgesem <ole@northern.tech>
(cherry picked from commit 7af98c4)
(cherry picked from commit 921d4a9)
CFE-3470: Added acceptance test for not() (3.12)
Clean cherry-pick from 3.15.x version, inclued both SHAs below,
for reference.

Changelog: None
Ticket: CFE-3471
Signed-off-by: Ole Herman Schumacher Elgesem <ole@northern.tech>
(cherry picked from commit 324840c)
(cherry picked from commit 43a8b0c)
Did this in separate commit to make review easier.

Clean cherry-pick from 3.15.x version, inclued both SHAs below,
for reference.

Changelog: None
Ticket: CFE-3471
Signed-off-by: Ole Herman Schumacher Elgesem <ole@northern.tech>
(cherry picked from commit 1903f45)
(cherry picked from commit 1d4d8f6)
Clean cherry-pick from 3.15.x version, inclued both SHAs below,
for reference.

Changelog: None
Ticket: CFE-3471
Signed-off-by: Ole Herman Schumacher Elgesem <ole@northern.tech>
(cherry picked from commit 1a5a400)
(cherry picked from commit 64d2c16)
CFE-3471: Extensive test of or() function (3.12)
CFE-3471: Extensive test of and() function (3.12)
Ticket: CFE-3456
Changelog: None
(cherry picked from commit a38cc4f)

Conflicts:
  cf-check/cf-check.c
Ticket: CFE-3456
Changelog: None
(cherry picked from commit 382e554)
Ticket: CFE-3456
Changelog: None
(cherry picked from commit 531003c)
Ticket: CFE-3456
Changelog: None
(cherry picked from commit f8bee03)
Ticket: CFE-3456
Changelog: None
(cherry picked from commit eb27cec)
Ticket: CFE-3456
Changelog: None
(cherry picked from commit f6983f1)
Ticket: CFE-3456
Changelog: None
(cherry picked from commit b85afcd)
Ticket: CFE-3456
Changelog: None
(cherry picked from commit ea83b0d)
[3.12.x] Call cleanup functions in binaries' main()
Signed-off-by: Ole Herman Schumacher Elgesem <ole@northern.tech>
@nickanderson
Copy link
Member

Hi @favoritelotus

The best place to report issues is in the CFE project on tracker.mender.io.
This is mentioned in the contributing guidelines doc here

I copied this comment into a new ticket: https://tracker.mender.io/browse/CFE-3497

@nickanderson
Copy link
Member

Hi @favoritelotus, FYI, it's working for me to render using non default namespace classes and variables, see the ticket for an example.

@favoritelotus
Copy link
Author

favoritelotus commented Nov 19, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
9 participants