Tenants

List Tenants

You can list available tenants using the list-tenants command. At present this is determined simply by considering the unique list of tenants present across all binary artifacts.

dshell/SAMPLE:>list-tenants
+---------------------------+
|Tenant                     |
+---------------------------+
|DEMOWARE                   |
|H2                         |
|SAMPLE                     |
|___DODECA_SERVER_LICENSE___|
+---------------------------+

Set (Use) Current Tenant

Most commands in Dodeca Shell work against a tenant that is set to be active. You can choose this tenant by using the use command. Your shell prompt will be updated to reflect the current active tenant:

dshell/SAMPLE:>use DEMOWARE
dshell/DEMOWARE:>

If the tenant does not seem to exist (based on the tenants that seem to exist based on binary artifacts, the shell will give you a warning and not change):

dshell/DEMOWARE:>use BAD
Warning: No such tenant
dshell/DEMOWARE:>

For automation or other purposes you may need to simply force the tenant (such as creating a new tenant). The --force flag can be used:

dshell/DEMOWARE:>use BAD --force
Warning: No such tenant
Forcing use of tenant even though it doesn't exist
dshell/BAD:>

You may want to skip the tenant validation check because it takes too long against your repository. You can use the --skip-tenant-check flag to do so.

Unset (Unuse) Tenant

You can go back to not having a tenant set by using the unuse command.

dshell/SAMPLE:>unuse
dshell/:>

Delete Tenant

You can delete a tenant by deleting all of its binary artifacts, comments, and other items. The delete-tenant command can be used.

Before deleting a tenant you are strongly encouraged to create a backup of the contents using the various export commands or creating a backup of the database itself.

You can check out the current list of tenants using the list-tenants command. It may show the following:

dshell/:>list-tenants
+---------------------------+
|Tenant                     |
+---------------------------+
|SAMPLE                     |
|___DODECA_SERVER_LICENSE___|
+---------------------------+

Note that the automatic tenant list is based on contents of the binary artifacts table only. Therefore, it may be the case that you don’t see a tenant listed but there are other database entries for that tenant that exist, such as comments, metadata, and other items.

The delete-tenant command will delete all traces of the specified tenant from every Dodeca repository table:

dshell/:>delete-tenant SAMPLE
Warning: Deleting all objects for tenant SAMPLE

And afterward:

dshell/:>list-tenants
+---------------------------+
|Tenant                     |
+---------------------------+
|___DODECA_SERVER_LICENSE___|
+---------------------------+

To take a deeper look, you can force a context switch to the deleted tenant and run the stats command to view the count of objects:

dshell/:>use SAMPLE --force
Warning: No such tenant
Forcing use of tenant even though it doesn't exist
dshell/SAMPLE:>stats
Artifacts: 0
Comments: 0
Data audit log records: 0

Import Tenant

You can import a tenant from a previously created tenant export. The parameters are the target tenant name and the export file:

dshell/SAMPLE:>import-tenant SAMPLE ../../SAMPLE.zip

Or you can use full syntax:

dshell/SAMPLE:>import-tenant --tenant SAMPLE --file ../../SAMPLE.zip

The tenant import process will then kick off. Depending on the number of artifacts, their size, and latency to you database, the import process can take seconds or minutes.

At present, the tenant export and import feature supports binary artifacts and comments.

All of the comments in the tenant you are importing to will be CLEARED before the comments are imported from the import file.

Export Tenant

You can export a tenant to a tenant export file. The tenant export file is a zip file containing the binary artifacts for the tenant and the comments. The import file can then be used with the import-tenant command. The export file is also compatible with the Dodeca client and can be used to import artifacts from (but not comments).

At its simplest, you can export a specified tenant:

shell/SAMPLE:>export-tenant SAMPLE

This will generate a file named tenant.zip (in this case, SAMPLE.zip) in the current folder. Alternatively, you may specify the exact file to export to:

dshell/SAMPLE:>export-tenant SAMPLE SAMPLE_backup.zip

Copying a Tenant

There is no direct command to copy a tenant. You can achieve it by exporting a tenant file, deleting any data that may exist in the target tenant, then importing the file.