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

VMware: Update vmware_object_role_permission to allow permissions at root folder #50465

Merged
merged 2 commits into from
Mar 4, 2019

Conversation

vmwjoseph
Copy link
Contributor

SUMMARY

Bug fixes

  • self.is_group wasn't set when applying permissions to users.
  • Use to_native for exceptions.

Enhancements

  • Add check mode.
  • Add ability to apply permission at the root folder level.
  • Cleanup formatting
ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

vmware_object_role_permission

ADDITIONAL INFORMATION

Before changes - when applying to a principal that isn't a group

The full traceback is:
Traceback (most recent call last):
  File "/tmp/ansible_YZIAiT/ansible_module_vmware_object_role_permission.py", line 238, in <module>
    main()
  File "/tmp/ansible_YZIAiT/ansible_module_vmware_object_role_permission.py", line 233, in main
    vmware_object_permission = VMwareObjectRolePermission(module)
  File "/tmp/ansible_YZIAiT/ansible_module_vmware_object_role_permission.py", line 127, in __init__
    self.perm = self.setup_permission()
  File "/tmp/ansible_YZIAiT/ansible_module_vmware_object_role_permission.py", line 169, in setup_permission
    perm.group = self.is_group
AttributeError: 'VMwareObjectRolePermission' object has no attribute 'is_group'

failed: [10.193.30.210 -> localhost] (item={u'object_name': u'N-folder', u'object_type': u'Folder', u'role': u'N-User', u'principal': u'myuser'}) => {
    "changed": false, 
    "item": {
        "object_name": "N-folder", 
        "object_type": "Folder", 
        "principal": "myuser", 
        "role": "N-User"
    }, 
    "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/ansible_YZIAiT/ansible_module_vmware_object_role_permission.py\", line 238, in <module>\n    main()\n  File \"/tmp/ansible_YZIAiT/ansible_module_vmware_object_role_permission.py\", line 233, in main\n    vmware_object_permission = VMwareObjectRolePermission(module)\n  File \"/tmp/ansible_YZIAiT/ansible_module_vmware_object_role_permission.py\", line 127, in __init__\n    self.perm = self.setup_permission()\n  File \"/tmp/ansible_YZIAiT/ansible_module_vmware_object_role_permission.py\", line 169, in setup_permission\n    perm.group = self.is_group\nAttributeError: 'VMwareObjectRolePermission' object has no attribute 'is_group'\n", 
    "module_stdout": "", 
    "msg": "MODULE FAILURE", 
    "rc": 1
}

After changes

changed: [10.193.30.210 -> localhost] => (item={u'object_name': u'N-Folder', u'object_type': u'Folder', u'role': u'N-User', u'principal': u'myuser'}) => {
    "changed": true, 
    "invocation": {
        "module_args": {
            "group": null, 
            "hostname": "10.193.30.210", 
            "object_name": "N-Folder", 
            "object_type": "Folder", 
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", 
            "port": 443, 
            "principal": "myuser", 
            "recursive": true, 
            "role": "N-User", 
            "state": "present", 
            "username": "administrator@vsphere.local", 
            "validate_certs": false
        }
    }, 
    "item": {
        "object_name": "N-Folder", 
        "object_type": "Folder", 
        "principal": "myuser", 
        "role": "N-User"
    }
}

@ansibot
Copy link
Contributor

ansibot commented Jan 2, 2019

@ansibot
Copy link
Contributor

ansibot commented Jan 2, 2019

@vmwjoseph, just so you are aware we have a dedicated Working Group for vmware.
You can find other people interested in this in #ansible-vmware on Freenode IRC
For more information about communities, meetings and agendas see https://github.com/ansible/community

click here for bot help

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 cloud community_review In order to be merged, this PR must follow the community review workflow. feature This issue/PR relates to a feature request. 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. support:community This issue/PR relates to code supported by the Ansible community. traceback This issue/PR includes a traceback. vmware VMware community labels Jan 2, 2019
@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 Jan 10, 2019
@ansibot
Copy link
Contributor

ansibot commented Feb 19, 2019

@ansibot
Copy link
Contributor

ansibot commented Feb 27, 2019

@Akasurde Akasurde changed the title Update vmware_object_role_permission to allow permissions at root folder VMware: Update vmware_object_role_permission to allow permissions at root folder Feb 28, 2019
@Akasurde Akasurde removed the needs_triage Needs a first human triage before being processed. label Feb 28, 2019
@Akasurde Akasurde self-requested a review February 28, 2019 09:53
@ansibot ansibot removed 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 Feb 28, 2019
Copy link
Member

@Akasurde Akasurde left a comment

Choose a reason for hiding this comment

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

LGTM

@Akasurde
Copy link
Member

@pdellaert @dericcrago @Im0 @ckotte @jeking3 @Tomorrow9 Could you please review this ?

Copy link
Contributor

@jeking3 jeking3 left a comment

Choose a reason for hiding this comment

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

More reformatting done than fixing and enabled check_mode, the real fix is at lines 207-209.

@Akasurde Akasurde merged commit 3fb383b into ansible:devel Mar 4, 2019
@ansible ansible locked and limited conversation to collaborators Jul 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.8 This issue/PR affects Ansible v2.8 cloud community_review In order to be merged, this PR must follow the community review workflow. feature This issue/PR relates to a feature request. module This issue/PR relates to a module. new_contributor This PR is the first contribution by a new community member. support:community This issue/PR relates to code supported by the Ansible community. traceback This issue/PR includes a traceback. vmware VMware community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants