This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%if 0%{?fedora} | |
%global _with_python3 1 | |
%endif | |
%if 0%{?rhel} && 0%{?rhel} <= 6 | |
%{!?__python2: %global __python2 /usr/bin/python2} | |
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} | |
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} | |
%endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interactions: | |
- request: | |
body: <rule xmlns="http://www.vmware.com/UM"><vcServer>172.16.214.129</vcServer><customerName>1018700</customerName><objectType>Data | |
Center</objectType><valueType>Unique ID</valueType><value>datacenter-104</value></rule> | |
headers: | |
Accept: ['*/*'] | |
Accept-Encoding: ['gzip, deflate'] | |
Connection: [keep-alive] | |
Content-Length: ['214'] | |
Content-Type: [text/xml] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interactions: | |
- request: | |
body: <rule xmlns="http://www.vmware.com/UM"><customerName>1018700</customerName><objectType>Data | |
Center</objectType><valueType>Unique ID</valueType><value>datacenter-104</value><vcServerId>172.16.214.129</vcServerId></rule> | |
headers: | |
Accept: ['*/*'] | |
Accept-Encoding: ['gzip, deflate'] | |
Connection: [keep-alive] | |
Content-Length: ['205'] | |
Content-Type: [text/xml] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import atexit | |
from pyVim.connect import SmartConnect, Disconnect | |
from pyVmomi import vim | |
from tools import cli | |
# connect to vcenter | |
PARSER = cli.build_arg_parser() | |
PARSER.add_argument("-m", "--mename", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# list_one always has fewer list items than list 2 | |
# both lists have several thousand items in them | |
list_one = [ | |
{"acct": "12345a","moref":"dc-12"}, | |
{"acct":"132132","moref":"dc-332"} | |
] | |
list_two = [ | |
{"acct":"132132","cc":"US","zip":"77722"}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2014 Michael Rice <[email protected]> | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interactions: | |
- request: | |
body: null | |
headers: | |
Accept: ['*/*'] | |
Accept-Encoding: ['gzip, deflate'] | |
Connection: [keep-alive] | |
User-Agent: [python-requests/2.4.1 CPython/2.7.8 Darwin/13.4.0] | |
method: GET | |
uri: https://10.12.254.119:443//sdk/vimServiceVersions.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> from pyVmomi import vim | |
>>> dc = vim.Datacenter('datacenter-33') | |
>>> dc | |
'vim.Datacenter:datacenter-33' | |
>>> dir(dc) | |
['Array', 'Destroy', 'Destroy_Task', 'PowerOnMultiVM_Task', 'PowerOnVm', 'QueryConfigOptionDescriptor', 'QueryConnectionInfo', 'Reconfigure', 'ReconfigureDatacenter_Task', 'Reload', 'Rename', 'Rename_Task', 'SetCustomValue', '_GetMethodInfo', '_GetMethodList', '_GetMoId', '_GetPropertyInfo', '_GetPropertyList', '_GetServerGuid', '_GetStub', '_InvokeAccessor', '_InvokeMethod', '__class__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_methodInfo', '_moId', '_propInfo', '_propList', '_serverGuid', '_stub', '_version', '_wsdlName', 'alarmActionsEnabled', 'availableField', 'configIssue', 'configStatus', 'configuration', 'customValue', 'datastore', 'datastoreFolder', 'declaredAlarmState', 'disabl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> children = content.rootFolder.childEntity | |
>>> hosts = children[0].hostFolder.childEntity | |
>>> hosts[0].host[0].licensableResource | |
(vim.LicenseManager.LicensableResourceInfo) { | |
dynamicType = <unset>, | |
dynamicProperty = (vmodl.DynamicProperty) [], | |
resource = (vmodl.KeyAnyValue) [ | |
(vmodl.KeyAnyValue) { | |
dynamicType = <unset>, | |
dynamicProperty = (vmodl.DynamicProperty) [], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List buildRDMInformation(Inventory inventory) { | |
// To store the RDM information | |
List rdmInfos = [] | |
// For each VM in the inventory | |
inventory.vms.each { vm -> | |
// Get the host | |
Host h = (Host) vm.host |