Re-uploading a preinstalled default plugin which has been deleted from Cloud Director
search cancel

Re-uploading a preinstalled default plugin which has been deleted from Cloud Director

book

Article ID: 320437

calendar_today

Updated On:

Products

VMware Cloud Director

Issue/Introduction

  • One of the preinstalled default plugins has been disabled and deleted accidentally from Cloud Director, for example:
    • Customize Portal
    • Solution Add-On Management UI Plugin
    • NgHyperPlugin
    • Other default plugins
  • The plugin is one which is installed automatically during install or upgrade of Cloud Director and a download is not available on VMware Customer Connect.
  • Customize Portal plugin has been deleted and plugin management is not available in the Cloud Director UI.


Environment

VMware Cloud Director 10.x

Cause

Cloud Director has a number of default plugins present as part of install or upgrade.
Default plugins should only be disabled and deleted from Cloud Director if a newer version is present and enabled.

Resolution

  • Default plugins do not have a separate direct download available on VMware Customer Connect.
  • If these plugins are disabled or deleted from Cloud Director the Cloud Director database will need to be restored from a backup taken before the plugins were deleted, Backup and Restore of Your VMware Cloud Director Appliance
  • Alternatively, the deleted default plugin can be retrieved from one of the Cloud Director Cells in the cluster and re-uploaded as per the workaround below.

Workaround:

    • The preinstalled default plugins can be retrieved for upload from a Cloud Director Cell by running the script, unpack_plugins.sh, attached to this KB.
    • Even when the plugin has been deleted from Cloud Director it can still be retrieved from the same Cells for re-upload. Example steps are as follows:

1. Backup Cloud Director before making any changes, Backup and Restore of Your VMware Cloud Director Appliance

2. Download the script from this KB, unpack_plugins.sh, and upload it to the /tmp directory on one of the Cloud Director Cells in the cluster:

/tmp/unpack_plugins.sh

3. SSH to this Cloud Director Cell where the script has been uploaded.

4. Modify the script to make it executable:

chmod u+x /tmp/unpack_plugins.sh

5. Run the script to extract all of the default plugins which Cloud Director would install on initial setup or upgrade:

/tmp/unpack_plugins.sh

6. List the extracted plugins which have been extracted as ZIP files ready for upload to Cloud Director:

ls -l /tmp/cloud-director-solutions-1.0.0/AllPlugins

7. Download the ZIP from the Cloud Director Cell for the plugin which is to be re-uploaded.

8. Log into the Cloud Director Provider portal as a System Administrator.

9. Navigate to More, Customize Portal, and upload the plugin ZIP as per the documentation, Upload a Plug-in to Your VMware Cloud Director.

If the Customize Portal plugin is missing as it was deleted then uploading through the Cloud Director UI will not be available. Instead, the Customize Portal plugin must be re-uploaded using the Cloud Director API as follows:

  1. Extract the manifest.json file from the Customize Portal ZIP retrieved using the steps above and open it in a text editor.
  2. Take the version value from the manifest.json and populate the version field in the following JSON:
{
    "pluginName": "Customize Portal",
    "description": "Customize Portal is UI Plugin for UI Plugin management.",
    "enabled": true,
    "license": "MIT",
    "link": "http://www.vmware.com",
    "vendor": "VMware",
    "version": "<PLUGIN_VERSION>",
    "tenant_scoped": false,
    "provider_scoped": true
}

For example, in a Cloud Director 10.5.1 environment the manifest.json would have "version": "4.0.0" and the so we would construct the JSON as follows:

{
    "pluginName": "Customize Portal",
    "description": "Customize Portal is UI Plugin for UI Plugin management.",
    "enabled": true,
    "license": "MIT",
    "link": "http://www.vmware.com",
    "vendor": "VMware",
    "version": "4.0.0",
    "tenant_scoped": false,
    "provider_scoped": true
}

  1. Save this JSON as customize-portal.json and move it to a client machine which has curl or another REST API client installed.
  2. Move the Customize Portal ZIP to a client machine which has curl or another REST API client installed.
  3. From this client machine log in to Cloud Director as a System Administrator via the API and retrieve a session token.
For more information on this process see the How to establish an API connection VMware Cloud Director (56948).
  1. Using the JSON file from step 3 above, and the session token from step 4 above, send the following API call to Cloud Director to recreate the Customize Portal Extension:
curl -k -H 'Accept: application/json;version=<VCD_API_VERSION>' -H 'Content-Type: application/json' -H 'Authorization: Bearer <SESSION_TOKEN>' -X POST https://<VCD_URL>/cloudapi/extensions/ui -d @customize-portal.json
  1. This API call should result in a JSON response including a new "id": "urn:vcloud:uiPlugin:<PLUGIN_UUID>" which should be noted for use later on in this process:
{
    "pluginName": "Customize Portal",
    "vendor": "VMware",
    "description": "Customize Portal is UI Plugin for UI Plugin management.",
    "version": "<PLUGIN_VERSION>",
    "license": "MIT",
    "link": "http://www.vmware.com",
    "tenant_scoped": false,
    "provider_scoped": true,
    "enabled": true,
    "id": "urn:vcloud:uiPlugin:<PLUGIN_UUID>",
    "plugin_status": "unavailable",
    "resourcePath": ""
}
  1. Construct JSON for the plugin upload using the name and size of the Customize Plugin ZIP which is to be uploaded:
{
  "fileName": "<FILE_NAME>",
  "size": <FILE_SIZE>
}


For example we would create the following for the Customize Portal plugin for Cloud Director 10.5.1:
{
  "fileName": "customize-portal_7991199_plugin.zip",
  "size": 353472
}
  1. Save this JSON as customize-portal-resource.json and move it to a client machine which has curl or another REST API client installed.
  2. Using the JSON file from step 9 above, and the session token from step 4 above, send the following API call to Cloud Director to initiate the upload of the plugin:
curl -kv -H 'Accept: application/json;version=<VCD_API_VERSION>' -H 'Content-Type: application/json' -H 'Authorization: Bearer <SESSION_TOKEN>' -X POST https://<VCD_URL>/cloudapi/extensions/ui/<PLUGIN_UUID>/plugin -d @customize-portal-resource.json
  1. This PUT should result in a 204 response and response headers which include a Link header which contains the path to which the plugin file needs to be uploaded:
Link: <https://<VCD_URL>/transfer/<TRANSFER_UUID>/<FILE_NAME>>;rel="upload:default";type="application/octet-stream"
  1. Using this Link in step 11 above construct and run an API call to upload the Customize Portal plugin ZIP file:
curl -kv -H 'Accept: application/json;version=<VCD_API_VERSION>' -H 'Content-Type: application/zip' -H 'Content-Range: bytes 0-<FILE_SIZE>/<FILE_SIZE>' -H 'Authorization: Bearer <SESSION_TOKEN>' -X PUT https://<VCD_URL>/transfer/<TRANSFER_UUID>/<FILE_NAME> --data-binary @<FILE_NAME>
  1. With the plugin file uploaded perform a GET on the plugins to confirm Customize Portal is listed, enabled, and ready:
curl -k -H 'Accept: application/json;version=<VCD_API_VERSION>' -H 'Authorization: Bearer <SESSION_TOKEN>' -X GET https://<VCD_URL>/cloudapi/extensions/ui

In the JSON response the Customize Portal plugin should be similar to the following:
{
    "pluginName": "Customize Portal",
    "vendor": "VMware",
    "description": "Customize Portal is UI Plugin for UI Plugin management.",
    "version": "<PLUGIN_VERSION>",
    "license": "MIT",
    "link": "http://www.vmware.com",
    "tenant_scoped": false,
    "provider_scoped": true,
    "enabled": true,
    "id": "urn:vcloud:uiPlugin:<PLUGIN_UUID>",
    "plugin_status": "ready",
    "resourcePath": "/tenant/System/uiPlugins/<PLUGIN_UUID>/<RESOURCE_UUID>"
}
  1. The final step is to log in to the Cloud Director Provider portal as a System Administrator to confirm the plugin is now available.

 

Additional Information

Impact/Risks:

Deleting default plugins from Cloud Director will have a negative impact on functionality.
Deleting the Customize Portal plugin will make management of plugins from the Cloud Director UI unavailable.


Attachments

unpack_plugins get_app