VMware Cloud Community
figinhole
Enthusiast
Enthusiast

maven command to update package to vCO from directory tree (xml)

Hello everyone,

I'm using this maven command to pull info (xmls) from vCO package, to a folder (git folder)

mvn o11n-package:import-package -DserverUrl=user:pass@localhost:8281

Now I would like to put the changes back from directory tree (git folder) to vCO package (or maybe first to vCO db)

whats the maven command for that?

I tried package -> synchronization but that didn't worked. I guess mvn o11n-package:import-package command only move data one way.

Also if you may please direct me to available maven command documents for o11n-package.

Thank you,

_Peter

0 Kudos
3 Replies
iiliev
VMware Employee
VMware Employee

Assembling a package file from directory tree can be done either by maven plugin or by command line tool.

For maven based approach, look at pom.xml file in package project generated when you use one of the vCO maven plug-in artifacts. It should be something like:

      <plugin>

        <groupId>com.vmware.o11n.mojo.pkg</groupId>

        <artifactId>maven-o11n-package-plugin</artifactId>

        <version>1.2.3</version>

        <extensions>true</extensions>

        <configuration>

          <packageName>com.vmware.o11n.plugin.myplugin</packageName>

          <!-- Set the local path to the *.vmokeystore file used to sign the content -->

          <keystoreLocation>${keystoreLocation}</keystoreLocation>

          <keystorePassword>${keystorePassword}</keystorePassword>

          <includes>

            <include>**/*.element_info.xml</include>

          </includes>

          <packageFileName>${project.artifactId}-${project.version}</packageFileName>

          <allowedMask>${allowedMask}</allowedMask>

          <exportVersionHistory>false</exportVersionHistory>

        </configuration>

      </plugin>

For command line approach, look in the vCO maven repository available in vCO appliance. The command line tool is located at /usr/lib/vco/downloads/vco-repo/com/vmware/o11n/tool/vco-cli-java/5.5.1/

Here is the README.txt file for this tool showing its supported commands:

vCO Package import/export command line tool

Description:

Command line tool, that provides basic vCO package import and export operations. As source or target it can have either .package file, or directory.

Usage:

java <java-parameters> -jar PackageToolCli.jar <command> <command-parameters>

Commands:

These are the basic commands that tell the tool which operation to perform.

  fi - file import

  Imports package to vCO from .package file.

  fe - file export

  Exports vCO package to .package file.

  di - directory import

  Imports package to vCO from directory tree.

  de - directory export

  Exports vCO package to directory tree.

  fd - file from directory

  Creates .package file from directory tree.

Command Parameters:

The direct parameters that pertain to the specific command. Source or destination files or directories.

  fi <filename>

  <filename> - Name of the .package file to import.

  fe <packagename> [<basedir>]

  <packagename> - Name of the package to export.

  <basedir> - Directory to which to export. If not specified, current directory is assumed.

  di <basedir>

  <basedir> - Directory from which to import.

  de <packagename> [<basedir>]

  <packagename> - Name of the package to export.

  <basedir> - Directory to which to export. If not specified, current directory is assumed.

  fd <basedir>

  <basedir> - Directory from which to build .package file.

Java Parameters:

Additional parameters that may be needed by the system, in order to perform the specific commands.

  -DserverUrl=<user:password@serverurl>

  URL and login of the vCO server against which the imports or exports will be performed.

  -DallowedMask=<vef>

  Access attributes of the package.

  v - elements can be viewed

  e - elements can be edited

  f - elements can be forwarded in another package

  -DkeystoreFileLocation=<path-to-vmokeystore-file>

  Path to the .vmokeystore file that contains the development certificate

  -DkeystorePassword=<vmokeystore-password>

  Password of the .vmokeystore file

  -DexportVersionHistory=<true|false>

  Export version history

  -Dincludes=<include-pattern-list>

  ';'-separated list of patterns showing which elements to include.

  -Dexcludes=<exclude-pattern-list>

  ';'-separated list of patterns showing which elements to exclude.

Examples:

  Export package com.vmware.test.TestPackage as a package file in the current folder.

  java -DserverUrl=username:password@myserver:8281 -jar PackageToolCli.jar fe com.vmware.test.TestPackage

  Export package com.vmware.test.TestPackage as directory structure in the current folder.

  java -DserverUrl=username:password@myserver:8281 -jar PackageToolCli.jar de com.vmware.test.TestPackage

  Import package file com.vmware.test.TestPackage.package to vCO server.

  java -DserverUrl=username:password@myserver:8281 -jar PackageToolCli.jar fi com.vmware.test.TestImpex.package

  (Note: the next two commands require development certificate in order to be performed)

  Build .package file from directory structure.

  java -DserverUrl=username:password@myserver:8281 -DkeystoreFileLocation=/path/to/my_cerificate.vmokeystore

      -DkeystorePassword=mypassword -jar PackageToolCli.jar fd com.vmware.test.TestPackage

  Import package directory structure com.vmware.test.TestPackage to vCO server.

  java -DserverUrl=username:password@myserver:8281 -DkeystoreFileLocation=/path/to/my_cerificate.vmokeystore

      -DkeystorePassword=mypassword -jar PackageToolCli.jar di com.vmware.test.TestPackage

  The last two commands also support the allowedMask, exportVersionHistory and includes/excludes java parameters, which give more control to the content and access attributes of the package.

  -DallowedMask=vf

  Creates package that can not be editted.

  -DexportVersionHistory=true

  Preserves the local version history of developed vCO objects between exports and imports.

  -Dincludes="**/Test Package/**/*.element_info.xml;**/Test Samples/**/*.element_info.xml;**/testPackage/**/*.element_info.xml"

  Includes only objects that have ".element_info.xml" descriptor (which is specific for packages exported as directory trees), from library folders Test Package and Test Samples (for workflows) or testPackage package (for actions).

0 Kudos
figinhole
Enthusiast
Enthusiast

Thank you Llian for the info.

I do have the pom.xml file in package project, similar to what you described above.

But I'm trying to import workflows from folder structure(xml)

Do I have to do something special to my pom file as I'm not trying to import a vCO plugin but vCO workflows

Current maven command (o11n-package:import-package) can exporting the workflows to folder structure but not the other way around.

Thank you,

Peter

0 Kudos
igaydajiev
VMware Employee
VMware Employee

If I understand  the question correct. You are trying to automate also the package import in vCO not only generate .package file from folder structure.

1. Do you ask for particular command for generating .package file

2. Or the actual question is how to import the package in vCO running server in automated way


You can try the command line tool described in Ilian's comment.

  Import package directory structure com.vmware.test.TestPackage to vCO server. 

  1.   java -DserverUrl=username:password@myserver:8281 -DkeystoreFileLocation=/path/to/my_cerificate.vmokeystore  -DkeystorePassword=mypassword -jar PackageToolCli.jar di com.vmware.test.TestPackage

Onather way can be ti is first to use methods described above to generate .package then use the vCO REST api to import it it.

0 Kudos