Skip to content

export target

Chris Lowth edited this page Apr 25, 2023 · 9 revisions

export target, export targets

Usage:

tbutil [{cred}] export target [-j|-s ..|-y] [-ask-secrets] [-secret ..] {target_id}
tbutil [{cred}] export [cloud|onprem] targets [-v] [-ask-secrets|-random-secret|-get-secrets ..|-secrets-file ..] {directory_name}

Singular version

Prints a JSON document containing the definition of the target who's UUID is given as the argument, suitable for editting and/or re-importing using the "import target" command.

Note:

  • This command cannot be used against IWO.

If any of the allowed common formatting options are specified, then the output is the unprocessed output of the API call used. The resulting text is NOT suitable to be imported using "import target".

The supported formatting flags are -j, -s and -y (see common formatting options)

Note: Turbonomic does not return the password for the target, so the resulting text needs to have a password added to it (encrypted) before it can be imported. You have a number of choices to answer this requirement:

  1. Run export target with the -ask-secrets option, which causes it to prompt you for the passwords as it runs. The passwords you enter are added to the exported JSON body. You can also pipe the passwords in on the standard input instead of typing them by hand.
  2. Run export target with the -secret option specified, in which case the given secret value will be used for all the target's secret fields.
  3. Use the -ask-secrets option with import targets, in which case the questions are asked when you import and do not need to be written to the file. You can also pipe the passwords in on the standard input instead of typing them by hand.
  4. Use the "crypt" command to patch the passwords in to the file after exporting and before importing.

See "crypt" for more information.

Plural version

Export details of all (or "cloud" or "onprem") targets to the named directory in a format that is suitable for re-importing.

The following types of target are excluded..

  • Derived targets
  • Kubernetes (kubeturbo) targets.
  • Action Script targets.

Note:

  • This command cannot be used against IWO.

Option "-v" causes the command to write the full target details (as returned by the API) to the files - but note: this format is not suitable for re-importing.

Option "-random-secret" causes random, encrypted values to be used for all target secret fields (such as passwords). This allows the targets to be re-imported, although they will fail validation. The administrator can then use the UI to supply the correct values. An alternative to this approach is to use the "crypt" sub command to add the real passwords (encrypted) to the files before importing.

Option -get-secrets is used to identify a script containing a JS function that returns a JS object map of the clear-text secrets for the target who's DTO is provided as an argument. This can be used to integrate with external storage to determine the secrets. The function takes two arguments: the REST API client handle and the target DTO. Here's a very trivial example (note the syntax for declaring it)..

return function(c, t) {
	if (t.type == "vCenter") {
	    return { password: "I bet you'd never guess this" };
	}
	return null;
};

Please note that the JS language variant used here is that provided by tbscript's enhanced version of OTTO.

Option -secrets-file is used to identify a JSON file from which target secrets can be read. Click here for information about the use and format of this file.

See also: "crypt", "delete target", "import target", "export targets", "list targets", "rediscover target", "validate target"

Clone this wiki locally