-
Notifications
You must be signed in to change notification settings - Fork 9
MY_IPs uses hostname -I instead of hostname -i #8
Comments
hostname -i returns ::1%1 127.0.0.1 if i used the other one hostname -I i get all my IPs. 172.16.16.130 (management) |
hostname -i returns 192.168.1.174 172.17.0.1 for me, inetutils ver. 1.9.4 this also reflects the documentation on https://www.gnu.org/software/inetutils/manual/inetutils.html#index-hostname |
i am running centos [root@gluster-1683 ganesha]# cat /etc/redhat-release |
looks like this might be OS dependent, i'm running arch which is building from the latest release located here: it looks like CentOS, Debian and Ubuntu use the Debian source, which is based off 1.9.3, but will soon be 1.9.4 and will have the change, unless they patch it back in. it might be more beneficial to do something like context: i'm trying to package up storhaug for arch for private use, after testing will be moving it to AUR. since arch is always using latest, its a nice way to watch out for breaking changes in the future. edit: another solution would be: |
FWIW, this usage of In particular And Back to the drawing board. |
Also FWIW, Fedora uses hostname from Debian Just looking quickly at gnu inetutils/src/hostname.c and debian hostname/hostname.c there doesn't seem to be much, if any relationship. But given that arch uses gnu inetutils it seems that the very least we need to do is icebal's MY_IPS="$(hostname -I || hostname -i)". |
partial fix for #8 For distributions that use gnu inetutils/hostname which does not have the -I (capital letter i)
Try this: ip -4 --brief addr show scope global | grep UP | awk '{print $3}' | cut -d '/' -f 1 (note, ip addr show has an "up" parameter, but that doesn't seem to work for me; I still get down addresses listed) |
RHEL/CentOS 7 don't know --brief. :-( ip -4 addr show scope global | grep inet | awk '{print $2}' | cut -d '/' -f 1 seems to do the correct thing on all of my boxes. dang notes elsewhere that it will show addrs for DOWN nics, but I believe that hostname -I or hostname -i will show addrs for DOWN nics as well. |
Any comments on the above? If I don't hear anything I will make that change to both files that are using |
It appears the result is consistent on my end regardless which option 172.16.16.130 -> management IP [root@gluster-1683 ~]# hostname -I || hostname -i so during setup, I need to modify both /usr/sbin/storhaug and /etc/ctdb/nfs-ganesha-callout to use this hostname -I | awk '{print $2}' Because I only want to build config based on my CTDB NODE IP |
So far this has worked for me, other than a warning that -i doesnt exist before it tries -I |
Next idea (pseudo code) then obviously ens3 could be eth0 or something else. Script accordingly Or |
as the title says, pulling the list of IP addresses uses -i instead of -I. the command options under inetutils also supports -I has been removed.
The text was updated successfully, but these errors were encountered: