HewlettPackard / oneview-ansible

This project is no longer being developed and has limited support. Please use the newer Ansible Collection project: https://github.com/HewlettPackard/oneview-ansible-collection
Apache License 2.0
104 stars 65 forks source link

Unable to update scope with resource_assignments_updated #663

Closed freedge closed 3 years ago

freedge commented 3 years ago

Scenario/Intent

Adding server profile into an existing scope. Using API version 1200 or 1600, HPEOneview and Oneview collection v6.0.0

Environment Details

Steps to Reproduce

use oneview_scope with state: resource_assignments_updated

Expected Result

wish to have my scope updated

Actual Result

nothing change. from code:

     # This method is available only for API300
    def __update_resource_assignments(self):
        if self.oneview_client.api_version == 300:
            # returns None if scope doesn't exist

is it possible to change that into self.oneview_client.api_version >= 300 ? or can we amend the documentation to state if this module/state is still supported or not ?

VenkateshRavula commented 3 years ago

Hi @freedge , __update_resource_assignments method is not supported for api_version >= 300. To add new resources to the scope, you can simply use state == present and add addedResourceUris attribute in data.

Please refer to below code snippet. We will update the documentation for better understanding. Here addedResourceUris contains list of resources to be added to scope and removedResourceUris contains list of resources to be removed from scope.

    - name: Update a scope by adding new resources
      oneview_scope:
        config: '{{ config }}'
        state: present
        data:
          name: "{{ contents.scope_name }}"
          addedResourceUris:
            - "{{ ethernet_networks[0]['uri'] }}"
            - "{{ ethernet_networks[1]['uri'] }}"
          removedResourceUris:
            - "{{ ethernet_networks[2]['uri'] }}"
      delegate_to: localhost

Please close this issue if your issue got resolved.

freedge commented 3 years ago

thanks!