Security Mechanism to Prevent Dropping the CTA Catalogue in Production¶
In order to prevent accidentally dropping a CTA Catalogue schema in production, a protection mechanism has been implemented.
The IS_PRODUCTION
flag¶
The IS_PRODUCTION
flag cannot be NULL
and is by default set to 0. It is checked by the tool used to drop the schema of a CTA Catalogue database (cta-catalogue-schema-drop
). If the IS_PRODUCTION
flag is set to 1, the deletion of the CTA Catalogue schema will not be possible via the cta-catalogue-schema-drop
tool.
Set the IS_PRODUCTION
flag to 1¶
In order to set the IS_PRODUCTION
flag to 1, the tool cta-catalogue-set-production
has to be used. This tool accepts as argument the CTA catalogue configuration file that is usually located in /etc/cta/cta-catalogue.conf
.
Usage of the cta-catalogue-set-production
tool¶
$ cta-catalogue-set-production /etc/cta/cta-catalogue.conf
Setting the IS_PRODUCTION flag...
IS_PRODUCTION flag set.
In the case the targeted schema does not have the IS_PRODUCTION
column in the CTA_CATALOGUE
table, an error message will be displayed and the cta-catalogue-set-production
tool will fail:
$ cta-catalogue-set-production /etc/cta/cta-catalogue.conf
Aborting: Unable to set the catalogue as production because the column IS_PRODUCTION is missing
Trying to drop a production database schema¶
An error message will be displayed if someone tries to delete a production database schema:
$ cta-catalogue-schema-drop /etc/cta/cta-catalogue.conf
Aborting: Cannot drop a production database. If you still wish to proceed then please modify the database manually to remove its production status before trying again.