Skip to content

Instantly share code, notes, and snippets.

@michaelrice
Created September 19, 2014 19:40
Show Gist options
  • Select an option

  • Save michaelrice/bcd760c6fb20f7d4131f to your computer and use it in GitHub Desktop.

Select an option

Save michaelrice/bcd760c6fb20f7d4131f to your computer and use it in GitHub Desktop.
causes bork
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]
@michaelrice

Copy link
Copy Markdown
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment