/ Management  

Do a proper removal of an organization

Hi there AppWorks fans,

Welcome to a new installment of AppWorks tips.

There will be a time when things will get so corrupted you can’t continue in the space, or you just want to clean up old messy things. That’s the time you just want to remove the full organization space and would like a fresh space with nothing in it. For the smart-guy!? Why not just revert a snapshot of your VM…Yeah…That’s one solution, but if you are working on 1 server with multiple developers and multiple spaces that might not work! So, in this post we’ll do a proper cleanup of an organization space! And for that to happen we have a nice tool available with the most logical name ‘organizationremovaltool’…


Let get right into it…

Spin up the machine and make sure you have an organization in place that we may remove.

In my case it’s the organization space ‘appworks_tips’ we use with URL http://192.168.56.107:8080/home/appworks_tips.

Ok, but the ‘Manage organizations’ artifact was responsible for creating this space within the ‘system’ space…correct?

Why not remove it from there? Ok…Let’s do that one first!

Go to the ‘/system’ space and login with the ‘sysadmin’ account…

Open the artifact ‘Manage organizations’, mark that space…

remove_org_001

And remove it by hitting that ‘Yes’

remove_org_002

Let’s try to open the ‘/appworks_tips’ space…

remove_org_003

Well…you see it’s gone, but in my opinion that went too smoothly!

Let’s check the server on that and see if we can find any ‘appworks_tips’ related stuff!

find /opt -name appworks_tips

Well, I get a directory /opt/opentext/AppWorksPlatform/defaultInst/cws/build/appworks_tips/aw_dev_ws, but it’s pretty empty!

What about the database?

Well…HeidiSQL tells me this:

remove_org_004

Hmmm…the ‘project’ entity from my project in that space is still available…including the data!

And our CMC tool?? sh /opt/opentext/AppWorksPlatform/defaultInst/bin/cmc.sh

remove_org_005

Well, looks like the workspace together with the project is still in place…

Ok…let’s recreate that space with the same name!

After switching to ‘/appworks_tips’ I’m able to login again…Even with the ‘awdev’ account that was initially created in this space. I only get this logical error:

remove_org_006

This user can’t be mapped again to a default organization…Yes…could be correct as we removed the old one and recreated a new one!

To reconstruct this you need to open the ‘User manager’ artifact where you will find the ‘Manage Default Organizations’ button:

remove_org_007

In the next modal popup you just assign the user to the correct ‘new’ organization!

remove_org_008

After a refresh in the browser that message will be gone…

Now make sure the user applies also to the ‘Developer’ role, so you are able to open the ‘Workspace Documents’ artifact…And what do we see!?

remove_org_009

Well…it’s our original workspace…let’s open it!

remove_org_010

Ok…available in its full glory!

What is the ‘/app/admin’ panel telling us?

remove_org_011

Well, nothing deployed!…So runtime will be clean too…trust me on that!

Ok…let’s publish and see if our runtime picks up our crafted instances of the ‘project’ entity!?

remove_org_012

Well, that looks like an empty list to me!

But the database table is telling me this:

remove_org_013

What’s going on here?

Let’s create a new instance in runtime…shall we?

The database?…it’s still the same data…So, where is it saved now?

Well…Have a look at this table (and see that slightly change in the table numbering moving from 2 to 3!!)

remove_org_014

Just to be curious, let’s create another ‘dummy’ space and see if that table number in the database got an increase again!?

Well, it does get increased, but for that to happen you also need to create a new workspace in the organization with a project. In the project you need to create an entity…And…you also need to publish it to runtime for a result like this in your database:

remove_org_015

Question for you: what is the name of my ‘dummy’ project and ‘dummy’ entity!? 😜

Man…did we learn again something here…Back to our main goal of this post!

We saw an incomplete removal during our actions so now it’s time to introduce you to a fancy tools that does it all much better…


The ‘organizationremovaltool’

What? A separate tool? Yes…it’s indeed a separate tool that you will find on the server. Before you will find it you need to deploy it and you also need to add some additional configuration to the server!

First things first…The deployment of the tool! It’s available as CAP package and as we already learned we can do the CAP deployment from the ‘Application deployer’ artifact in the ‘System’ space.

An image says more than a thousand words:

remove_org_016

Just follow the regular deployment steps…

remove_org_017

Hit ‘Next >’

remove_org_018

And ‘Next >’

remove_org_019

‘Next >’ again! 💪

remove_org_020

And ‘Deploy’…

remove_org_021

There is your ‘Finish’

Let’s do a search on the server: find /opt -type f -name organizationremovaltool.sh

With a result that we can run like this: sh /opt/opentext/AppWorksPlatform/defaultInst/components/organizationremovaltool/organizationremovaltool.sh

That’s an error “Environment variable ‘CORDYS_HOME’ is not set; please let it point to your AppWorks Platform Installation folder”

Solved by: export CORDYS_HOME=/opt/opentext/AppWorksPlatform/defaultInst

Now what? A correction notification: “The syntax for removing an organization is: ./organizationremovaltool.sh {Name of Organization to delete}”

Well, the organization we mostly love has the name of ‘appworks_tips’. So, our tool will run with this command: sh /opt/opentext/AppWorksPlatform/defaultInst/components/organizationremovaltool/organizationremovaltool.sh appworks_tips

hmmm…error…error…error!

“ERROR : LDAPDirectory - There is no organizational user registered for the user ‘root’”

Solved by: creating a new admin user on the VM that matches the ‘sysadmin’ account in AppWorks!:

1
2
3
4
sudo useradd sysadmin
sudo passwd sysadmin
//password 'admin'
sudo usermod -aG wheel sysadmin

Logout of the VM and re-login with that new ‘sysadmin’ account!

Set the ‘CORDYS_HOME’ variable again…

Modify the platform permissions for the user sudo chmod 777 -R /opt/opentext/AppWorksPlatform/defaultInst

I know that this last command is not the most favorite thing to do (especially on the production environment), but it was required on my environment to make to tool fully executable. Maybe it’s just my environment and maybe I needed to install my environment with a ‘sysadmin’ account instead of the ‘otadmin’ user I created. As we are in a development environment it’s not that bad for now.

Or…On the other hand (as I review this post!) we could also create a new user with that missing name in LDAP…That will just be the creation of a user in the ‘User Managements’ artifact in the ‘/system’ organization space!…For you to try out. 👊

What I did see during my try-outs is that the tool need permission on these locations:

  • /opt/opentext/AppWorksPlatform/defaultInst/components/organizationremovaltool
  • /opt/opentext/AppWorksPlatform/defaultInst/Logs
  • /opt/opentext/AppWorksPlatform/defaultInst/config/wcp.properties
  • /opt/opentext/AppWorksPlatform/defaultInst/certificates
  • /opt/opentext/AppWorksPlatform/defaultInst/localization
  • /opt/opentext/AppWorksPlatform/defaultInst/components/
  • /opt/opentext/AppWorksPlatform/defaultInst/RuleBuildingBlock_DT

Now a proper run of the tool…

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Preparing to execute organization data cleanup for all components.
Deleting the content for Cordys CAP
Skipping action for handler :com.cordys.bam.organizationremoval.ApplicationDataRemover. Probably the application corresponding to the missing handler class is not installed.
Skipping action for handler :com.cordys.bam.organizationremoval.RepositoryDataRemover. Probably the application corresponding to the missing handler class is not installed.
Skipping action for handler :com.cordys.mdm.organizationremovaltool.MDMOrganizationContentRemovalHandler. Probably the application corresponding to the missing handler class is not installed.
Deleting the content for Cordys BPM
Deleting the content for Cordys Case
Deleting the content for Cordys Data Transformation
Deleting the content for Cordys COBOC
Deleting the content for Cordys Scheduler
Deleting the content for Cordys Notification
Deleting the content for Cordys Rule
Deleting the content for Cordys Collaborative Workspace
Removing spaces from organization: appworks_tips
Removing Development space -- AW_DEV_WS has completed.
Removing the space(s) has completed.
Deleting the content for Cordys Tag Server
Deleting the content for Cordys Task Service
Deleting the content for Cordys Web Content
Deleting the content for Cordys Service Containers
Deleting the content for Cordys Log
Deleting the content for Cordys WS-AppServer
Deleting the content for Cordys XMLStore
Deleting the content for Cordys LDAP
Deleting the content for Cordys Audit
Organization data cleanup is completed for all components.
Organization removal tool execution is completed and is exiting.

This is how a failure run will look like…Why sharing?

Because it exposes the classes that are involved in the cleaning action! You see that every component has its own “removal” package applied that is called by this tool…

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Preparing to execute organization data cleanup for all components.
Deleting the content for Cordys CAP
Skipping action for handler :com.cordys.bam.organizationremoval.ApplicationDataRemover. Probably the application corresponding to the missing handler class is not installed.
Skipping action for handler :com.cordys.bam.organizationremoval.RepositoryDataRemover. Probably the application corresponding to the missing handler class is not installed.
Skipping action for handler :com.cordys.mdm.organizationremovaltool.MDMOrganizationContentRemovalHandler. Probably the application corresponding to the missing handler class is not installed.
Skipping action for handler :com.cordys.bpm.contentremoval.BPMContentRemovalHandler. Probably the application corresponding to the missing handler class is not installed.
Skipping action for handler :com.cordys.bpm.casemanagement.contentremoval.CaseContentRemovalHandler. Probably the application corresponding to the missing handler class is not installed.
Skipping action for handler :com.cordys.transformation.orgcontentremoval.TransformationOrgDataRemovalHandler. Probably the application corresponding to the missing handler class is not installed.
Skipping action for handler :com.cordys.coboc.organizationcontentremoval.CobocOrganizationContentRemovalHandler. Probably the application corresponding to the missing handler class is not installed.
Skipping action for handler :com.cordys.scheduler.contentremoval.ScheduleRemovalHandler. Probably the application corresponding to the missing handler class is not installed.
Skipping action for handler :com.cordys.notification.orgcontentremoval.NotificationContentRemovalHandler. Probably the application corresponding to the missing handler class is not installed.
Skipping action for handler :com.cordys.bre.contentremoval.RuleContentRemovalHandler. Probably the application corresponding to the missing handler class is not installed.
Skipping action for handler :com.cordys.cws.organizationremoval.CWSOrganizationalContentCleaner. Probably the application corresponding to the missing handler class is not installed.
Deleting the content for Cordys Tag Server
Skipping action for handler :com.cordys.task.organizationremovaltool.TaskServerOrganizationCleanupHandler. Probably the application corresponding to the missing handler class is not installed.
Skipping action for handler :com.cordys.esbserver.organizationremoval.filesystem.webcontent.WebContentCleanupHandler. Probably the application corresponding to the missing handler class is not installed.
Skipping action for handler :com.cordys.esbserver.organizationremoval.ldap.ServiceContainerStopperHandler. Probably the application corresponding to the missing handler class is not installed.
Skipping action for handler :com.cordys.esbserver.organizationremoval.filesystem.log.LogCleanupHandler. Probably the application corresponding to the missing handler class is not installed.
Skipping action for handler :com.cordys.wsappserver.organizationremoval.WSAppServerJarCleanupHandler. Probably the application corresponding to the missing handler class is not installed.
Deleting the content for Cordys XMLStore
Deleting the content for Cordys LDAP
Deleting the content for Cordys Audit

For some more logging you can check: cat /opt/opentext/AppWorksPlatform/defaultInst/Logs/DeleteOrganizationTool.xml

I also see this created file passing by: cat /opt/opentext/AppWorksPlatform/defaultInst/Logs/appworks_tips.xml

Just for the double check!

The database?

WFT!?….

remove_org_022

It’s still there!?

Let’s check runtime? http://192.168.56.107:8080/home/appworks_tips/app/start

remove_org_023

And double validate this in the ‘/system’ ‘Manage organizations’ artifact…

remove_org_024

Well…Looks like a cleanup!

The CMC tool?

remove_org_025

That’s also a ‘GONE’…And noooo…it’s not an image from some other VM! 😜

With this end-result we can make our conclusion…The removal tool works as it intends to be, but only the database data is still available and on the other hand that might be a good thing! Because if you would need a deletion of the organization in production you are left with the raw data in the database…And as we already concluded before…It’s up to the customer what you want to do with that data.

In our case we can just drop those tables, but if you want to migrate?…Well, you now know where to migrate from!


And that’s it…We have a closed circle, and I give it a well learned ‘DONE’. We learned about the best way to remove an organization with the ‘organizationremovaltool’ on the server. We also saw some insides on database level which gave an interesting view and (on top of the cake) a cherry as we also learned how to connect a default organization to a user account…What a day! Have a great week-end, and we’ll see each other in the next post on a new AppWorks installment…Yeah!! 😍

Don’t forget to subscribe to get updates on the activities happening on this site. Have you noticed the quiz where you find out if you are also “The AppWorks guy”?