vmware / vmware/pyvmomi

Argument type with FileManager.MakeDirectory

Open
#320 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs verification
Dominant language
Python
Stars
2.3k
Forks
763
PR merge metrics
No merged PRs in 30d

Description

Hi,

I have a issue with this function, it seems there is a problem while parsing argument.
I have the following code :

  ..         
  print type(datacenter)
  file_manager.MakeDirectory("[datastore1]/myvm/", datacenter)
  ...

Here the error and ouput :

<class 'pyVmomi.VmomiSupport.vim.Datacenter'>

File "myapp/vmware/vim.py", line 109, in manage_volumes
    file_manager.MakeDirectory("[datastore1]/myvm/", datacenter)
  File "/myapp/.venv/fabenv/lib/python2.7/site-packages/pyVmomi/VmomiSupport.py", line 560, in __call__
    return self.f(*args, **kwargs)
  File "/myapp/.venv/fabenv/lib/python2.7/site-packages/pyVmomi/VmomiSupport.py", line 374, in _InvokeMethod
    map(CheckField, info.params, args)
  File "/myapp/.venv/fabenv/lib/python2.7/site-packages/pyVmomi/VmomiSupport.py", line 949, in CheckField
    % (info.name, info.type.__name__, valType.__name__))
TypeError: For "name" expected type str, but got vim.Datacenter

Fatal error: One or more hosts failed while executing task 'process_run_vmware_item'

Underlying exception:
    For "name" expected type str, but got vim.Datacenter

Aborting.
1 failure(s) out of 0.

Do you have any ideas ?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by checking the MakeDirectory invocation and the argument validation path shown in pyVmomi/VmomiSupport.py, especially _InvokeMethod and CheckField. Confirm the declared parameter order and reproduce the reported TypeError with the supplied call. Done should be a documented or tested resolution that clearly distinguishes the accepted argument types.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.