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

user module can't handle password expiration parameters correctly #75017

Closed
1 task done
ccdeville opened this issue Jun 16, 2021 · 2 comments · Fixed by #75390
Closed
1 task done

user module can't handle password expiration parameters correctly #75017

ccdeville opened this issue Jun 16, 2021 · 2 comments · Fixed by #75390
Labels
affects_2.12 bug This issue/PR relates to a bug. has_pr This issue has an associated PR. module This issue/PR relates to a module. P3 Priority 3 - Approved, No Time Limitation support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@ccdeville
Copy link

ccdeville commented Jun 16, 2021

Summary

When using the user module to modify password_expire_min=0, the processing result does not meet expectations .
I guess the problem is caused by the following code in the user module.

    # deal with password expire min
    if user.password_expire_min:
        if user.user_exists():
            (rc, out, err) = user.set_password_expire_min()

Modifying to the following code may fix this problem.

    # deal with password expire min
    if user.password_expire_min is not None:
        if user.user_exists():
            (rc, out, err) = user.set_password_expire_min()

Issue Type

Bug Report

Component Name

user

Ansible Version

$ ansible --version
ansible [core 2.11.1] 
  config file = None
  configured module search path = ['/home/betadmin/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /app/python3/lib/python3.8/site-packages/ansible
  ansible collection location = /home/betadmin/.ansible/collections:/usr/share/ansible/collections
  executable location = /app/python3/bin/ansible
  python version = 3.8.5 (default, Sep 18 2020, 14:55:53) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]
  jinja version = 2.11.2
  libyaml = False

Configuration

$ ansible-config dump --only-changed

OS / Environment

RHEL 7.4

Steps to Reproduce

  • name: Edit password_expire_min
    user:
    name: test
    password_expire_min: 0

Expected Results

Minimum number of days between password change : 0

Actual Results

Minimum number of days between password change : 2

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibot
Copy link
Contributor

ansibot commented Jun 16, 2021

Files identified in the description:

If these files are incorrect, 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.12 bug This issue/PR relates to a bug. module This issue/PR relates to a module. 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 Jun 16, 2021
@samdoran samdoran added P3 Priority 3 - Approved, No Time Limitation and removed needs_triage Needs a first human triage before being processed. labels Jun 17, 2021
@lucab85
Copy link

lucab85 commented Nov 10, 2021

I can reproduce the bug with

ansible --version
ansible [core 2.11.6] 
  config file = None
  configured module search path = ['/Users/lberton/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/4.7.0_1/libexec/lib/python3.10/site-packages/ansible
  ansible collection location = /Users/lberton/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.10.0 (default, Oct 13 2021, 06:45:00) [Clang 13.0.0 (clang-1300.0.29.3)]
  jinja version = 3.0.2
  libyaml = True

@ansibot ansibot added the has_pr This issue has an associated PR. label Nov 10, 2021
@ansible ansible locked and limited conversation to collaborators Feb 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.12 bug This issue/PR relates to a bug. has_pr This issue has an associated PR. module This issue/PR relates to a module. P3 Priority 3 - Approved, No Time Limitation support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
4 participants