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

Linux Vserver not detected properly #36038

Closed
BartVB opened this issue Feb 12, 2018 · 2 comments · Fixed by #36042
Closed

Linux Vserver not detected properly #36038

BartVB opened this issue Feb 12, 2018 · 2 comments · Fixed by #36042
Labels
affects_2.4 This issue/PR affects Ansible v2.4 bug This issue/PR relates to a bug. has_pr This issue has an associated PR. support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@BartVB
Copy link

BartVB commented Feb 12, 2018

ISSUE TYPE
  • Bug Report
COMPONENT NAME

lib/ansible/module_utils/facts/virtual/linux.py

ANSIBLE VERSION

ansible 2.4.3.0
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.6 (default, Nov 23 2017, 15:49:48) [GCC 4.8.4]

Also present in 'devel' branch.

OS / ENVIRONMENT

Host with Linux Vserver:
Linux FQDN 4.1.48-vs2.3.8.6-beng #1 SMP Sun Jan 14 14:33:48 GMT 2018 x86_64 GNU/Linux

SUMMARY

Ansible uses /proc/self/status to detect Linux Vserver with:

if re.match(r'^VxID: \d+', line):

This doesn't work on my system, the output of /proc/self/status contains:

Cpus_allowed:   ff
Cpus_allowed_list:      0-7
Mems_allowed:   00000000,00000001
Mems_allowed_list:      0
VxID:   40024
NxID:   40024
voluntary_ctxt_switches:        0
nonvoluntary_ctxt_switches:     1

There are three spaces between 'VxID:' and '40024', the regex only allows one.

Changing the code to:

if re.match(r'^VxID:\s*\d+', line):

Fixes this.

@ansibot
Copy link
Contributor

ansibot commented Feb 12, 2018

Files identified in the description:
None

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot ansibot added affects_2.4 This issue/PR affects Ansible v2.4 bug_report 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 Feb 12, 2018
@ansibot
Copy link
Contributor

ansibot commented Feb 12, 2018

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

bcoca added a commit to bcoca/ansible that referenced this issue Feb 12, 2018
@sivel sivel added has_pr This issue has an associated PR. and removed needs_triage Needs a first human triage before being processed. labels Feb 12, 2018
bcoca added a commit that referenced this issue Feb 14, 2018
fixes #36038

(cherry picked from commit 97b6e99)
bcoca added a commit that referenced this issue Feb 14, 2018
bcoca added a commit that referenced this issue Feb 15, 2018
fixes #36038

(cherry picked from commit 97b6e99)
@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 7, 2018
@ansible ansible locked and limited conversation to collaborators Apr 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.4 This issue/PR affects Ansible v2.4 bug This issue/PR relates to a bug. has_pr This issue has an associated PR. support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants