VMware: refactor vmware_datastore_facts (#36423)

This fix adds datastore cluster details about datastore in returning
facts. Updated documentation and tests.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2018-02-26 13:23:22 +05:30 committed by GitHub
commit d94a1ef4cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 68 additions and 56 deletions

View file

@ -1,21 +1,8 @@
# Test code for the vmware_datastore_facts module.
# (c) 2017, Tim Rightnour <thegarbledone@gmail.com>
# Copyright (c) 2017, Tim Rightnour <thegarbledone@gmail.com>
# Copyright (c) 2018, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
#
- name: make sure pyvmomi is installed
pip:
name: pyvmomi
@ -36,11 +23,11 @@
- name: kill vcsim
uri:
url: "{{ 'http://' + vcsim + ':5000/killall' }}"
url: http://{{ vcsim }}:5000/killall
- name: start vcsim
uri:
url: "{{ 'http://' + vcsim + ':5000/spawn?ds=2&datacenter=1&cluster=1&folder=0' }}"
url: http://{{ vcsim }}:5000/spawn?ds=2&datacenter=1&cluster=1&folder=0
register: vcsim_instance
- name: Wait for vcsim server to come up online
@ -51,7 +38,7 @@
- name: get a list of Clusters from vcsim
uri:
url: "{{ 'http://' + vcsim + ':5000/govc_find?filter=CCR' }}"
url: http://{{ vcsim }}:5000/govc_find?filter=CCR
register: clusters
- set_fact:
@ -59,7 +46,7 @@
- name: get a list of Datacenters from vcsim
uri:
url: "{{ 'http://' + vcsim + ':5000/govc_find?filter=DC' }}"
url: http://{{ vcsim }}:5000/govc_find?filter=DC
register: datacenters
- set_fact:
@ -67,7 +54,7 @@
- name: get a list of Datastores from vcsim
uri:
url: "{{ 'http://' + vcsim + ':5000/govc_find?filter=D' }}"
url: http://{{ vcsim }}:5000/govc_find?filter=D
register: datastores
- set_fact: