ClusterLabs / resource-agents

Combined repository of OCF agents from the RHCS and Linux-HA projects
GNU General Public License v2.0
489 stars 577 forks source link

Low: IPaddr2: Remove stray backslash #1904

Closed nrwahl2 closed 6 months ago

nrwahl2 commented 7 months ago

Fixes this warning (which gets logged on every recurring monitor for a Pacemaker resource):

$ OCF_ROOT=/usr/lib/ocf OCF_RESKEY_ip=192.168.22.41     \
        /usr/lib/ocf/resource.d/heartbeat/IPaddr2 monitor
grep: warning: stray \ before white space
knet-jenkins[bot] commented 7 months ago

Can one of the admins check and authorise this run please: https://ci.kronosnet.org/job/resource-agents/job/resource-agents-pipeline/job/PR-1904/1/input

HideoYamauchi commented 7 months ago

Hi Reid,

I checked on RHEL9.2, but no relevant warnings were issued. Is it a distribution dependent fix?

[root@rh92-01 ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux release 9.2 (Plow)

[root@rh92-01 ~]# ip a | grep 192.168.201
    inet 192.168.201.2/24 brd 192.168.201.255 scope global noprefixroute eno6
    inet 192.168.201.5/24 brd 192.168.201.255 scope global secondary eno6
[root@rh92-01 ~]# OCF_ROOT=/usr/lib/ocf OCF_RESKEY_ip=192.168.201.6 /usr/lib/ocf/resource.d/heartbeat/IPaddr2 monitor
[root@rh92-01 ~]# OCF_ROOT=/usr/lib/ocf OCF_RESKEY_ip=192.168.201.5 /usr/lib/ocf/resource.d/heartbeat/IPaddr2 monitor

Best Regards, Hideo Yamauchi.

nrwahl2 commented 7 months ago

I checked on RHEL9.2, but no relevant warnings were issued. Is it a distribution dependent fix?

I'm on Fedora 39, so that warning is probably issued under a newer grep.

HideoYamauchi commented 7 months ago

Hi Reid,

I checked on RHEL9.2, but no relevant warnings were issued. Is it a distribution dependent fix?

I'm on Fedora 39, so that warning is probably issued under a newer grep.

Okay!

I haven't looked into the processing of IPaddr2 in detail, but the result of find_interface will be different after this modification is applied. Is there no problem?

----
find_interface() {
(snip)
        ocf_log info "#### YAMAUCHI #### find_interface()"
        local iface="`$IP2UTIL -o -f $FAMILY addr show \
#               | grep "\ $ipaddr/$netmask" \
                | grep " $ipaddr/$netmask" \
                | cut -d ' ' -f2 \
                | grep -v '^ipsec[0-9][0-9]*$'`"

        echo "$iface"
        ocf_log info "#### YAMAUCHI #### $iface"
(snip)
----
(Change before)
[root@rh92-01 ~]# OCF_ROOT=/usr/lib/ocf OCF_RESKEY_ip=192.168.201.5 /usr/lib/ocf/resource.d/heartbeat/IPaddr2 monitor
INFO: #### YAMAUCHI #### find_interface()
INFO: #### YAMAUCHI #### 5: eno6    inet 192.168.201.5/24 brd 192.168.201.255 scope global secondary eno6\       valid_lft forever preferred_lft forever

(After change)
[root@rh92-01 ~]# OCF_ROOT=/usr/lib/ocf OCF_RESKEY_ip=192.168.201.5 /usr/lib/ocf/resource.d/heartbeat/IPaddr2 monitor
INFO: #### YAMAUCHI #### find_interface()
INFO: #### YAMAUCHI #### 1: lo    inet 127.0.0.1/8 scope host lo\       valid_lft forever preferred_lft forever
3: ens2f1    inet 192.168.102.2/24 brd 192.168.102.255 scope global noprefixroute ens2f1\       valid_lft forever preferred_lft forever
4: eno5    inet 192.168.202.2/24 brd 192.168.202.255 scope global noprefixroute eno5\       valid_lft forever preferred_lft forever
5: eno6    inet 192.168.201.2/24 brd 192.168.201.255 scope global noprefixroute eno6\       valid_lft forever preferred_lft forever
5: eno6    inet 192.168.201.5/24 brd 192.168.201.255 scope global secondary eno6\       valid_lft forever preferred_lft forever
6: eno7    inet 192.168.101.2/24 brd 192.168.101.255 scope global noprefixroute eno7\       valid_lft forever preferred_lft forever
7: eno8    inet 192.168.28.2/24 brd 192.168.28.255 scope global noprefixroute eno8\       valid_lft forever preferred_lft forever

Best Regards, Hideo Yamauchi.

nrwahl2 commented 7 months ago

I haven't looked into the processing of IPaddr2 in detail, but the result of find_interface will be different after this modification is applied. Is there no problem?

Can you remove the line instead of commenting it out, and test again? The commented line is breaking both tests. Note that in the "before" case, it should be printing only eno6, not the whole line containing eno6.

HideoYamauchi commented 7 months ago

Hi Reid,

Can you remove the line instead of commenting it out, and test again? The commented line is breaking both tests. Note that in the "before" case, it should be printing only eno6, not the whole line containing eno6.

Sorry....

It was a mistake in my confirmation. Both gave the same output.

Many thanks, Hideo Yamauchi.

oalbrigt commented 6 months ago

retest this please

oalbrigt commented 6 months ago

retest this please

oalbrigt commented 6 months ago

Thanks.