This bug has been migrated to another issue tracking site. It has been closed here and may no longer be being monitored.

If you would like to get updates for this issue, or to participate in it, you may do so at Red Hat Issue Tracker .
Bug 2155147 - augeas fails to parse /etc/rsyslog.d/21-cloudinit.conf file
Summary: augeas fails to parse /etc/rsyslog.d/21-cloudinit.conf file
Keywords:
Status: CLOSED MIGRATED
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: augeas
Version: 9.2
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Virtualization Maintenance
QA Contact: YongkuiGuo
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-12-20 07:44 UTC by YongkuiGuo
Modified: 2023-07-07 21:20 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-07-07 21:20:32 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github hercules-team augeas issues 794 0 None open rsyslog: modern name for the discard action ("stop") is not recognized 2022-12-20 11:13:08 UTC
Github hercules-team augeas pull 796 0 None open HACKING.md: describe testing 2022-12-22 09:58:56 UTC
Red Hat Issue Tracker   RHEL-752 0 None None None 2023-07-07 21:20:31 UTC
Red Hat Issue Tracker RHELPLAN-142936 0 None None None 2022-12-20 07:51:38 UTC

Description YongkuiGuo 2022-12-20 07:44:05 UTC
Description of problem:
augeas fails to parse /etc/rsyslog.d/21-cloudinit.conf file after the cloud-init package is installed.

$ cat /etc/rsyslog.d/21-cloudinit.conf
# Log cloudinit generated log messages to file
:syslogtag, isequal, "[CLOUDINIT]" /var/log/cloud-init.log

# comment out the following line to allow CLOUDINIT messages through.
# Doing so means you'll also get CLOUDINIT messages in /var/log/syslog
& stop


Version-Release number of selected component (if applicable):
augeas-1.13.0-3.el9.x86_64
cloud-init-22.1-6.el9.noarch
kernel-5.14.0-217.el9.x86_64


How reproducible:
100%


Steps:

1. On rhel9.2 host (make sure the cloud-init package is installed)
$ augtool print /files/etc/rsyslog.d/21-cloudinit.conf
No output

2.
$ augtool print /augeas//error | grep 21-cloudinit.conf
/augeas/files/etc/rsyslog.d/21-cloudinit.conf/error = "parse_failed"
/augeas/files/etc/rsyslog.d/21-cloudinit.conf/error/pos = "248"
/augeas/files/etc/rsyslog.d/21-cloudinit.conf/error/line = "6"
/augeas/files/etc/rsyslog.d/21-cloudinit.conf/error/char = "0"
/augeas/files/etc/rsyslog.d/21-cloudinit.conf/error/lens = "/usr/share/augeas/lenses/dist/rsyslog.aug:92.10-.43:"
/augeas/files/etc/rsyslog.d/21-cloudinit.conf/error/message = "Get did not match entire input"


Actual results:
As above

Expected results:
augeas can parse /etc/rsyslog.d/21-cloudinit.conf file.

Additional info:

Comment 1 Laszlo Ersek 2022-12-20 10:52:06 UTC
Line 6 is:

& stop

There aren't too many things on this line that augeas could fail to understand.

The ampersand (= legacy action continuation syntax) is not the problem. Refer to RH bug 1660884.

The "stop" action is the problem, instead. What I don't understand is why we see this problem *only now*.

Namely, the discard action used to be called "~" in legacy rsyslog; refer to <https://www.rsyslog.com/doc/master/configuration/actions.html#discard-stop>.

In cloud-init, the "& ~" action was replaced with "& stop" in the following commit:

commit b613de733fa7cfbf94666410f252b640019be205
Author: Joshua Powers <josh.powers>
Date:   Mon Apr 10 16:30:33 2017 -0700

    rsyslog: replace ~ with stop
    
    The discard action (tilde character) has been replaced by the
    “stop” RainerScript directive. It is considered more intuitive and
    offers slightly better performance.
    
    The tilde operator was deprecated in rsyslog 7. Distributions
    using rsyslog older than that will need to patch.
    
    LP: #1367899

Launchpad link: https://bugs.launchpad.net/cloud-init/+bug/1367899

I've now checked augeas @ 4f3bbeb3f782 ("Fix date in %changelog in augeas.spec.in (#790)", 2022-12-07), which is the current HEAD of the master branch. At that stage, the rsyslog lens ("lenses/rsyslog.aug") relies, in part, on the syslog lens ("lenses/syslog.aug") for recognizing actions:

> let action = Syslog.action | omusrmsg | file_tmpl | dynamic | namedpipe

and the syslog lens defines the following actions:

>         let action = (file | loghost | users | logprogram | discard)

where discard is only:

> 	let discard = [ label "discard" . Util.del_str "~" ]

Neither lens recognizes "stop".

Comment 2 Laszlo Ersek 2022-12-20 11:13:09 UTC
Reported upstream issue: https://github.com/hercules-team/augeas/issues/794

Comment 3 YongkuiGuo 2022-12-20 11:24:07 UTC
(In reply to Laszlo Ersek from comment #1)
> Line 6 is:
> 
> & stop
> 
> There aren't too many things on this line that augeas could fail to
> understand.
> 
> The ampersand (= legacy action continuation syntax) is not the problem.
> Refer to RH bug 1660884.
> 
> The "stop" action is the problem, instead. What I don't understand is why we
> see this problem *only now*.

That's because QE usually uses bare metal (reserved from beaker) to run augeas testing, and the cloud-init is not installed by default on bare metal. We can consider running augeas test in the VM on the Cloud platform.

Comment 4 Laszlo Ersek 2022-12-22 08:59:25 UTC
Unfortunately the situation is much worse than I had expected. "stop" cannot easily be recognized as an alternative for the discard action, *plus* the multiple actions parsing from bug 1660884 is buggy: it cannot deal with empty lines and comments.

Comment 5 Laszlo Ersek 2022-12-22 09:47:15 UTC
See more details at <https://github.com/hercules-team/augeas/issues/794#issuecomment-1362627179>.


Note You need to log in before you can comment on or make changes to this bug.