vmware-archive / vcd-cli

Command Line Interface for VMware vCloud Director
https://vmware.github.io/vcd-cli
Other
165 stars 106 forks source link

Error: 'Client' object has no attribute 'rehydrate' #511

Open stephaneclavel opened 4 years ago

stephaneclavel commented 4 years ago

Hello

I fail to install vcd-cli properly it seems. I followed https://vmware.github.io/vcd-cli/install.html instructions for CentOS.

I face below issues:

What is it that I'm doing wrong?

Trying to connect to vCD10

[cse@vcd10-cse-client2 ~]$ vcd login vcd10.nce.sita.aero tenant1 cse -p **** -w -i Usage: vcd login [OPTIONS] host organization user Try "vcd login -h" for help.

Error: 'Client' object has no attribute 'get_latest_api_version' [cse@vcd10-cse-client2 ~]$ vcd login vcd10.nce.sita.aero tenant1 cse -p **** -w -i -V 32.0 cse logged in, org: 'tenant1', vdc: 'tenant1-cse-vdc' [cse@vcd10-cse-client2 ~]$ vcd network list Usage: vcd network list [OPTIONS] Try "vcd network list -h" for help.

Error: 'Client' object has no attribute 'rehydrate' [cse@vcd10-cse-client2 ~]$ vcd logout Usage: vcd logout [OPTIONS] Try "vcd logout -h" for help.

Error: Not logged in.

Trying to connect to vCD9.5

[cse@vcd10-cse-client2 ~]$ vcd login ncelab.aticloud.aero cse_tenant1 orgadmin --password **** -w -i Usage: vcd login [OPTIONS] host organization user Try "vcd login -h" for help.

Error: 'Client' object has no attribute 'get_latest_api_version' [cse@vcd10-cse-client2 ~]$ vcd login ncelab.aticloud.aero cse_tenant1 orgadmin --password **** -w -i -V 31.0 Usage: vcd login [OPTIONS] host organization user Try "vcd login -h" for help.

Error: HTTPSConnectionPool(host='ncelab.aticloud.aero', port=443): Max retries exceeded with url: /api/sessions (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f134b81b160>: Failed to establish a new connection: [Errno 110] Connection timed out',))

thanks

fnoorden-vs commented 4 years ago

I am having the same problem: drwxr-xr-x. 5 root root 80 Jan 8 12:48 pyvcloud drwxr-xr-x. 2 root root 4096 Jan 8 12:48 pyvcloud-21.0.1.dev7.dist-info drwxr-xr-x. 4 root root 4096 Jan 8 12:48 vcd_cli drwxr-xr-x. 2 root root 4096 Jan 8 12:48 vcd_cli-22.0.0.dist-info

PS /root/scripts> vcd login $h.server vsc $h.user -p $h.pass -i -w -v 'VSC Bronze C07' Usage: vcd login [OPTIONS] host organization user Try "vcd login -h" for help.

Error: 'Client' object has no attribute 'get_latest_api_version' PS /root/scripts> vcd login $h.server vsc $h.user -p $h.pass -i -w -v 'VSC Bronze C07' -V 31.0 rest-api2 logged in, org: 'vsc', vdc: 'VSC Bronze C07' PS /root/scripts> vcd org list Usage: vcd org list [OPTIONS] Try "vcd org list -h" for help.

Error: 'Client' object has no attribute 'rehydrate' PS /root/scripts> vcd vm list Usage: vcd vm list [OPTIONS] Try "vcd vm list -h" for help.

Error: not implemented PS /root/scripts> vcd vdc use 'VSC Bronze C01' Usage: vcd vdc use [OPTIONS] Try "vcd vdc use -h" for help.

Error: 'Client' object has no attribute 'rehydrate'

fnoorden-vs commented 4 years ago

It seems to be caused by the latest commits by rocknes in vmware/vcd-cli AND vmware/pyvcloud: [VCDA - 1341] Added JWT based authorization support in vcd-cli [VCDA 1336, 1337, 1338, 1339] - Added support for vCD JWT token in pyvcloud

After removing the commits in a test environment everything was OK again.

S-MaN14th commented 4 years ago

Same issue while attempting to login: Tried with commit e37d13c5f1c66e18cd29cad4bf14cf4b07a0dadc and 73765e920f988011fb0921c7c6a3b1da4f43d1fb based on the comment of @fnoorden-vs vcd login test.com org1 user

Traceback (most recent call last):
  File "/Users/user01/python-virt-env/vcloud/lib/python3.7/site-packages/vcd_cli/login.py", line 143, in login
    api_version = client.get_latest_api_version()
AttributeError: 'Client' object has no attribute 'get_latest_api_version'
fnoorden-vs commented 4 years ago

@SumithManiath commit e37d13c and 73765e9 are both vmware/vcd-cli commits. You should use the commits from pyvcloud and vcd-cli before the latest commits of Rocknes, which are: [VCDA - 1341] Added JWT based authorization support in vcd-cli [VCDA 1336, 1337, 1338, 1339] - Added support for vCD JWT token in pyvcloud

stephaneclavel commented 4 years ago

@fnoorden-vs thanks a lot. I'm quite away from my confort zone here.

I tried pip install -e git://github.com/vmware/vcd-cli.git@73765e920f988011fb0921c7c6a3b1da4f43d1fb#egg=vcd-cli

to install one of the 2 commits you gave but I still get the "rehydrate" issue. Would you please so kind to let me know how to proceed here ?

thanks

fnoorden-vs commented 4 years ago

@fnoorden-vs thanks a lot. I'm quite away from my confort zone here.

I tried pip install -e git://github.com/vmware/vcd-cli.git@73765e9#egg=vcd-cli

to install one of the 2 commits you gave but I still get the "rehydrate" issue. Would you please so kind to let me know how to proceed here ?

thanks

Are you familiar with git? In that case git clone and git revert will do the work for you. Otherwise the easiest way will be:

  1. go to https://github.com/vmware/vcd-cli/commits/master
  2. browse the repository after 73765e9
  3. copy the contents of the following files in 73765e9 to the respective files on your computer: vcd_cli/login.py vcd_cli/profiles.py vcd_cli/task.py vcd_cli/utils.py
  4. go to https://github.com/vmware/pyvcloud/commits/master
  5. browse the repository after 614b137
  6. copy the contents of the following file in 614b137 to the respective files on your computer: pyvcloud/vcd/client.py

Then run your test.

stephaneclavel commented 4 years ago

@fnoorden-vs thanks again, git revert solved my issue.

Yet, shall I put this issue as closed? Last commit should be removed and/or reworked.

fnoorden-vs commented 4 years ago

@fnoorden-vs thanks again, git revert solved my issue.

Yet, shall I put this issue as closed? Last commit should be removed and/or reworked.

No, the issue should not be closed.

rocknes commented 4 years ago

Latest released version of pyvcloud will work with latest released version of vcd-cli. Latest dev version of pyvcloud with work with latest dev version of vcd-cli.

The above mentioned error will occur if you have dev version of pyvcloud with released version of vcd-cli.

To fix the issue install vcd-cli with --pre flag (will pull the dev version)

pip install vcd-cli --pre
# Will install vcd-cli 22.0.1.dev3 and pyvcloud 21.0.1.dev7

Alternatively you can manually uninstall pyvcloud and reinstall it at released version

pip install vcd-cli
pip uninstall pyvcloud --yes
pip install pyvcloud
# Will install vcd-cli 22.0.0 and pyvcloud 21.0.0

Or if you are installing from source, make sure that your pyvcloud is updated properly. This can be ensured by rebuilding vcd-cli python setup.py develop (Run it at the root of vcd-cli project)

Note: If you are on a system where both python2 and python3 are installed, please use pip3 and python3 instead of pip and python.

rocknes commented 4 years ago

To clarify why this issue is cropping up,

The last release of vcd-cli specifies a dev version of pyvcloud, which is wrong in my opinion. Release versions shouldn't depend on dev version of other libraries.

https://github.com/vmware/vcd-cli/blob/22.0.0/requirements.txt

This dependency should have been pyvcloud >= 21.0.0 instead of pyvcloud >= 20.1.1.dev26

This dependency is allowing pip to pull newer dev versions of pyvcloud which are not compatible with older builds of vcd-cli. More info at https://pip.pypa.io/en/stable/reference/pip_install/#pre-release-versions Hope this clarifies the underlying cause of the issue. The fix I mentioned above will work for release, dev as well as src built vcd-cli.

stephaneclavel commented 4 years ago

Thanks for inputs.

When installing with "pip install vcd-cli --pre", I still got same error when using cse.

When installing with: pip install vcd-cli pip uninstall pyvcloud --yes pip install pyvcloud I got cse working properly so far.

thanks

rocknes commented 4 years ago

Hi Stephan, glad to know that you got CSE to work :)

If you already have vcd-cli installed then pip install vcd-cli --pre will be a no-op :( I think you will need to add --upgrade flag to it, to force an update.

Procellariums commented 4 years ago

"If you already have vcd-cli installed then pip install vcd-cli --pre will be a no-op :( I think you will need to add --upgrade flag to it, to force an update." That's right.

S-MaN14th commented 4 years ago

@SumithManiath commit e37d13c and 73765e9 are both vmware/vcd-cli commits. You should use the commits from pyvcloud and vcd-cli before the latest commits of Rocknes, which are: [VCDA - 1341] Added JWT based authorization support in vcd-cli [VCDA 1336, 1337, 1338, 1339] - Added support for vCD JWT token in pyvcloud

pip3 install git+git://github.com/vmware/vcd-cli.git This fixed the issue for me

daydrim commented 4 years ago

It still works only with vcd-cli==22.0.0 and pyvloud==21.0.0 It won't work with vcd-cli 22.0.2 and pyvcloud 21.0.1 so the latest release doesn't completely work with cse