mzcli Profiles (4.1)

If you want to use the mzcli on multiple installations of Usage Engine using dedicated installation names, you can use the new --profile option.

The --profile option calls a configuration file called mzcli_configuration.xml, in which the required details for connecting to each installation have been stored. This file will automatically be generated the first time you run any mzcli command, and it will be placed in the .mzcli folder in the USER_HOME directory. If the .mzcli folder does not exist in the USER_HOME directory, it will be created.

Note!

Ensure you have write permissions on the USER_HOME directory when running the mzcli command, otherwise the mzcli_configuration.xml file will fail to be created.

Once created the file will look like this:

and you will manually have to update the respective <installation> sections for the different installations you want to be able to run the mzcli command on.

The mzcli_configuration.xml file can have any number of installation details in it, just add an <installation> installation section for each.

Each <installation> in the mzcli_configuration.xml has 4 parameters.

  1. host

  2. port

  3. username

  4. schema [http | https]

All of these attributes are mandatory as well as the name attribute for the <installation>. The name cannot be empty or just spaces and it is this name that is being used as for the --profile option when running the mzcli commands.

Note!

If any of the mandatory parameters are missing, the file will be considered invalid.

No other parts of the xml file should be edited manually, since this may also render the file invalid.

If you add comments, be aware that there is a risk of rendering the file invalid in case a closing “>” is missed.

If the file is invalid, the mzcli commands will not execute.

Troubleshooting an Invalid xml file

If you end up with an invalid xml file, you can rename the file, and let the next execution of a mzcli command generate a new template file, and then enter the previous installation details into the file.

Once you have a valid configuration file, you can use the --profile option to state which of the installations you want to run the mzcli command for:

mzcli --profile <installation name> <command>

You can also define a default installation to be used, when running the mzcli command without the --profile flag.

Default Profile

Setting a Default Profile

To set a default profile run the following command:

java -jar mzcli.jar [mzcli] --set-default-profile <default-profile-name>

If the profile was successfully set, you will get a message saying that the Default Profile has been set to the stated installation, and you will see a new attribute in the <installation-list> tag in the configuration file:

<installationlist default-installation="my_installation">

The stated installation must be present in the configuration file.

Checking the Default Profile

If you want to check if an installation has been set as default from the command line, you can run the following command:

You will then get a message stating either that there is no default profile set, or the installation that is currently set along with information about schema, host and port.

Overriding the Default Profile

If a default profile has been set, you can still override it by stating another installation in your mzcli command: