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

OpenIndiana oi_151a9, python 2.6.4 throws errors during Gathering Facts #18601

Closed
basictheprogram opened this issue Nov 23, 2016 · 3 comments
Closed
Labels
affects_2.3 This issue/PR affects Ansible v2.3 bug This issue/PR relates to a bug. solaris Solaris community

Comments

@basictheprogram
Copy link

ISSUE TYPE
  • Bug Report
COMPONENT NAME

Gathering Facts

ANSIBLE VERSION
$ ansible --version
ansible 2.3.0 (devel 21813ed83e) last updated 2016/11/23 14:20:16 (GMT -500)
  lib/ansible/modules/core: (devel aa0cad528a) last updated 2016/11/23 14:20:17 (GMT -500)
  lib/ansible/modules/extras: (devel 43bb97bc37) last updated 2016/11/23 14:20:18 (GMT -500)
  config file = /Users/tanner/projects/ansible.git/playbooks.git/ansible.cfg
  configured module search path = Default w/o overrides
CONFIGURATION

Stock configuration from a git pull of the devel branch

OS / ENVIRONMENT

Running Ansible from macOS 10.12.1
Managing OpenIndiana oi_151a9

SUMMARY

Attempting to gather facts and the module fails and throws an error

STEPS TO REPRODUCE
Not specific to a playbook or task
EXPECTED RESULTS

Fact gathering would complete and playbook would continue

ACTUAL RESULTS
statically included: /Users/tanner/projects/ansible.git/playbooks.git/roles/updates/tasks/debian.yml
statically included: /Users/tanner/projects/ansible.git/playbooks.git/roles/updates/tasks/ubuntu/lucid.yml
statically included: /Users/tanner/projects/ansible.git/playbooks.git/roles/updates/tasks/suse.yml
statically included: /Users/tanner/projects/ansible.git/playbooks.git/roles/updates/tasks/solaris.yml
statically included: /Users/tanner/projects/ansible.git/playbooks.git/roles/virtual-servers/tasks/debian.yml
statically included: /Users/tanner/projects/ansible.git/playbooks.git/roles/virtual-servers/tasks/remove-official-vmware-tools.yml
statically included: /Users/tanner/projects/ansible.git/playbooks.git/roles/virtual-servers/tasks/install-official-vmware-tools.yml
statically included: /Users/tanner/projects/ansible.git/playbooks.git/roles/virtual-servers/tasks/suse.yml
statically included: /Users/tanner/projects/ansible.git/playbooks.git/roles/support-users/tasks/suse.yml
Loading callback plugin default of type stdout, v2.0 from /Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/callback/__init__.pyc

PLAYBOOK: linux-servers.yml ****************************************************
1 plays in linux-servers.yml

PLAY [linux-servers] ***********************************************************

TASK [Gathering Facts] *********************************************************
Using module file /Users/tanner/projects/ansible.git/ansible/lib/ansible/modules/core/system/setup.py
<crashplan.local> ESTABLISH SSH CONNECTION FOR USER: ansible
<crashplan.local> SSH: EXEC ssh -vvv -o ControlMaster=auto -o ControlPersist=600s -o ForwardAgent=yes -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ansible -o ConnectTimeout=10 -o ControlPath=/Users/tanner/.ansible/cp/%C crashplan.local '/bin/sh -c '"'"'/usr/bin/python && sleep 0'"'"''
fatal: [crashplan.local]: FAILED! => {
    "changed": false,
    "failed": true,
    "invocation": {
        "module_name": "setup"
    },
    "module_stderr": "OpenSSH_7.2p2, LibreSSL 2.4.1\r\ndebug1: Reading configuration data /Users/tanner/.ssh/config\r\ndebug3: kex names ok: [diffie-hellman-group1-sha1]\r\ndebug3: kex names ok: [diffie-hellman-group1-sha1]\r\ndebug3: kex names ok: [diffie-hellman-group1-sha1]\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 20: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 8579\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\n/tmp/ansible_vdZiV_/ansible_modlib.zip/ansible/module_utils/facts.py:968: DeprecationWarning: object.__new__() takes no parameters\nTraceback (most recent call last):\n  File \"/tmp/ansible_vdZiV_/ansible_module_setup.py\", line 134, in <module>\n    main()\n  File \"/tmp/ansible_vdZiV_/ansible_module_setup.py\", line 126, in main\n    data = get_all_facts(module)\n  File \"/tmp/ansible_vdZiV_/ansible_modlib.zip/ansible/module_utils/facts.py\", line 3727, in get_all_facts\n  File \"/tmp/ansible_vdZiV_/ansible_modlib.zip/ansible/module_utils/facts.py\", line 3670, in ansible_facts\n  File \"/tmp/ansible_vdZiV_/ansible_modlib.zip/ansible/module_utils/facts.py\", line 1518, in populate\n  File \"/tmp/ansible_vdZiV_/ansible_modlib.zip/ansible/module_utils/facts.py\", line 1603, in get_dmi_facts\nAttributeError: 'NoneType' object has no attribute 'group'\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 1\r\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE"
}
@bcoca
Copy link
Member

bcoca commented Nov 23, 2016

does this patch fix the issue for you?

diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py
index 09a08ca..d8deaf9 100644
--- a/lib/ansible/module_utils/facts.py
+++ b/lib/ansible/module_utils/facts.py
@@ -1599,9 +1599,11 @@ class SunOSHardware(Hardware):
         rc returns 1
         """
         if out:
-           system_conf = out.split('\n')[0]
-           self.facts['product_name'] = re.search(r'(\w+\sEnterprise\s\w+)',system_conf).group(1)
-
+            system_conf = out.split('\n')[0]
+            found = re.search(r'(\w+\sEnterprise\s\w+)',system_conf)
+            if found:
+                self.facts['product_name'] = found.group(1)
+
 class OpenBSDHardware(Hardware):
     """
     OpenBSD-specific subclass of Hardware. Defines memory, CPU and device facts:

@bcoca bcoca added affects_2.3 This issue/PR affects Ansible v2.3 bug_report labels Nov 23, 2016
@basictheprogram
Copy link
Author

Yes, the above patch fixes the problem.

@bcoca
Copy link
Member

bcoca commented Nov 24, 2016

fixed via fbe5878

@bcoca bcoca closed this as completed Nov 24, 2016
bcoca added a commit that referenced this issue Nov 24, 2016
@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 7, 2018
@dagwieers dagwieers added the solaris Solaris community label Jan 9, 2019
@ansible ansible locked and limited conversation to collaborators Apr 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.3 This issue/PR affects Ansible v2.3 bug This issue/PR relates to a bug. solaris Solaris community
Projects
None yet
Development

No branches or pull requests

4 participants