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

Creating user directory using tilde always reports "changed" #82490

Open
1 task done
eric-j-ason opened this issue Jan 5, 2024 · 2 comments · May be fixed by #83113
Open
1 task done

Creating user directory using tilde always reports "changed" #82490

eric-j-ason opened this issue Jan 5, 2024 · 2 comments · May be fixed by #83113
Labels
affects_2.15 affects_2.16 bug This issue/PR relates to a bug. easyfix This issue is considered easy to fix by aspiring contributors. has_pr This issue has an associated PR. module This issue/PR relates to a module.

Comments

@eric-j-ason
Copy link

Summary

The creation of a user always reports "changed" if you use tilde expansion for the path to the shell.

It seems that there is a missing tilde-expansion step when checking whether the desired shell equals the one already in use. I believe the offending line is here: 

if self.shell is not None and info[6] != self.shell:

On this line, self.shell is the desired shell and info[6] is the current shell.

The closest previous issue I can find is #38529.

Issue Type

Bug Report

Component Name

user

Ansible Version

$ ansible --version
ansible [core 2.15.1]
  config file = None
  configured module search path = ['/Users/eric/.ansible/plugins/modules', '/opt/local/share/ansible/plugins/modules']
  ansible python module location = /opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/ansible
  ansible collection location = /Users/eric/.ansible/collections:/opt/local/share/ansible/collections
  executable location = /opt/local/bin/ansible
  python version = 3.11.7 (main, Dec 12 2023, 21:38:41) [Clang 15.0.0 (clang-1500.1.0.2.5)] (/opt/local/Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11)
  jinja version = 3.1.2
  libyaml = True

Configuration

# if using a version older than ansible-core 2.12 you should omit the '-t all'
$ ansible-config dump --only-changed -t all
CONFIG_FILE() = None
EDITOR(env: EDITOR) = emacs

OS / Environment

Debian 12, controlled from MacOS 14.2.1

Steps to Reproduce

  - name: create user "bob"
    user:
      name: bob
      shell: ~alice/custom_shell

Expected Results

TASK [create user "bob"] ****************************************
ok: [snowy]

Actual Results

TASK [create user "bob"] ****************************************
changed: [snowy]

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibot ansibot added bug This issue/PR relates to a bug. needs_triage Needs a first human triage before being processed. affects_2.15 module This issue/PR relates to a module. labels Jan 5, 2024
@ansibot
Copy link
Contributor

ansibot commented Jan 5, 2024

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.

@hydromelvictor
Copy link

hello, please i need help for launch project

@ansibot ansibot added the has_pr This issue has an associated PR. label Jan 6, 2024
@bcoca bcoca removed the needs_triage Needs a first human triage before being processed. label Jan 9, 2024
@Akasurde Akasurde added easyfix This issue is considered easy to fix by aspiring contributors. affects_2.16 labels Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects_2.15 affects_2.16 bug This issue/PR relates to a bug. easyfix This issue is considered easy to fix by aspiring contributors. has_pr This issue has an associated PR. module This issue/PR relates to a module.
Projects
None yet
5 participants