Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1534424

Summary: Shellvars lens cannot parse two VAR=value in the same line
Product: Red Hat Enterprise Linux 8 Reporter: yalzhang <yalzhang>
Component: augeasAssignee: Pino Toscano <ptoscano>
Status: CLOSED WONTFIX QA Contact: YongkuiGuo <yoguo>
Severity: low Docs Contact:
Priority: low    
Version: ---CC: dyuan, jsuchane, linl, ptoscano, rjones, xuzhang, yoguo
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-01-08 07:26:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description yalzhang@redhat.com 2018-01-15 08:35:33 UTC
Description of problem:
netcf can not read the config file in special format

Version-Release number of selected component (if applicable):
netcf-libs-0.2.8-4.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Keep the NM as inactive, set the interface down, then edit the config file to with 2 ip addresses with format as below:

#ifdown enp0s25
# cat /etc/sysconfig/network-scripts/ifcfg-enp0s25
NAME="enp0s25"
DEVICE="enp0s25"
ONBOOT=yes
NETBOOT=yes
TYPE=Ethernet
BOOTPROTO="none"
IPADDR="192.168.1.22"
NETMASK="255.255.255.0"
IPADDR1="192.168.1.88"  NETMASK1="255.255.255.0"
GATEWAY="192.168.1.1"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
DHCPV6C="no"

2. set the interface up, it works well

# ifup enp0s25
# echo $?
0
# ip addr | grep enp0s25
2: enp0s25: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    inet 192.168.1.22/24 brd 192.168.1.255 scope global enp0s25
    inet 192.168.1.88/24 brd 192.168.1.255 scope global secondary enp0s25

3. netcf can not read the config file in such format as the "IPADDR1" and "NETMASK" are in the same line

# ncftool list
error: unspecified error
error: errors in loading some config files

# virsh iface-list
error: Failed to list interfaces
error: internal error: failed to get number of host interfaces: unspecified error - errors in loading some config files

# cat /var/log/libvirt/libvirtd.conf | grep error
2018-01-10 08:12:01.715+0000: 22364: error : netcfConnectListAllInterfaces:564 : internal error: failed to get number of host interfaces: unspecified error - errors in loading some config files

4. If the IPADDR1 and NETMASK1 are in seperate lines, it works as expected

# cat /etc/sysconfig/network-scripts/ifcfg-enp0s25
....
IPADDR="192.168.1.22"
NETMASK="255.255.255.0"
IPADDR1="192.168.1.88"  
NETMASK1="255.255.255.0"
GATEWAY="192.168.1.1"
...

# ncftool list 
enp0s25
lo

Actual results:
netcf can not read the config file in special format

Expected results:
netcf work as expected and recognize the settings by keyword, not by line

Additional info:

Comment 3 Laine Stump 2018-07-01 22:57:32 UTC
Pino - I heard you're the new resident augeas expert. netcf is using the augeas lens for reading ifcfg files; how reasonable would it be to modify it to support *reading* (but not writing) two name=value pairs on a line. If it's easy, this could be reassigned to augeas. If not, then I think we should close it as WONTFIX.

Comment 4 Pino Toscano 2018-07-02 11:07:33 UTC
The files in /etc/sysconfig/network-scripts/ifcfg-* are shell scripts indeed, but note that tools like NetworkManager do not support anything than VAR="value" syntax (see nm-settings-ifcfg-rh(5)).  Hence ...

(In reply to yalzhang from comment #0)
> # cat /etc/sysconfig/network-scripts/ifcfg-enp0s25
> NAME="enp0s25"
> DEVICE="enp0s25"
> ONBOOT=yes
> NETBOOT=yes
> TYPE=Ethernet
> BOOTPROTO="none"
> IPADDR="192.168.1.22"
> NETMASK="255.255.255.0"
> IPADDR1="192.168.1.88"  NETMASK1="255.255.255.0"
> GATEWAY="192.168.1.1"
> IPV6INIT="yes"
> IPV6_AUTOCONF="yes"
> DHCPV6C="no"

... I'd say that, while this syntax is "correct" when using ifup/down, it is on the borderline of what these files should be.

(In reply to Laine Stump from comment #3)
> how reasonable would it be to modify it
> to support *reading* (but not writing) two name=value pairs on a line.

Note that for Augeas reading & writing basically are two sides of the same coin -- the catch is turning a configuration file into a parsed tree with the metadata associated to it for things like indentation, etc.
Augeas uses the Shellvars lens to handle /etc/sysconfig/network-scripts/ifcfg-* files (and not only those, see the various "sc_incl" & "incl" at the bottom of 
/usr/share/augeas/lenses/dist/shellvars.aug).

> If it's easy, this could be reassigned to augeas. If not, then I think we
> should close it as WONTFIX.

For now I reassigned this bug to augeas, and reported it upstream:
https://github.com/hercules-team/augeas/issues/571

Comment 5 Pino Toscano 2019-05-17 10:21:25 UTC
Considering that this is a very border case, and not easy to fix in the Shellvars lens, I'm moving this bug to RHEL 8.

Comment 9 RHEL Program Management 2021-01-08 07:26:29 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.