Created
September 19, 2014 19:40
-
-
Save michaelrice/bcd760c6fb20f7d4131f to your computer and use it in GitHub Desktop.
causes bork
This file contains hidden or 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", | |
| required=False, | |
| action="store", | |
| help="Optional MOR of the ManagedEntity to query for taks on. Example: vm-123") | |
| MY_ARGS = PARSER.parse_args() | |
| cli.prompt_for_password(MY_ARGS) | |
| SI = SmartConnect(host=MY_ARGS.host, | |
| user=MY_ARGS.user, | |
| pwd=MY_ARGS.password, | |
| port=MY_ARGS.port) | |
| atexit.register(Disconnect, SI) | |
| # get task manager | |
| TASKMAN = SI.content.taskManager | |
| THC = TASKMAN.CreateCollectorForTasks | |
| TFS = vim.TaskFilterSpec() | |
| THS = THC(TFS) | |
| #print dir(THS) | |
| TILIST = THS.latestPage | |
| print type(TILIST) | |
| print TILIST[0] |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Traceback (most recent call last):
File "task_history_mon.py", line 46, in
print TILIST[0]
File "/Users/errr/venvs/pyVmomi/lib/python2.7/site-packages/pyVmomi/VmomiSupport.py", line 290, in FormatObject
for prop in val._GetPropertyList()]), indent * " ")
File "/Users/errr/venvs/pyVmomi/lib/python2.7/site-packages/pyVmomi/VmomiSupport.py", line 313, in FormatObject
result = Iso8601.ISO8601Format(val)
NameError: global name 'Iso8601' is not defined