VMware {code} Community
JFCooleBA
Contributor
Contributor
Jump to solution

o11n-package:import-package unable to sync workflows from vRO 8.10.2

I am building a plugin and created some stock workflows I want to distribute with it.

The package content in question is purely Workflows at this time.

I am running this command from my machine to do the package import with Maven:

mvn o11n-package:import-package -DserverUrl=vro01.domain.local -Dusername=administrator@vsphere.local -Dpassword=******** -DpackageName=mypluginpackage

But, when I attempt to run the import-package goal, I get this error:

[ERROR] Failed to execute goal com.vmware.o11n.mojo.pkg:o11n-package-maven-plugin:8.4.2:import-package (default-cli) on project o11nplugin-myplugin-package: Unable to import package [mypluginpackage], from server '[vro01.domain.local]': 
Error while extracting response for type [class com.vmware.o11n.sdk.rest.client.stubs.InventoryItemsList] and content type [application/xml;charset=UTF-8];
nested exception is org.springframework.http.converter.HttpMessageNotReadableException: Could not unmarshal to [class com.vmware.o11n.sdk.rest.client.stubs.InventoryItemsList]:
unexpected element (uri:"http://www.vmware.com/vco", local:"inventory-items"). Expected elements are <{}actions>,<{}categories>,<{}configurations>,<{}interactions>,<{}inventory-items>,<{}owners>,<{}packages>,<{}resources>,<{}tags>;
nested exception is javax.xml.bind.UnmarshalException: unexpected element (uri:"http://www.vmware.com/vco", local:"inventory-items").
Expected elements are <{}actions>,<{}categories>,<{}configurations>,<{}interactions>,<{}inventory-items>,<{}owners>,<{}packages>,<{}resources>,<{}tags> -> [Help 1]

I monitored the vco-server-app_access.log and saw that it was able to communicate to the /catalog endpoint and return HTTP 200 responses, so I know my credentials are at least OK.

2023-05-05T18:45:29.287Z INFO vco [host='vco-app-857b668df-8j2nb' thread='http-nio-8280-exec-6' user='Administrator@VSPHERE.LOCAL' org='-' trace='-'] - 10.244.0.92 - - [05/May/2023:18:45:29 +0000] GET /vco/api/catalog/System/Package/?conditions=name%7Emypluginpackage HTTP/1.1 200 128 7 ms
2023-05-05T18:45:47.303Z INFO vco [host='vco-app-857b668df-8j2nb' thread='http-nio-8280-exec-2' user='Administrator@VSPHERE.LOCAL' org='-' trace='-'] - 10.244.0.92 - - [05/May/2023:18:45:47 +0000] GET /vco/api/catalog/System/UserInteraction HTTP/1.1 200 32 4 ms

This Orchestrator authenticates with CIS/vCenter only.

I've also tried using newer versions of the SDK, such as 8.9.0 but I get the same result.

Here is my Maven/JDK information:

Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T08:41:47-08:00)
Maven home: /opt/apache-maven/apache-maven-3.3.9
Java version: 20, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk-20.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "13.3.1", arch: "x86_64", family: "mac"

Anyone have any ideas why this could be occurring?

1 Solution

Accepted Solutions
JFCooleBA
Contributor
Contributor
Jump to solution

OK, so since no one had any idea on this I figured I would update the thread with my solution.

My workaround to enable this type of capability was to leverage the vco-cli JAR, and execute the necessary command during the 'generate-resources' phase of the build.

You can pull down the vco-cli JAR from a few places, but I pulled it down from the LCM appliance, at this path:

/opt/vmware/vlcm/blackstone/vco-cli/<version>/vco-cli-java-<version>.jar

Once I had that in my package project, I figured out the commands to use it which was pretty easy.

So, I added this to my plugin-package/pom.xml file:

<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<groupId>org.codehaus.mojo</groupId>
<executions>
<execution>
<!-- Run vCO-CLI to pull the package contents prior to repackaging -->
<id>Sync Content from Orchestrator</id>
<phase>generate-resources</phase>
<goals>
<goal>exec</goal>
</goals>

<configuration>
<executable>java</executable>
<arguments>
<argument>-Dlog4j2.formatMsgNoLookups=true</argument>
<argument>-DincludeConfigurationSecureStringValues=true</argument>
<argument>-DignoreServerCertificate=true</argument>
<argument>-DexportVersionHistory=false</argument>
<argument>-DexactPackageNameMatch=true</argument>
<argument>-Dusername=${orchestratorUser}</argument>
<argument>-Dpassword=${orchestratorPass}</argument>
<argument>-DserverHost=${orchestratorHost}</argument>
<argument>-DserverPort=443</argument>
<argument>-jar</argument>
<argument>vco-cli-java-8.10.0.jar</argument>
<argument>de</argument>
<argument>${remotePackageName}</argument>
<argument>${project.basedir}/src/main/resources</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>

I tried a couple of other ways to do this, such as using LCM to push the content to Git and then I would pull that repo, but it looks like LCM rewrites the contents of the Workflows and such to where they are not usable with the Maven packaging plugin.

This solution is at least automated with a few properties in my settings.xml in the M2 repository.

I hope this helps someone down the line.

View solution in original post

Reply
0 Kudos
1 Reply
JFCooleBA
Contributor
Contributor
Jump to solution

OK, so since no one had any idea on this I figured I would update the thread with my solution.

My workaround to enable this type of capability was to leverage the vco-cli JAR, and execute the necessary command during the 'generate-resources' phase of the build.

You can pull down the vco-cli JAR from a few places, but I pulled it down from the LCM appliance, at this path:

/opt/vmware/vlcm/blackstone/vco-cli/<version>/vco-cli-java-<version>.jar

Once I had that in my package project, I figured out the commands to use it which was pretty easy.

So, I added this to my plugin-package/pom.xml file:

<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<groupId>org.codehaus.mojo</groupId>
<executions>
<execution>
<!-- Run vCO-CLI to pull the package contents prior to repackaging -->
<id>Sync Content from Orchestrator</id>
<phase>generate-resources</phase>
<goals>
<goal>exec</goal>
</goals>

<configuration>
<executable>java</executable>
<arguments>
<argument>-Dlog4j2.formatMsgNoLookups=true</argument>
<argument>-DincludeConfigurationSecureStringValues=true</argument>
<argument>-DignoreServerCertificate=true</argument>
<argument>-DexportVersionHistory=false</argument>
<argument>-DexactPackageNameMatch=true</argument>
<argument>-Dusername=${orchestratorUser}</argument>
<argument>-Dpassword=${orchestratorPass}</argument>
<argument>-DserverHost=${orchestratorHost}</argument>
<argument>-DserverPort=443</argument>
<argument>-jar</argument>
<argument>vco-cli-java-8.10.0.jar</argument>
<argument>de</argument>
<argument>${remotePackageName}</argument>
<argument>${project.basedir}/src/main/resources</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>

I tried a couple of other ways to do this, such as using LCM to push the content to Git and then I would pull that repo, but it looks like LCM rewrites the contents of the Workflows and such to where they are not usable with the Maven packaging plugin.

This solution is at least automated with a few properties in my settings.xml in the M2 repository.

I hope this helps someone down the line.

Reply
0 Kudos