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

setup script blows up when ipv6 routes are empty #909

Closed
tbielawa opened this issue Aug 20, 2012 · 1 comment · Fixed by #910
Closed

setup script blows up when ipv6 routes are empty #909

tbielawa opened this issue Aug 20, 2012 · 1 comment · Fixed by #910

Comments

@tbielawa
Copy link
Contributor

Expected behavior: I run a playbook (below) and get back the operating system release


---
- hosts: all
  tasks:
      - name: hurrdurr
        action: command cat /etc/redhat-release    

Observed behavior:

$ ansible-playbook -vvv -i ~/hosts -- ~/testplaybook.yaml

PLAY [all] ********************* 

GATHERING FACTS ********************* 
<lnx.cx> ESTABLISH CONNECTION FOR USER: tbielawa
<lnx.cx> EXEC "$SHELL" -c 'mkdir -p $HOME/.ansible/tmp/ansible-1345425213.39-240537084977510 && chmod a+rx $HOME/.ansible/tmp/ansible-1345425213.39-240537084977510 && echo $HOME/.ansible/tmp/ansible-1345425213.39-240537084977510'
<lnx.cx> REMOTE_MODULE setup 
<lnx.cx> PUT /tmp/tmpCP6zcd TO /home/tbielawa/.ansible/tmp/ansible-1345425213.39-240537084977510/setup
<lnx.cx> EXEC "$SHELL" -c 'chmod u+x /home/tbielawa/.ansible/tmp/ansible-1345425213.39-240537084977510/setup'
<lnx.cx> EXEC "$SHELL" -c /home/tbielawa/.ansible/tmp/ansible-1345425213.39-240537084977510/setup
fatal: [lnx.cx] => failed to parse:     data = run_setup(module)

  File "/home/tbielawa/.ansible/tmp/ansible-1345425213.39-240537084977510/setup", line 672, in run_setup
    facts = ansible_facts()
  File "/home/tbielawa/.ansible/tmp/ansible-1345425213.39-240537084977510/setup", line 663, in ansible_facts
    facts.update(Network().populate())
  File "/home/tbielawa/.ansible/tmp/ansible-1345425213.39-240537084977510/setup", line 438, in populate
    default_ipv4, default_ipv6 = self.get_default_interfaces(ip_path)
  File "/home/tbielawa/.ansible/tmp/ansible-1345425213.39-240537084977510/setup", line 472, in get_default_interfaces
    if words[0] == command[v][-1]:
IndexError: list index out of range

TASK: [hurrdurr] ********************* 
no hosts matched or remaining

PLAY RECAP ********************* 
lnx.cx                         : ok=0    changed=0    unreachable=1    failed=0    

Narrowed this down to when the ipv6 route get command runs: /sbin/ip -6 route get 2404:6800:400a:800::1012

For comparison:

<tbielawa>@(griddle)[~] 01:10:01
$ /sbin/ip -6 route get 2404:6800:400a:800::1012
<tbielawa>@(griddle)[~] 01:17:42
$ /sbin/ip -4 route get 8.8.8.8
8.8.8.8 via 173.255.228.1 dev eth0  src 173.255.228.56 
    cache 

This is on my linode with static networking configured:

<tbielawa>@(griddle)[~] 01:17:48
$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether fe:fd:ad:ff:e4:38 brd ff:ff:ff:ff:ff:ff
    inet 173.255.228.56/24 brd 173.255.228.255 scope global eth0
    inet 192.168.129.235/17 brd 192.168.255.255 scope global eth0:0
    inet6 fe80::fcfd:adff:feff:e438/64 scope link 
       valid_lft forever preferred_lft forever
3: tunl0: <NOARP> mtu 1480 qdisc noop state DOWN 
    link/ipip 0.0.0.0 brd 0.0.0.0
4: gre0: <NOARP> mtu 1476 qdisc noop state DOWN 
    link/gre 0.0.0.0 brd 0.0.0.0
5: sit0: <NOARP> mtu 1480 qdisc noop state DOWN 
    link/sit 0.0.0.0 brd 0.0.0.0
<tbielawa>@(griddle)[~] 01:18:10
$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         gw-li238.linode 0.0.0.0         UG    0      0        0 eth0
link-local      *               255.255.0.0     U     1002   0        0 eth0
173.255.228.0   *               255.255.255.0   U     0      0        0 eth0
192.168.128.0   *               255.255.128.0   U     0      0        0 eth0
<tbielawa>@(griddle)[~] 01:18:15
$ cat /etc/redhat-release 
Fedora release 17 (Beefy Miracle)
<tbielawa>@(griddle)[~] 01:19:05
$ route -V
net-tools 1.60
route 1.98 (2001-04-15)
+NEW_ADDRT +RTF_IRTT +RTF_REJECT +I18N +SELINUX
AF: (inet) +UNIX +INET +INET6 +IPX +AX25 +NETROM +X25 +ATALK +ECONET +ROSE -BLUETOOTH
HW:  +ETHER +ARC +SLIP +PPP +TUNNEL +TR +AX25 +NETROM +X25 +FR +ROSE +ASH +SIT +FDDI +HIPPI +HDLC/LAPB +EUI64 

Pull request with fix incoming presently.

@tbielawa
Copy link
Contributor Author

$ ansible --version
ansible 0.7 (ipv6route 3d3c8a004e) last updated 2012/08/19 21:19:07 (GMT -400)


$ ansible-playbook -vvv -i ~/hosts -- ~/testplaybook.yaml

PLAY [all] ********************* 

GATHERING FACTS ********************* 
<lnx.cx> ESTABLISH CONNECTION FOR USER: tbielawa
<lnx.cx> EXEC "$SHELL" -c 'mkdir -p $HOME/.ansible/tmp/ansible-1345425760.52-274939814778016 && chmod a+rx $HOME/.ansible/tmp/ansible-1345425760.52-274939814778016 && echo $HOME/.ansible/tmp/ansible-1345425760.52-274939814778016'
<lnx.cx> REMOTE_MODULE setup 
<lnx.cx> PUT /tmp/tmpVkbRPR TO /home/tbielawa/.ansible/tmp/ansible-1345425760.52-274939814778016/setup
<lnx.cx> EXEC "$SHELL" -c 'chmod u+x /home/tbielawa/.ansible/tmp/ansible-1345425760.52-274939814778016/setup'
<lnx.cx> EXEC "$SHELL" -c /home/tbielawa/.ansible/tmp/ansible-1345425760.52-274939814778016/setup
<lnx.cx> EXEC "$SHELL" -c 'rm -rf /home/tbielawa/.ansible/tmp/ansible-1345425760.52-274939814778016/'
ok: [lnx.cx]

TASK: [hurrdurr] ********************* 
<lnx.cx> ESTABLISH CONNECTION FOR USER: tbielawa
<lnx.cx> EXEC "$SHELL" -c 'mkdir -p $HOME/.ansible/tmp/ansible-1345425766.05-144280788578286 && chmod a+rx $HOME/.ansible/tmp/ansible-1345425766.05-144280788578286 && echo $HOME/.ansible/tmp/ansible-1345425766.05-144280788578286'
<lnx.cx> REMOTE_MODULE command cat /etc/redhat-release
<lnx.cx> PUT /tmp/tmpdyRV2_ TO /home/tbielawa/.ansible/tmp/ansible-1345425766.05-144280788578286/command
<lnx.cx> EXEC "$SHELL" -c 'chmod u+x /home/tbielawa/.ansible/tmp/ansible-1345425766.05-144280788578286/command'
<lnx.cx> EXEC "$SHELL" -c /home/tbielawa/.ansible/tmp/ansible-1345425766.05-144280788578286/command
<lnx.cx> EXEC "$SHELL" -c 'rm -rf /home/tbielawa/.ansible/tmp/ansible-1345425766.05-144280788578286/'
ok: [lnx.cx] => {"changed": true, "cmd": ["cat", "/etc/redhat-release"], "delta": "0:00:00.007574", "end": "2012-08-20 01:24:30.578579", "module": "command", "rc": 0, "start": "2012-08-20 01:24:30.571005", "stderr": "", "stdout": "Fedora release 17 (Beefy Miracle)"}

PLAY RECAP ********************* 
lnx.cx                         : ok=2    changed=1    unreachable=0    failed=0    

mpdehaan added a commit that referenced this issue Aug 20, 2012
Fix setup module explosion when a route is empty. Closes #909
@ansible ansible locked and limited conversation to collaborators Apr 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants