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

Lack of v6 routing causes setup to fail #882

Closed
cybertoast opened this issue Aug 15, 2012 · 11 comments
Closed

Lack of v6 routing causes setup to fail #882

cybertoast opened this issue Aug 15, 2012 · 11 comments

Comments

@cybertoast
Copy link
Contributor

When doing the gathering-facts phase, playbook errors with:

GATHERING FACTS ********************* 
fatal: [10.0.61.18] => failed to parse:     data = run_setup(module)

  File "/home/sundar/.ansible/tmp/ansible-1345061792.18-228913620240335/setup", line 672, in run_setup

    facts = ansible_facts()

  File "/home/sundar/.ansible/tmp/ansible-1345061792.18-228913620240335/setup", line 663, in ansible_facts

    facts.update(Network().populate())

  File "/home/sundar/.ansible/tmp/ansible-1345061792.18-228913620240335/setup", line 438, in populate

    default_ipv4, default_ipv6 = self.get_default_interfaces(ip_path)

  File "/home/sundar/.ansible/tmp/ansible-1345061792.18-228913620240335/setup", line 472, in get_default_interfaces

    if words[0] == command[v][-1]:

IndexError: list index out of range

The problem is that on some systems (RHEL5.8 in my case) there response to /sbin/ip -6 route get '2404:6800:400a:800::1012' is not what's expected:

[~]$ /sbin/ip -6 route get '2404:6800:400a:800::1012'
RTNETLINK answers: Invalid argument

The solution is to ignore these errors and return an empty interfaces dictionary for this specific interface.

@mpdehaan
Copy link
Contributor

want to send me a patch?

@cybertoast
Copy link
Contributor Author

It's possible that the RTNETLINK issue is due to bad configuration someplace, but even in this case the system should not error.

mpdehaan pushed a commit that referenced this issue Aug 15, 2012
If there is an error in how interfaces are configured (or only one set, like IPv6),
the setup command should not error out.
@mpdehaan
Copy link
Contributor

closed per #882

@alopropoz
Copy link
Contributor

If IPv6 is disabled (for testing one can pass ipv6.disable=1 to kernel), ansible dies at "gathering facts" step:

$ ansible-playbook -c local playbook
PLAY [all] *********************

GATHERING FACTS *********************
fatal: [127.0.0.1] => failed to parse: {"verbose_override": true, "ansible_facts": {<skipped>}}
RTNETLINK answers: Operation not supported
<skipped>
$ 

We can not get route:

$ ip -6 route get 2404:6800:400a:800::1012
RTNETLINK answers: Operation not supported
$ 

This is handled in library/setup, get_default_interfaces(), but _low_level_exec_command() in lib/ansible/runner/init.py returns stdout and stderr together, so we have "RTNETLINK answers: Operation not supported" appended to JSON output which causes failure.

I fixed this in quick-and-dirty way by adding

if err == 'RTNETLINK answers: Operation not supported\n':
    err = ''

to the end of _low_level_exec_command(). It does not look like a proper way, but I'm not sure what to do here.

@mpdehaan
Copy link
Contributor

mpdehaan commented Sep 3, 2012

Can you give me the output from "ansible --version" please?

(If still present in the latest 0.7 devel -- which should already be fixed I thought, we'd definitely want to see it fixed in library/setup, which is the module that generates these facts)

@alopropoz
Copy link
Contributor

Sure. The latest.

$ ansible --version
ansible 0.7 (devel c04f00e3a6) last updated 2012/09/03 18:08:24 (GMT +000)
$ 

@mpdehaan
Copy link
Contributor

mpdehaan commented Sep 3, 2012

cc @sfromm
(in case you're still interested in network facts)

reopening this.

Though please check and make sure you're not pointing to an older library path, such as if you are running from checkout but have code left over from a previous "make install" or RPM install, etc.

@mpdehaan mpdehaan reopened this Sep 3, 2012
@alopropoz
Copy link
Contributor

No installed copies, only one from checkout. Also the problem disappears when I apply mentioned fix, so it is not because of stalled version somewhere.

The first patch (August, 15) fixes gathering of interfaces info. But here is different issue: error message is still printed to stderr and _low_level_exec_command() considers it as a part of output. But later ansible tries to parse this output as JSON data and of course fails.

@mpdehaan
Copy link
Contributor

mpdehaan commented Sep 4, 2012

I found a few places where it was not collecting stderr -- fixing that and testing now.

@mpdehaan
Copy link
Contributor

mpdehaan commented Sep 4, 2012

Should be fixed in 8f220a4

@mpdehaan mpdehaan closed this as completed Sep 4, 2012
@sfromm
Copy link
Contributor

sfromm commented Sep 4, 2012

setup used to check for ipv6 support with socket.has_ipv6. That should be added back so as to avoid this situation.

@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

No branches or pull requests

4 participants