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

Fix service_mgr fact collection #32086

Merged
merged 1 commit into from
Oct 24, 2017
Merged

Fix service_mgr fact collection #32086

merged 1 commit into from
Oct 24, 2017

Conversation

alikins
Copy link
Contributor

@alikins alikins commented Oct 24, 2017

The platform/distro/etc facts were being passed in
correctly, but service_mgr.py was looking up the
wrong names ('system' vs 'ansible_system')

Fixes #30753, #31095

SUMMARY
ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

lib/ansible/module_utils/facts/system/service_mgr.py

ANSIBLE VERSION
ansible 2.5.0 (service_mgr_fact_30753 62d0f6c8c8) last updated 2017/10/24 12:04:28 (GMT -400)
  config file = /home/adrian/src/ansible/ansible.cfg
  configured module search path = [u'/home/adrian/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/adrian/src/ansible/lib/ansible
  executable location = /home/adrian/src/ansible/bin/ansible
  python version = 2.7.13 (default, May 10 2017, 20:04:28) [GCC 6.3.1 20161221 (Red Hat 6.3.1-1)]

ADDITIONAL INFORMATION

The platform/distro/etc facts were being passed in
correctly, but service_mgr.py was looking up the
wrong names ('system' vs 'ansible_system')

Fixes #30753, #31095
@ansibot ansibot added affects_2.5 This issue/PR affects Ansible v2.5 bugfix_pull_request module_utils/facts needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Oct 24, 2017
@bcoca bcoca added this to TODO: Nice to have in 2.4.x Blocker List Oct 24, 2017
@toke
Copy link

toke commented Oct 24, 2017

@alikins Thanks a lot for your effort.
This fixes the issue. Let's hope it will make it in 2.4.1.

@alikins alikins merged commit 6203e89 into ansible:devel Oct 24, 2017
@bcoca bcoca removed the needs_triage Needs a first human triage before being processed. label Oct 24, 2017
@bcoca bcoca moved this from TODO: Nice to have to TODO: Next release in 2.4.x Blocker List Oct 25, 2017
abadger pushed a commit that referenced this pull request Oct 26, 2017
The platform/distro/etc facts were being passed in
correctly, but service_mgr.py was looking up the
wrong names ('system' vs 'ansible_system') resulting
in service_mgr falling back to default 'service' result.

Fixes #30753, #31095
(cherry picked from commit 6203e89)
@abadger abadger moved this from TODO: Next release to Done in 2.4.2 in 2.4.x Blocker List Oct 26, 2017
@abadger
Copy link
Contributor

abadger commented Oct 26, 2017

Cherry-picked for the 2.4.2beta1 release. I'll cut that tarball later this week.

abadger pushed a commit that referenced this pull request Oct 26, 2017
The platform/distro/etc facts were being passed in
correctly, but service_mgr.py was looking up the
wrong names ('system' vs 'ansible_system') resulting
in service_mgr falling back to default 'service' result.

Fixes #30753, #31095
(cherry picked from commit 6203e89)
@aabdnn
Copy link

aabdnn commented Oct 27, 2017

I've downloaded and installed ansible-2.4.2.0-0.1.beta1.tar.gz. However, it's still not working correctly:

% ansible --version                                                 
ansible 2.4.2.0
  config file = None
  configured module search path = [u'/Users/anandb/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python2.7/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.14 (default, Sep 25 2017, 09:53:22) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)]
% ansible centos6host -bK -m setup -a filter=ansible_service_mgr
SUDO password: 
centos6host | SUCCESS => {
    "ansible_facts": {
        "ansible_service_mgr": "service"
    }
}

@toke
Copy link

toke commented Oct 27, 2017

@aabdnn I can't confirm your observation.
Is it a centos 6 system?

I've tested ansible tags v2.3.2.0-1 vs v2.4.2.0-0.1.beta1
using the vagrant images debian/wheezy64 and centos/6.

I used this snippets for the centos test (replaced the image):
https://gist.github.com/toke/d5de03c70c9c7f1a2ec6acd7a9e3753a

Wheezy tests also ran against real hosts previously affected.

@aabdnn
Copy link

aabdnn commented Oct 27, 2017

Yes, it's definitely a CentOS 6 system:

% ansible centos6host -a 'cat /etc/redhat-release'              
centos6host | SUCCESS | rc=0 >>
CentOS release 6.9 (Final)

@toke
Copy link

toke commented Oct 27, 2017

Still having trouble reproducing...

TASK [vars] ********************************************************************
ok: [default] => {
    "msg": "Ansible: 2.4.2.0\nOS: CentOS 6.9 Final\nService_mgr: upstart\n"
}

using this playbook

---

- hosts: all
  tasks:
    - name: vars
      debug:
        msg: |
          Ansible: {{ ansible_version.full }}
          OS: {{ ansible_distribution }} {{ ansible_distribution_version }} {{ ansible_distribution_release }}
          Service_mgr: {{ ansible_service_mgr }}

looks as expected.

@aabdnn
Copy link

aabdnn commented Oct 27, 2017

Okay, so the playbook works, and reports "upstart" for the service manager:

% ansible-playbook debug_setup.yml -bK -l centos6host
SUDO password: 

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

TASK [Gathering Facts] *****************************************************************************************************************************************
ok: [centos6host]

TASK [vars] ****************************************************************************************************************************************************
ok: [centos6host] => {
    "msg": "Ansible: 2.4.2.0\nOS: CentOS 6.9 Final\nService_mgr: upstart\n"
}

PLAY RECAP *****************************************************************************************************************************************************
centos6host            : ok=2    changed=0    unreachable=0    failed=0

However, the following still fails. What is different about them?

% ansible centos6host -bK -m setup -a filter=ansible_service_mgr
SUDO password: 
centos6host | SUCCESS => {
    "ansible_facts": {
        "ansible_service_mgr": "service"
    }
}

@toke
Copy link

toke commented Oct 27, 2017

Fun fact, try ansible centos6host -bK -m setup | grep ansible_service_mgr
WTF?

Actually I don't know what's going on here and not sure it's the same issue.

It seems to be related to the filter implementation in setup module.

@aabdnn
Copy link

aabdnn commented Oct 27, 2017

Whoa! So when the "setup" module runs without any "filter" parameter, it also detects upstart properly, but with "filter=ansible_service_mgr" it fails. So there's still some kind of bug at work.

@abadger
Copy link
Contributor

abadger commented Oct 27, 2017 via email

@toke
Copy link

toke commented Oct 28, 2017

@abadger I've opened #32286 to track this issue.

@alikins
Copy link
Contributor Author

alikins commented Nov 1, 2017

Fixes #32001

@ansibot ansibot added bug This issue/PR relates to a bug. and removed bugfix_pull_request labels Mar 6, 2018
@ansible ansible locked and limited conversation to collaborators Apr 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.5 This issue/PR affects Ansible v2.5 bug This issue/PR relates to a bug. module_utils/facts support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
No open projects
2.4.x Blocker List
Done in 2.4.2
Development

Successfully merging this pull request may close these issues.

ansible_service_mgr fact for sysvinit incorrect in ansible 2.4.0
6 participants