Clarity Service Management

Expand all | Collapse all

Export a single tenant and import into another environment

Jump to Best Answer
  • 1.  Export a single tenant and import into another environment

    Posted 11-08-2018 04:22 PM

    SDM 14.1.x, 17.1.x

     

    Background:  We are in a MSP organization and are developing procedures to onboard new tenants.  The current situation requires separation of duties between DEV and PROD; so we have to hand off all procedures and files during development to the PROD team - who do not have access to DEV or QA.

     

    We gather core information from the client to load into DEV; export the tenant and related tables using the pdm command tools; and load those into QA for validation.  All new tenants are 1 level down sub-tenants to the service provider and do not have sub-tenants themselves.

     

    The process starts with manually creating the tenant using the web UI in order to have the system-maintained tenant groups created.  At this point, I have the IDs of the service provider tenant, the new tenant, and the related tenant groups and I can pdm_load tables for the new tenant's support groups, categories, etc..

     

    Issue:  Exporting the data works for the tenant, tenant groups, service groups, etc., but does not for the ca_tenant_group_member table.  If I check the data in SQL, it is complete; but when I try to extract it using pdm_extract, the service provider rows are not returned.

     

    Example:

       SQL:

     

    SELECT
        *
    FROM
        ca_tenant_group_member
    WHERE
        tenant_group IN
        (SELECT id FROM ca_tenant_group WHERE name LIKE 'new_tenant%')

    returns 5 rows - which matches that there are 2 entries each for the 'new_tenant'_relatedtenants and 'new_tenant'_supertenants and 1 for the 'new_tenant'_subtenant - as seen in the web interface.

    SQL_tenant_group_members

      However, pdm_extract:

    pdm_extract -f "SELECT * FROM ca_tenant_group_member WHERE tenant_group IN (SELECT id FROM ca_tenant_group WHERE name LIKE 'new_tenant%') "

    returns:

     

    D:\working folder>pdm_extract -f "SELECT * FROM ca_tenant_group_member WHERE tenant_group IN (SELECT id FROM ca_tenant_group WHERE name LIKE 'new_tenant%') "
    TABLE ca_tenant_group
            creation_date creation_user description id inactive last_update_date last_update_user
            name readonly tenant version_number
            { "10/31/2018 12:56:52" ,"servicedesk" ,"",
            "0882564DF245924985EA08BB1241AF5A" ,"0" ,"10/31/2018 12:56:52",
            "servicedesk" ,"new_tenant_supertenants" ,"1",
            "432847A5A766134BB6B60F9CCA2F1118" ,"1" }
            { "10/31/2018 12:56:52" ,"servicedesk" ,"",
            "DD7893F2C6C10B4296648065956ADB63" ,"0" ,"10/31/2018 12:56:52",
            "servicedesk" ,"new_tenant_relatedtenants" ,"1",
            "432847A5A766134BB6B60F9CCA2F1118" ,"1" }
            { "10/31/2018 12:56:52" ,"servicedesk" ,"",
            "EAF7D24DA3E74848A56D29AFE678413C" ,"0" ,"10/31/2018 12:56:52",
            "servicedesk" ,"new_tenant_subtenants" ,"1",
            "432847A5A766134BB6B60F9CCA2F1118" ,"1" }
    ca_tenant_group
            rows:3

    which is missing the service provider tenant in the _relatedtenants and _supertenants

     

    I see there has been an Idea posted for single tenant migration which is currently Not Planned:  Single Tenant Migration Procedure

     

    I have never used the pdm_tenant_extract utility referenced at:  pdm_tenant_extract -- Extracting Tenant Data - but could not get it to work for even an initial phase in order to review the output (Not to mention that it says the initial export has to be imported into a system never used by CA SDM).

     

    Please let me know If anyone seems something wrong with this approach or anything obvious I am missing.  All ideas are welcome.

     

    TIA,

     

    J.W.



  • 2.  Re: Export a single tenant and import into another environment

    Posted 12-06-2018 07:13 AM


  • 3.  Re: Export a single tenant and import into another environment

    Posted 12-06-2018 10:23 AM

    Thank you, TMACUL

     

     I am able to extract and then load the 'ca_tenant.' The issue is with 'ca_tenant_group_member'.

     

    J.W.



  • 4.  Re: Export a single tenant and import into another environment

    Posted 12-14-2018 04:53 AM

    HI J_W ,

     

       Did you try to use this docs on 'ca_tenant_group_member'?

     

    Regards



  • 5.  Re: Export a single tenant and import into another environment

    Posted 12-14-2018 03:12 PM

    TMACUL,

     

    Yes, as you see in the original post, extracting * from ca_tenant_group_member does not return the _relatedtenants and _supertenants.  I have the correct syntax and relationship as shown in the SQL statement.

     

    J.W.



  • 6.  Re: Export a single tenant and import into another environment

    Posted 12-21-2018 05:08 PM

    After working with David-Ng  in Support on this, we have concluded there is no way to just add the new tenant to a new system based on an extract of the bare relationships and the only way to accomplish this is by overwriting the entire tenant <> group <> group member relationships for ALL tenants in the target environment.  This will not be practical nor acceptable to most customers.

     

    Thanks for all the dev and testing David.

     

    J.W.



  • 7.  RE: Export a single tenant and import into another environment
    Best Answer

    Posted 06-14-2019 08:42 AM
    I have a working solution for my environment.

    After loading the tenant, tenant_group, and tenant_group_member tables:

    1.  Open the web interface as Admin; open the new Tenant record.
    2.  Edit the Parent Tenant field; set the value to <empty>; save the change.
    3.  Edit the Parent Tenant field; set the value to the service providers; save the change.

    All the system maintained relationships are updated.

    I was so determined to script this that I forgot that a the parent could be reset from the UI.

    Thanks to everyone who has chipped in on this.  I hope this works for others.

    J.W.

    ------------------------------
    "No matter where you go, there you are." - TAoBB:AtED
    ------------------------------