mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Remove print statements
This commit is contained in:
parent
d051701359
commit
222f9bc08a
2 changed files with 1 additions and 34 deletions
|
@ -129,7 +129,7 @@ import atexit
|
|||
import os
|
||||
import ssl
|
||||
import time
|
||||
from pprint import pprint
|
||||
|
||||
from ansible.module_utils.urls import fetch_url
|
||||
|
||||
class PyVmomiHelper(object):
|
||||
|
@ -237,8 +237,6 @@ class PyVmomiHelper(object):
|
|||
self.params['esxi']['datacenter'])
|
||||
self.folders = self._build_folder_tree(self.datacenter.vmFolder)
|
||||
self.folder_map = self._build_folder_map(self.folders)
|
||||
#pprint(self.folder_map)
|
||||
#sys.exit(1)
|
||||
return (self.folders, self.folder_map)
|
||||
|
||||
|
||||
|
@ -471,7 +469,6 @@ class PyVmomiHelper(object):
|
|||
clonespec = vim.vm.CloneSpec()
|
||||
clonespec.location = relospec
|
||||
|
||||
print "cloning VM..."
|
||||
template = get_obj(self.content, [vim.VirtualMachine], self.params['template_src'])
|
||||
task = template.Clone(folder=destfolder, name=self.params['guest'], spec=clonespec)
|
||||
self.wait_for_task(task)
|
||||
|
@ -480,21 +477,11 @@ class PyVmomiHelper(object):
|
|||
return ({'changed': False, 'failed': True, 'msg': task.info.error.msg})
|
||||
else:
|
||||
|
||||
#import epdb; epdb.st()
|
||||
vm = task.info.result
|
||||
|
||||
#if wait_for_ip and not poweron:
|
||||
# print "powering on the VM ..."
|
||||
# self.set_powerstate(vm, 'poweredon')
|
||||
|
||||
if wait_for_ip:
|
||||
print "powering on the VM ..."
|
||||
self.set_powerstate(vm, 'poweredon', force=False)
|
||||
print "waiting for IP ..."
|
||||
self.wait_for_vm_ip(vm)
|
||||
|
||||
vm_facts = self.gather_facts(vm)
|
||||
#import epdb; epdb.st()
|
||||
return ({'changed': True, 'failed': False, 'instance': vm_facts})
|
||||
|
||||
|
||||
|
@ -503,7 +490,6 @@ class PyVmomiHelper(object):
|
|||
# https://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/vim.TaskInfo.html
|
||||
# https://github.com/virtdevninja/pyvmomi-community-samples/blob/master/samples/tools/tasks.py
|
||||
while task.info.state not in ['success', 'error']:
|
||||
print(task.info.state)
|
||||
time.sleep(1)
|
||||
|
||||
def wait_for_vm_ip(self, vm, poll=100, sleep=5):
|
||||
|
@ -511,10 +497,8 @@ class PyVmomiHelper(object):
|
|||
facts = {}
|
||||
thispoll = 0
|
||||
while not ips and thispoll <= poll:
|
||||
print "polling for IP"
|
||||
newvm = self.getvm(uuid=vm.config.uuid)
|
||||
facts = self.gather_facts(newvm)
|
||||
print "\t%s %s" % (facts['ipv4'], facts['ipv6'])
|
||||
if facts['ipv4'] or facts['ipv6']:
|
||||
ips = True
|
||||
else:
|
||||
|
|
|
@ -81,7 +81,6 @@ import atexit
|
|||
import os
|
||||
import ssl
|
||||
import time
|
||||
from pprint import pprint
|
||||
|
||||
from ansible.module_utils.urls import fetch_url
|
||||
|
||||
|
@ -191,8 +190,6 @@ class PyVmomiHelper(object):
|
|||
self.params['esxi']['datacenter'])
|
||||
self.folders = self._build_folder_tree(self.datacenter.vmFolder)
|
||||
self.folder_map = self._build_folder_map(self.folders)
|
||||
#pprint(self.folder_map)
|
||||
#sys.exit(1)
|
||||
return (self.folders, self.folder_map)
|
||||
|
||||
|
||||
|
@ -435,7 +432,6 @@ class PyVmomiHelper(object):
|
|||
clonespec.location = relospec
|
||||
#clonespec.powerOn = power_on
|
||||
|
||||
print "cloning VM..."
|
||||
template = get_obj(self.content, [vim.VirtualMachine], self.params['template_src'])
|
||||
task = template.Clone(folder=destfolder, name=self.params['guest'], spec=clonespec)
|
||||
self.wait_for_task(task)
|
||||
|
@ -444,21 +440,11 @@ class PyVmomiHelper(object):
|
|||
return ({'changed': False, 'failed': True, 'msg': task.info.error.msg})
|
||||
else:
|
||||
|
||||
#import epdb; epdb.st()
|
||||
vm = task.info.result
|
||||
|
||||
#if wait_for_ip and not poweron:
|
||||
# print "powering on the VM ..."
|
||||
# self.set_powerstate(vm, 'poweredon')
|
||||
|
||||
if wait_for_ip:
|
||||
print "powering on the VM ..."
|
||||
self.set_powerstate(vm, 'poweredon', force=False)
|
||||
print "waiting for IP ..."
|
||||
self.wait_for_vm_ip(vm)
|
||||
|
||||
vm_facts = self.gather_facts(vm)
|
||||
#import epdb; epdb.st()
|
||||
return ({'changed': True, 'failed': False, 'instance': vm_facts})
|
||||
|
||||
|
||||
|
@ -467,7 +453,6 @@ class PyVmomiHelper(object):
|
|||
# https://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/vim.TaskInfo.html
|
||||
# https://github.com/virtdevninja/pyvmomi-community-samples/blob/master/samples/tools/tasks.py
|
||||
while task.info.state not in ['success', 'error']:
|
||||
print(task.info.state)
|
||||
time.sleep(1)
|
||||
|
||||
def wait_for_vm_ip(self, vm, poll=100, sleep=5):
|
||||
|
@ -475,10 +460,8 @@ class PyVmomiHelper(object):
|
|||
facts = {}
|
||||
thispoll = 0
|
||||
while not ips and thispoll <= poll:
|
||||
print "polling for IP"
|
||||
newvm = self.getvm(uuid=vm.config.uuid)
|
||||
facts = self.gather_facts(newvm)
|
||||
print "\t%s %s" % (facts['ipv4'], facts['ipv6'])
|
||||
if facts['ipv4'] or facts['ipv6']:
|
||||
ips = True
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue