vmware-archive/vcd-ext-samples

upload plugin API : Content Length is Invalid

Closed this issue · 10 comments

Describe the bug
I run vcd 9.1 in my environment , i am using vcd 9.1 plugin seed vcd-ext-samples-plugin-seed-9.1 link : https://github.com/vmware-samples/vcd-ext-samples/tree/plugin-seed-9.1

upon upload of the plugin , i get content length is invalid error via POSTMAN

To Reproduce
Steps to reproduce the behavior:

  1. create a session for sys admin user : i created a session and obtained the x-vcloud-authorization token
    2.register the plugin, providing the same values as in the manifest.json : i provided the values of the
    {
    "urn": "vmware:vcloud:plugin:seed",
    "name": "Simple plugin",
    "containerVersion": "9.1.0",
    "version": "1.0.0",
    "scope": ["service-provider", "tenant"],
    "permissions": [],
    "description": "An example plugin.",
    "vendor": "VMware",
    "license": "Copyright (C) VMware 2017-2018. All rights reserved.",
    "link": "http://www.vmware.com/support",
    "module": "SimplePluginModule",
    "route": "plugin"
    }

3.enable upload on the newly registered plugin (endpoint is in the Location header of
previous response) :
--data '{"fileName": "plugin.zip", "size": 56623}'
I passed the same value in the sample 56623 as file size

  1. Upload plugin.zip to vCloud Director : I use the link response of the enable upload API result header as my URL
    Expected behavior
    I expected to receive a 200 ok , upload successful
    Screenshots

Desktop (please complete the following information):

  • OS: [e.g. windows10]
  • Browser [e.g. chrome]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

I passed the same value in the sample 56623 as file size

you need to use the actual size of the file (in bytes) that you are uploading. The sample number is just that–a sample.

Do i need to un register the plugin and start the process again ?

Yes
The Python scripts give a better experience for managing plugins vs. the pure manual API method if you are interested: https://github.com/vmware-samples/vcd-ext-samples/tree/plugin-manager

what are you specifying to make the unregister call?

The value you specify should be the entire URN returned for the id field in the list command, not just the UUID part

Excellent!