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

Fixes #26760 - Added ability to create Openstack users without password #37338

Merged
merged 1 commit into from Oct 14, 2018

Conversation

bingoarun
Copy link
Contributor

SUMMARY

Fixes #26760 - Added ability to create Openstack users without a password

Currently, openstack users can't be created without specifying the password. Openstack command line allows doing this as there is a requirement to create users with external auth like LDAP and SAML.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

ansible/lib/ansible/modules/cloud/openstack/os_user.py

ANSIBLE VERSION
(test) [arun@fedora flavor-test(keystone_admin)]$ ansible --version
ansible 2.6.0 (devel ff28429e2a) last updated 2018/03/07 18:05:40 (GMT +550)
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/arun/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/arun/Projects/bingoarun/flavor-test/ansible/lib/ansible
  executable location = /home/arun/Projects/bingoarun/flavor-test/test/bin/ansible
  python version = 2.7.14 (default, Feb 27 2018, 20:43:24) [GCC 7.3.1 20180130 (Red Hat 7.3.1-2)]

ADDITIONAL INFORMATION
  • For this change, I just changed the default value to 'None'. In the _needs_update function, if the password parameters are not given, then it is ignored. (No update required for password)
  • Also before this change, the update_password and password parameters are marked as optional (required: false). But without those the program won't work. However now that those parameters are made optional, the program will run without any error. Appropriate documentation changes are made.

Before change

(test) [arun@fedora flavor-test(keystone_admin)]$ ansible-playbook sg.yml  --connection=local -vvv 
ansible-playbook 2.6.0 (devel ff28429e2a) last updated 2018/03/07 18:05:40 (GMT +550)
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/arun/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/arun/Projects/bingoarun/flavor-test/ansible/lib/ansible
  executable location = /home/arun/Projects/bingoarun/flavor-test/test/bin/ansible-playbook
  python version = 2.7.14 (default, Feb 27 2018, 20:43:24) [GCC 7.3.1 20180130 (Red Hat 7.3.1-2)]
Using /etc/ansible/ansible.cfg as config file
Parsed /etc/ansible/hosts inventory source with ini plugin
 [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'


PLAYBOOK: sg.yml **************************************************************************************************************************************
1 plays in sg.yml

PLAY [localhost] **************************************************************************************************************************************

TASK [Gathering Facts] ********************************************************************************************************************************
task path: /home/arun/Projects/bingoarun/flavor-test/sg.yml:2
Using module file /home/arun/Projects/bingoarun/flavor-test/ansible/lib/ansible/modules/system/setup.py
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: arun
<127.0.0.1> EXEC /bin/sh -c 'echo ~ && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/arun/.ansible/tmp/ansible-tmp-1520931764.63-33779391266975 `" && echo ansible-tmp-1520931764.63-33779391266975="` echo /home/arun/.ansible/tmp/ansible-tmp-1520931764.63-33779391266975 `" ) && sleep 0'
<127.0.0.1> PUT /home/arun/.ansible/tmp/ansible-local-52692Z4yHs/tmpMPjUiR TO /home/arun/.ansible/tmp/ansible-tmp-1520931764.63-33779391266975/setup.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/arun/.ansible/tmp/ansible-tmp-1520931764.63-33779391266975/ /home/arun/.ansible/tmp/ansible-tmp-1520931764.63-33779391266975/setup.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/home/arun/Projects/bingoarun/flavor-test/test/bin/python2 /home/arun/.ansible/tmp/ansible-tmp-1520931764.63-33779391266975/setup.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /home/arun/.ansible/tmp/ansible-tmp-1520931764.63-33779391266975/ > /dev/null 2>&1 && sleep 0'
ok: [localhost]
META: ran handlers

TASK [os_user] ****************************************************************************************************************************************
task path: /home/arun/Projects/bingoarun/flavor-test/sg.yml:5
Using module file /home/arun/Projects/bingoarun/flavor-test/library/os_user.py
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: arun
<127.0.0.1> EXEC /bin/sh -c 'echo ~ && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/arun/.ansible/tmp/ansible-tmp-1520931765.63-257824929743526 `" && echo ansible-tmp-1520931765.63-257824929743526="` echo /home/arun/.ansible/tmp/ansible-tmp-1520931765.63-257824929743526 `" ) && sleep 0'
<127.0.0.1> PUT /home/arun/.ansible/tmp/ansible-local-52692Z4yHs/tmpenElea TO /home/arun/.ansible/tmp/ansible-tmp-1520931765.63-257824929743526/os_user.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/arun/.ansible/tmp/ansible-tmp-1520931765.63-257824929743526/ /home/arun/.ansible/tmp/ansible-tmp-1520931765.63-257824929743526/os_user.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/home/arun/Projects/bingoarun/flavor-test/test/bin/python2 /home/arun/.ansible/tmp/ansible-tmp-1520931765.63-257824929743526/os_user.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /home/arun/.ansible/tmp/ansible-tmp-1520931765.63-257824929743526/ > /dev/null 2>&1 && sleep 0'
fatal: [localhost]: FAILED! => {
    "changed": false, 
    "invocation": {
        "module_args": {
            "api_timeout": null, 
            "auth": null, 
            "auth_type": null, 
            "availability_zone": null, 
            "cacert": null, 
            "cert": null, 
            "default_project": null, 
            "description": null, 
            "domain": "default", 
            "email": "test@exa.co1m", 
            "enabled": true, 
            "interface": "public", 
            "key": null, 
            "name": "myuser2", 
            "password": null, 
            "region_name": null, 
            "state": "present", 
            "timeout": 180, 
            "update_password": "always", 
            "verify": null, 
            "wait": true
        }
    }, 
    "msg": "update_password is always but a password value is missing"
}
	to retry, use: --limit @/home/arun/Projects/bingoarun/flavor-test/sg.retry

PLAY RECAP ********************************************************************************************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=1   

(test) [arun@fedora flavor-test(keystone_admin)]$

After change

(test) [arun@fedora flavor-test(keystone_admin)]$ ansible-playbook sg.yml  --connection=local -vvv 
ansible-playbook 2.6.0 (devel ff28429e2a) last updated 2018/03/07 18:05:40 (GMT +550)
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/arun/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/arun/Projects/bingoarun/flavor-test/ansible/lib/ansible
  executable location = /home/arun/Projects/bingoarun/flavor-test/test/bin/ansible-playbook
  python version = 2.7.14 (default, Feb 27 2018, 20:43:24) [GCC 7.3.1 20180130 (Red Hat 7.3.1-2)]
Using /etc/ansible/ansible.cfg as config file
Parsed /etc/ansible/hosts inventory source with ini plugin
 [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'


PLAYBOOK: sg.yml **************************************************************************************************************************************
1 plays in sg.yml

PLAY [localhost] **************************************************************************************************************************************

TASK [Gathering Facts] ********************************************************************************************************************************
task path: /home/arun/Projects/bingoarun/flavor-test/sg.yml:2
Using module file /home/arun/Projects/bingoarun/flavor-test/ansible/lib/ansible/modules/system/setup.py
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: arun
<127.0.0.1> EXEC /bin/sh -c 'echo ~ && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/arun/.ansible/tmp/ansible-tmp-1520931873.79-136670041879696 `" && echo ansible-tmp-1520931873.79-136670041879696="` echo /home/arun/.ansible/tmp/ansible-tmp-1520931873.79-136670041879696 `" ) && sleep 0'
<127.0.0.1> PUT /home/arun/.ansible/tmp/ansible-local-5612CBiJEa/tmpp22b4C TO /home/arun/.ansible/tmp/ansible-tmp-1520931873.79-136670041879696/setup.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/arun/.ansible/tmp/ansible-tmp-1520931873.79-136670041879696/ /home/arun/.ansible/tmp/ansible-tmp-1520931873.79-136670041879696/setup.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/home/arun/Projects/bingoarun/flavor-test/test/bin/python2 /home/arun/.ansible/tmp/ansible-tmp-1520931873.79-136670041879696/setup.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /home/arun/.ansible/tmp/ansible-tmp-1520931873.79-136670041879696/ > /dev/null 2>&1 && sleep 0'
ok: [localhost]
META: ran handlers

TASK [os_user] ****************************************************************************************************************************************
task path: /home/arun/Projects/bingoarun/flavor-test/sg.yml:5
Using module file /home/arun/Projects/bingoarun/flavor-test/library/os_user.py
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: arun
<127.0.0.1> EXEC /bin/sh -c 'echo ~ && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/arun/.ansible/tmp/ansible-tmp-1520931874.51-33746967401990 `" && echo ansible-tmp-1520931874.51-33746967401990="` echo /home/arun/.ansible/tmp/ansible-tmp-1520931874.51-33746967401990 `" ) && sleep 0'
<127.0.0.1> PUT /home/arun/.ansible/tmp/ansible-local-5612CBiJEa/tmpSA1DFs TO /home/arun/.ansible/tmp/ansible-tmp-1520931874.51-33746967401990/os_user.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/arun/.ansible/tmp/ansible-tmp-1520931874.51-33746967401990/ /home/arun/.ansible/tmp/ansible-tmp-1520931874.51-33746967401990/os_user.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/home/arun/Projects/bingoarun/flavor-test/test/bin/python2 /home/arun/.ansible/tmp/ansible-tmp-1520931874.51-33746967401990/os_user.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /home/arun/.ansible/tmp/ansible-tmp-1520931874.51-33746967401990/ > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {
    "changed": true, 
    "invocation": {
        "module_args": {
            "api_timeout": null, 
            "auth": null, 
            "auth_type": null, 
            "availability_zone": null, 
            "cacert": null, 
            "cert": null, 
            "default_project": null, 
            "description": null, 
            "domain": "default", 
            "email": "test@exa.co1m", 
            "enabled": true, 
            "interface": "public", 
            "key": null, 
            "name": "myuser2", 
            "password": null, 
            "region_name": null, 
            "state": "present", 
            "timeout": 180, 
            "update_password": null, 
            "verify": null, 
            "wait": true
        }
    }, 
    "user": {
        "default_project_id": null, 
        "description": null, 
        "domain_id": "default", 
        "email": "test@exa.co1m", 
        "enabled": true, 
        "id": "71c99e9b4c3f4feab7489be994030dd4", 
        "name": "myuser2", 
        "username": null
    }
}
META: ran handlers
META: ran handlers

PLAY RECAP ********************************************************************************************************************************************
localhost                  : ok=2    changed=1    unreachable=0    failed=0 

@ansibot
Copy link
Contributor

ansibot commented Mar 13, 2018

@ansibot ansibot added bug This issue/PR relates to a bug. cloud community_review In order to be merged, this PR must follow the community review workflow. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. new_contributor This PR is the first contribution by a new community member. openstack support:community This issue/PR relates to code supported by the Ansible community. labels Mar 13, 2018
@ryansb ryansb removed the needs_triage Needs a first human triage before being processed. label Mar 13, 2018
@ansibot
Copy link
Contributor

ansibot commented Mar 20, 2018

@bingoarun this PR contains the following merge commits:

Please rebase your branch to remove these commits.

click here for bot help

@ansibot ansibot added merge_commit This PR contains at least one merge commit. Please resolve! needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html and removed community_review In order to be merged, this PR must follow the community review workflow. labels Mar 20, 2018
@ansibot
Copy link
Contributor

ansibot commented Mar 20, 2018

The test ansible-test sanity --test validate-modules [explain] failed with 1 error:

lib/ansible/modules/cloud/openstack/os_user.py:0:0: E324 Value for "default" from the argument_spec (None) for "update_password" does not match the documentation ('None')

click here for bot help

@ansibot ansibot added ci_verified Changes made in this PR are causing tests to fail. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Mar 20, 2018
@ansibot ansibot added community_review In order to be merged, this PR must follow the community review workflow. and removed ci_verified Changes made in this PR are causing tests to fail. merge_commit This PR contains at least one merge commit. Please resolve! needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Mar 20, 2018
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Mar 28, 2018
@ansibot
Copy link
Contributor

ansibot commented May 15, 2018

cc @omgjlk
click here for bot help

@ansibot ansibot added the affects_2.6 This issue/PR affects Ansible v2.6 label May 23, 2018
Copy link
Contributor

@emonty emonty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shipit

@ansibot ansibot removed community_review In order to be merged, this PR must follow the community review workflow. support:community This issue/PR relates to code supported by the Ansible community. labels Sep 15, 2018
@ansibot ansibot added core_review In order to be merged, this PR must follow the core review workflow. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Sep 15, 2018
@ansibot ansibot added community_review In order to be merged, this PR must follow the community review workflow. support:community This issue/PR relates to code supported by the Ansible community. and removed core_review In order to be merged, this PR must follow the core review workflow. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Oct 9, 2018
@ansibot
Copy link
Contributor

ansibot commented Oct 10, 2018

@bingoarun: thank you for submitting this pull-request!

cc @mnaser
click here for bot help

@mnaser
Copy link
Contributor

mnaser commented Oct 13, 2018

shipit

@ansibot ansibot added shipit This PR is ready to be merged by Core automerge This PR was automatically merged by ansibot. and removed community_review In order to be merged, this PR must follow the community review workflow. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Oct 13, 2018
@ansibot ansibot merged commit 5b3e009 into ansible:devel Oct 14, 2018
Tomorrow9 pushed a commit to Tomorrow9/ansible that referenced this pull request Dec 4, 2018
@ansible ansible locked and limited conversation to collaborators Jul 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.6 This issue/PR affects Ansible v2.6 automerge This PR was automatically merged by ansibot. bug This issue/PR relates to a bug. cloud module This issue/PR relates to a module. new_contributor This PR is the first contribution by a new community member. openstack shipit This PR is ready to be merged by Core support:community This issue/PR relates to code supported by the Ansible community.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ability to create OpenStack users without password
5 participants