Skip to content
Snippets Groups Projects
Commit 28df04db authored by Steven Murray's avatar Steven Murray
Browse files

Removed unnecessary command-line tool cta-catalogue-delete-all-data

parent 6d379790
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 763 deletions
......@@ -146,17 +146,6 @@ target_link_libraries (cta-catalogue-schema-status
install (TARGETS cta-catalogue-schema-status DESTINATION /usr/bin)
install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/cta-catalogue-schema-status.1cta DESTINATION /usr/share/man/man1)
add_executable(cta-catalogue-delete-all-data
DeleteAllCatalogueDataCmd.cpp
DeleteAllCatalogueDataCmdLineArgs.cpp
DeleteAllCatalogueDataCmdMain.cpp)
target_link_libraries (cta-catalogue-delete-all-data
ctacatalogue)
install (TARGETS cta-catalogue-delete-all-data DESTINATION /usr/bin)
install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/cta-catalogue-delete-all-data.1cta DESTINATION /usr/share/man/man1)
add_custom_command(OUTPUT oracle_catalogue_schema.cpp
COMMAND sed 's/^/\ \ \"/' oracle_catalogue_schema.sql | sed 's/$$/\"/' > oracle_catalogue_schema.cpp
DEPENDS oracle_catalogue_schema.sql)
......@@ -247,8 +236,6 @@ set (CATALOGUE_CMD_LINE_UNIT_TESTS_LIB_SRC_FILES
CreateAdminUserCmdLineArgsTest.cpp
CreateSchemaCmdLineArgs.cpp
CreateSchemaCmdLineArgsTest.cpp
DeleteAllCatalogueDataCmdLineArgs.cpp
DeleteAllCatalogueDataCmdLineArgsTest.cpp
DropSchemaCmdLineArgs.cpp
DropSchemaCmdLineArgsTest.cpp
LockSchemaCmdLineArgs.cpp
......
/*
* The CERN Tape Archive (CTA) project
* Copyright (C) 2015 CERN
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "catalogue/CatalogueFactory.hpp"
#include "catalogue/DeleteAllCatalogueDataCmd.hpp"
#include "catalogue/DeleteAllCatalogueDataCmdLineArgs.hpp"
#include "common/exception/Exception.hpp"
namespace cta {
namespace catalogue {
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
DeleteAllCatalogueDataCmd::DeleteAllCatalogueDataCmd(
std::istream &inStream,
std::ostream &outStream,
std::ostream &errStream):
CmdLineTool(inStream, outStream, errStream) {
}
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
DeleteAllCatalogueDataCmd::~DeleteAllCatalogueDataCmd() noexcept {
}
//------------------------------------------------------------------------------
// exceptionThrowingMain
//------------------------------------------------------------------------------
int DeleteAllCatalogueDataCmd::exceptionThrowingMain(const int argc, char *const *const argv) {
const DeleteAllCatalogueDataCmdLineArgs cmdLineArgs(argc, argv);
if(cmdLineArgs.help) {
printUsage(m_out);
return 0;
}
const auto dbLogin = rdbms::Login::parseFile(cmdLineArgs.dbConfigPath);
const uint64_t nbDbConns = 1;
auto catalogue = CatalogueFactory::create(dbLogin, nbDbConns);
if(catalogue->schemaIsLocked()) {
m_err <<
"Cannot delete the data in the catalogue because the schema is locked.\n"
"\n"
"Please see the following command-line tools:\n"
" cta-catalogue-schema-lock\n"
" cta-catalogue-schema-status\n"
" cta-catalogue-schema-unlock" << std::endl;
return 1;
}
deleteAllRowsExceptForCTA_CATALOGUE(*catalogue);
return 0;
}
//------------------------------------------------------------------------------
// deleteAllRowsExceptForCTA_CATALOGUE
//------------------------------------------------------------------------------
void DeleteAllCatalogueDataCmd::deleteAllRowsExceptForCTA_CATALOGUE(Catalogue &catalogue) {
deleteAdminUsers(catalogue);
deleteAdminHosts(catalogue);
deleteArchiveRoutes(catalogue);
deleteRequesterMountRules(catalogue);
deleteRequesterGroupMountRules(catalogue);
deleteArchiveAndTapeFiles(catalogue);
deleteTapes(catalogue);
deleteStorageClasses(catalogue);
deleteTapePools(catalogue);
deleteLogicalLibrares(catalogue);
deleteMountPolicies(catalogue);
}
//------------------------------------------------------------------------------
// deleteAdminUsers
//------------------------------------------------------------------------------
void DeleteAllCatalogueDataCmd::deleteAdminUsers(Catalogue &catalogue) {
const std::list<common::dataStructures::AdminUser> adminUsers = catalogue.getAdminUsers();
for(auto &adminUser: adminUsers) {
catalogue.deleteAdminUser(adminUser.name);
}
m_out << "Deleted " << adminUsers.size() << " admin users" << std::endl;
}
//------------------------------------------------------------------------------
// deleteAdminHosts
//------------------------------------------------------------------------------
void DeleteAllCatalogueDataCmd::deleteAdminHosts(Catalogue &catalogue) {
const std::list<common::dataStructures::AdminHost> adminHosts = catalogue.getAdminHosts();
for(auto &adminHost: adminHosts) {
catalogue.deleteAdminHost(adminHost.name);
}
m_out << "Deleted " << adminHosts.size() << " admin hosts" << std::endl;
}
//------------------------------------------------------------------------------
// deleteArchiveRoutes
//------------------------------------------------------------------------------
void DeleteAllCatalogueDataCmd::deleteArchiveRoutes(Catalogue &catalogue) {
const std::list<common::dataStructures::ArchiveRoute> archiveRoutes = catalogue.getArchiveRoutes();
for(auto &archiveRoute: archiveRoutes) {
catalogue.deleteArchiveRoute(archiveRoute.diskInstanceName, archiveRoute.storageClassName,
archiveRoute.copyNb);
}
m_out << "Deleted " << archiveRoutes.size() << " archive routes" << std::endl;
}
//------------------------------------------------------------------------------
// delelteAllRequesterMountRules
//------------------------------------------------------------------------------
void DeleteAllCatalogueDataCmd::deleteRequesterMountRules(Catalogue &catalogue) {
const std::list<common::dataStructures::RequesterMountRule> rules = catalogue.getRequesterMountRules();
for(auto &rule: rules) {
catalogue.deleteRequesterMountRule(rule.diskInstance, rule.name);
}
m_out << "Deleted " << rules.size() << " requester mount-rules" << std::endl;
}
//------------------------------------------------------------------------------
// deleteRequesterGroupMountRules
//------------------------------------------------------------------------------
void DeleteAllCatalogueDataCmd::deleteRequesterGroupMountRules(Catalogue &catalogue) {
const std::list<common::dataStructures::RequesterGroupMountRule> rules =
catalogue.getRequesterGroupMountRules();
for(auto &rule: rules) {
catalogue.deleteRequesterGroupMountRule(rule.diskInstance, rule.name);
}
m_out << "Deleted " << rules.size() << " requester-group mount-rules" << std::endl;
}
//------------------------------------------------------------------------------
// deleteArchiveAndTapeFiles
//------------------------------------------------------------------------------
void DeleteAllCatalogueDataCmd::deleteArchiveAndTapeFiles(Catalogue &catalogue) {
std::unique_ptr<ArchiveFileItor> itor = catalogue.getArchiveFileItor();
uint64_t nbArchiveFiles = 0;
while(itor->hasMore()) {
const auto archiveFile = itor->next();
catalogue.deleteArchiveFile(archiveFile.diskInstance, archiveFile.archiveFileID);
nbArchiveFiles++;
}
m_out << "Deleted " << nbArchiveFiles << " archive files and their associated tape copies" << std::endl;
}
//------------------------------------------------------------------------------
// deleteTapes
//------------------------------------------------------------------------------
void DeleteAllCatalogueDataCmd::deleteTapes(Catalogue &catalogue) {
const std::list<common::dataStructures::Tape> tapes = catalogue.getTapes();
for(auto &tape: tapes) {
catalogue.deleteTape(tape.vid);
}
m_out << "Deleted " << tapes.size() << " tapes" << std::endl;
}
//------------------------------------------------------------------------------
// deleteStorageClasses
//------------------------------------------------------------------------------
void DeleteAllCatalogueDataCmd::deleteStorageClasses(Catalogue &catalogue) {
const std::list<common::dataStructures::StorageClass> storageClasses = catalogue.getStorageClasses();
for(auto &storageClass: storageClasses) {
catalogue.deleteStorageClass(storageClass.diskInstance, storageClass.name);
}
m_out << "Deleted " << storageClasses.size() << " storage classes" << std::endl;
}
//------------------------------------------------------------------------------
// deleteTapePools
//------------------------------------------------------------------------------
void DeleteAllCatalogueDataCmd::deleteTapePools(Catalogue &catalogue) {
const std::list<common::dataStructures::TapePool> tapePools = catalogue.getTapePools();
for(auto &tapePool: tapePools) {
catalogue.deleteTapePool(tapePool.name);
}
m_out << "Deleted " << tapePools.size() << " tape pools" << std::endl;
}
//------------------------------------------------------------------------------
// deleteLogicalLibraries
//------------------------------------------------------------------------------
void DeleteAllCatalogueDataCmd::deleteLogicalLibrares(Catalogue &catalogue) {
const std::list<common::dataStructures::LogicalLibrary> logicalLibraries = catalogue.getLogicalLibraries();
for(auto &logicalLibrary: logicalLibraries) {
catalogue.deleteLogicalLibrary(logicalLibrary.name);
}
m_out << "Deleted " << logicalLibraries.size() << " logical libraries" << std::endl;
}
//------------------------------------------------------------------------------
// deleteMountPolicies
//------------------------------------------------------------------------------
void DeleteAllCatalogueDataCmd::deleteMountPolicies(Catalogue &catalogue) {
const std::list<common::dataStructures::MountPolicy> mountPolicies = catalogue.getMountPolicies();
for(auto &mountPolicy: mountPolicies) {
catalogue.deleteMountPolicy(mountPolicy.name);
}
m_out << "Deleted " << mountPolicies.size() << " mount policies" << std::endl;
}
//------------------------------------------------------------------------------
// printUsage
//------------------------------------------------------------------------------
void DeleteAllCatalogueDataCmd::printUsage(std::ostream &os) {
DeleteAllCatalogueDataCmdLineArgs::printUsage(os);
}
} // namespace catalogue
} // namespace cta
/*
* The CERN Tape Archive (CTA) project
* Copyright (C) 2015 CERN
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "catalogue/Catalogue.hpp"
#include "catalogue/CmdLineTool.hpp"
namespace cta {
namespace catalogue {
/**
* Command-line tool that deletes all the rows of all the tables in the
* catalogue database except for the CTA_CATALOGUE table.
*/
class DeleteAllCatalogueDataCmd: public CmdLineTool {
public:
/**
* Constructor.
*
* @param inStream Standard input stream.
* @param outStream Standard output stream.
* @param errStream Standard error stream.
*/
DeleteAllCatalogueDataCmd(std::istream &inStream, std::ostream &outStream, std::ostream &errStream);
/**
* Destructor.
*/
~DeleteAllCatalogueDataCmd() noexcept;
private:
/**
* An exception throwing version of main().
*
* @param argc The number of command-line arguments including the program name.
* @param argv The command-line arguments.
* @return The exit value of the program.
*/
int exceptionThrowingMain(const int argc, char *const *const argv) override;
/**
* Prints the usage message of the command-line tool.
*
* @param os The output stream to which the usage message is to be printed.
*/
void printUsage(std::ostream &os) override;
/**
* Deletes all of the rows of all of the tables in the specified catalogue
* database except for the CTA_CATALOGUE table.
*
* @param catalogue The catalogue database.
*/
void deleteAllRowsExceptForCTA_CATALOGUE(Catalogue &catalogue);
/**
* Deletes all admin users from the specified catalogue database.
*
* @param catalogue The catalogue database.
*/
void deleteAdminUsers(Catalogue &catalogue);
/**
* Deletes all admin hosts from the specified catalogue database.
*
* @param catalogue The catalogue database.
*/
void deleteAdminHosts(Catalogue &catalogue);
/**
* Deletes all archive routes from the specified catalogue database.
*
* @param catalogue The catalogue database.
*/
void deleteArchiveRoutes(Catalogue &catalogue);
/**
* Deletes all requester mount-rules from the specified catalogue database.
*
* @param catalogue The catalogue database.
*/
void deleteRequesterMountRules(Catalogue &catalogue);
/**
* Deletes all requester-group mount-rules from the specified catalogue
* database.
*
* @param catalogue The catalogue database.
*/
void deleteRequesterGroupMountRules(Catalogue &catalogue);
/**
* Deletes all archive files and their associated tape files from the
* specified catalogue database.
*
* @param catalogue The catalogue database.
*/
void deleteArchiveAndTapeFiles(Catalogue &catalogue);
/**
* Deletes all tapes from the specified catalogue database.
*
* @param catalogue The catalogue database.
*/
void deleteTapes(Catalogue &catalogue);
/**
* Deletes all storage classes from the specified catalogue database.
*
* @param catalogue The catalogue database.
*/
void deleteStorageClasses(Catalogue &catalogue);
/**
* Deletes all tape pools from the specified catalogue database.
*
* @param catalogue The catalogue database.
*/
void deleteTapePools(Catalogue &catalogue);
/**
* Deletes all logical libraries from the specified catalogue database.
*
* @param catalogue The catalogue database.
*/
void deleteLogicalLibrares(Catalogue &catalogue);
/**
* Deletes all mount policies from the specified catalogue database.
*
* @param catalogue The catalogue database.
*/
void deleteMountPolicies(Catalogue &catalogue);
}; // class DeleteAllCatalogueDataCmd
} // namespace catalogue
} // namespace cta
/*
* The CERN Tape Archive (CTA) project
* Copyright (C) 2015 CERN
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "catalogue/DeleteAllCatalogueDataCmdLineArgs.hpp"
#include "common/exception/CommandLineNotParsed.hpp"
#include <getopt.h>
#include <ostream>
namespace cta {
namespace catalogue {
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
DeleteAllCatalogueDataCmdLineArgs::DeleteAllCatalogueDataCmdLineArgs(const int argc, char *const *const argv):
help(false) {
static struct option longopts[] = {
{"help", no_argument, NULL, 'h'},
{NULL , 0, NULL, 0}
};
// Prevent getopt() from printing an error message if it does not recognize
// an option character
opterr = 0;
int opt = 0;
while((opt = getopt_long(argc, argv, ":h", longopts, NULL)) != -1) {
switch(opt) {
case 'h':
help = true;
break;
case ':': // Missing parameter
{
exception::CommandLineNotParsed ex;
ex.getMessage() << "The -" << (char)opt << " option requires a parameter";
throw ex;
}
case '?': // Unknown option
{
exception::CommandLineNotParsed ex;
if(0 == optopt) {
ex.getMessage() << "Unknown command-line option";
} else {
ex.getMessage() << "Unknown command-line option: -" << (char)optopt;
}
throw ex;
}
default:
{
exception::CommandLineNotParsed ex;
ex.getMessage() <<
"getopt_long returned the following unknown value: 0x" <<
std::hex << (int)opt;
throw ex;
}
} // switch(opt)
} // while getopt_long()
// There is no need to continue parsing when the help option is set
if(help) {
return;
}
// Calculate the number of non-option ARGV-elements
const int nbArgs = argc - optind;
// Check the number of arguments
if(nbArgs != 1) {
exception::CommandLineNotParsed ex;
ex.getMessage() << "Wrong number of command-line arguments: excepted=1 actual=" << nbArgs;
throw ex;
}
dbConfigPath = argv[optind];
}
//------------------------------------------------------------------------------
// printUsage
//------------------------------------------------------------------------------
void DeleteAllCatalogueDataCmdLineArgs::printUsage(std::ostream &os) {
os <<
"Usage:" << std::endl <<
" cta-catalogue-delete-all-data databaseConnectionFile [options]" << std::endl <<
"Where:" << std::endl <<
" databaseConnectionFile" << std::endl <<
" The path to the file containing the connection details of the CTA" << std::endl <<
" catalogue database" << std::endl <<
"Options:" << std::endl <<
" -h,--help" << std::endl <<
" Prints this usage message" << std::endl;
}
} // namespace catalogue
} // namespace cta
/*
* The CERN Tape Archive (CTA) project
* Copyright (C) 2015 CERN
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <string>
namespace cta {
namespace catalogue {
/**
* Structure to store the command-line arguments of the command-line tool
* named cta-catalogue-delete-all-data.
*/
struct DeleteAllCatalogueDataCmdLineArgs {
/**
* True if the usage message should be printed.
*/
bool help;
/**
* Path to the file containing the connection details of the catalogue
* database.
*/
std::string dbConfigPath;
/**
* Constructor that parses the specified command-line arguments.
*
* @param argc The number of command-line arguments including the name of the
* executable.
* @param argv The vector of command-line arguments.
*/
DeleteAllCatalogueDataCmdLineArgs(const int argc, char *const *const argv);
/**
* Prints the usage message of the command-line tool.
*
* @param os The output stream to which the usage message is to be printed.
*/
static void printUsage(std::ostream &os);
};
} // namespace catalogue
} // namespace cta
/*
* The CERN Tape Archive(CTA) project
* Copyright(C) 2015 CERN
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
*(at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "common/exception/Exception.hpp"
#include "catalogue/DeleteAllCatalogueDataCmdLineArgs.hpp"
#include <gtest/gtest.h>
#include <list>
namespace unitTests {
class cta_catalogue_DeleteAllCatalogueDataCmdLineArgsTest : public ::testing::Test {
protected:
struct Argcv {
int argc;
char **argv;
Argcv(): argc(0), argv(NULL) {
}
};
typedef std::list<Argcv*> ArgcvList;
ArgcvList m_argsList;
/**
* Creates a duplicate string using the new operator.
*/
char *dupString(const char *str) {
const size_t len = strlen(str);
char *duplicate = new char[len+1];
strncpy(duplicate, str, len);
duplicate[len] = '\0';
return duplicate;
}
virtual void SetUp() {
// Allow getopt_long to be called again
optind = 0;
}
virtual void TearDown() {
// Allow getopt_long to be called again
optind = 0;
for(ArgcvList::const_iterator itor = m_argsList.begin();
itor != m_argsList.end(); itor++) {
for(int i=0; i < (*itor)->argc; i++) {
delete[] (*itor)->argv[i];
}
delete[] (*itor)->argv;
delete *itor;
}
}
};
TEST_F(cta_catalogue_DeleteAllCatalogueDataCmdLineArgsTest, help_short) {
using namespace cta::catalogue;
Argcv *args = new Argcv();
m_argsList.push_back(args);
args->argc = 2;
args->argv = new char *[3];
args->argv[0] = dupString("cta-catalogue-delete-all-data");
args->argv[1] = dupString("-h");
args->argv[2] = NULL;
DeleteAllCatalogueDataCmdLineArgs cmdLine(args->argc, args->argv);
ASSERT_TRUE(cmdLine.help);
ASSERT_TRUE(cmdLine.dbConfigPath.empty());
}
TEST_F(cta_catalogue_DeleteAllCatalogueDataCmdLineArgsTest, help_long) {
using namespace cta::catalogue;
Argcv *args = new Argcv();
m_argsList.push_back(args);
args->argc = 2;
args->argv = new char *[3];
args->argv[0] = dupString("cta-catalogue-delete-all-data");
args->argv[1] = dupString("--help");
args->argv[2] = NULL;
DeleteAllCatalogueDataCmdLineArgs cmdLine(args->argc, args->argv);
ASSERT_TRUE(cmdLine.help);
ASSERT_TRUE(cmdLine.dbConfigPath.empty());
}
TEST_F(cta_catalogue_DeleteAllCatalogueDataCmdLineArgsTest, dbConfigPath) {
using namespace cta::catalogue;
Argcv *args = new Argcv();
m_argsList.push_back(args);
args->argc = 2;
args->argv = new char *[3];
args->argv[0] = dupString("cta-catalogue-delete-all-data");
args->argv[1] = dupString("dbConfigPath");
args->argv[2] = NULL;
DeleteAllCatalogueDataCmdLineArgs cmdLine(args->argc, args->argv);
ASSERT_FALSE(cmdLine.help);
ASSERT_EQ(std::string("dbConfigPath"), cmdLine.dbConfigPath);
}
} // namespace unitTests
/*
* The CERN Tape Archive (CTA) project
* Copyright (C) 2015 CERN
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "catalogue/DeleteAllCatalogueDataCmd.hpp"
#include <iostream>
//------------------------------------------------------------------------------
// main
//------------------------------------------------------------------------------
int main(const int argc, char *const *const argv) {
cta::catalogue::DeleteAllCatalogueDataCmd cmd(std::cin, std::cout, std::cerr);
return cmd.main(argc, argv);
}
.\" The CERN Tape Archive (CTA) project
.\" Copyright (C) 2015 CERN
.\"
.\" This program is free software: you can redistribute it and/or modify
.\" it under the terms of the GNU General Public License as published by
.\" the Free Software Foundation, either version 3 of the License, or
.\" (at your option) any later version.
.\"
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program. If not, see <http://www.gnu.org/licenses/>.
.TH CTA-CATALOGUE-DELETE-ALL-DATA 1CTA "November 2016" CTA CTA
.SH NAME
cta-catalogue-delete-all-data \- Delete all data in the CTA catalogue
.SH SYNOPSIS
.BI "cta-catalogue-delete-all-data databaseConnectionFile [options]"
.SH DESCRIPTION
\fBcta-catalogue-delete-all-data\fP is a command-line tool that deletes all the
rows of all the tables in the catalogue database except for the CTA_CATALOGUE
table.
.P
This command-line tool will abort if it sees the value LOCKED in the
SCHEMA_STATUS column of the CTA_CATALOGUE database table.
.SH ARGUMENTS
.TP
\fBdatabaseConnectionFile
The path to the configuration file containing the connection details of the
CTA catalogue database.
.SH OPTIONS
.TP
\fB\-h, \-\-help
Prints the usage message.
.SH RETURN VALUE
Zero on success and non-zero on failure.
.SH EXAMPLES
cta-catalogue-delete-all-data /etc/cta/cta_catalogue_db.conf
.SH AUTHOR
\fBCTA\fP Team
......@@ -40,7 +40,6 @@ echo ${DATABASEURL} >/etc/cta/cta_catalogue_db.conf
if [ "$KEEP_DATABASE" == "0" ]; then
echo "Wiping database"
cta-catalogue-schema-unlock /etc/cta/cta_catalogue_db.conf
cta-catalogue-delete-all-data /etc/cta/cta_catalogue_db.conf
cta-catalogue-schema-status /etc/cta/cta_catalogue_db.conf
cta-catalogue-schema-drop /etc/cta/cta_catalogue_db.conf
......
......@@ -8,7 +8,6 @@
echo Creating symlinks for CTA binaries and symlinks.
ln -s -v -t /usr/bin \
${BUILDTREE_BASE}/${BUILDTREE_SUBDIR}/catalogue/cta-catalogue-admin-host-create \
${BUILDTREE_BASE}/${BUILDTREE_SUBDIR}/catalogue/cta-catalogue-delete-all-data \
${BUILDTREE_BASE}/${BUILDTREE_SUBDIR}/catalogue/cta-catalogue-schema-lock \
${BUILDTREE_BASE}/${BUILDTREE_SUBDIR}/catalogue/cta-catalogue-schema-status \
${BUILDTREE_BASE}/${BUILDTREE_SUBDIR}/catalogue/cta-database-poll \
......
......@@ -48,7 +48,6 @@ echo ${DATABASEURL} >/etc/cta/cta_catalogue_db.conf
if [ "$KEEP_DATABASE" == "0" ]; then
echo "Wiping database"
cta-catalogue-schema-unlock /etc/cta/cta_catalogue_db.conf
cta-catalogue-delete-all-data /etc/cta/cta_catalogue_db.conf
cta-catalogue-schema-status /etc/cta/cta_catalogue_db.conf
cta-catalogue-schema-drop /etc/cta/cta_catalogue_db.conf
......
......@@ -246,7 +246,6 @@ Scripts and utilities to faciliate working with the CTA catalogue
%files -n cta-catalogueutils
%attr(0755,root,root) %{_bindir}/cta-catalogue-admin-user-create
%attr(0755,root,root) %{_bindir}/cta-catalogue-admin-host-create
%attr(0755,root,root) %{_bindir}/cta-catalogue-delete-all-data
%attr(0755,root,root) %{_bindir}/cta-catalogue-schema-create
%attr(0755,root,root) %{_bindir}/cta-catalogue-schema-drop
%attr(0755,root,root) %{_bindir}/cta-catalogue-schema-lock
......@@ -255,7 +254,6 @@ Scripts and utilities to faciliate working with the CTA catalogue
%attr(0755,root,root) %{_bindir}/cta-database-poll
%attr(0644,root,bin) %doc /usr/share/man/man1/cta-catalogue-admin-host-create.1cta.gz
%attr(0644,root,bin) %doc /usr/share/man/man1/cta-catalogue-admin-user-create.1cta.gz
%attr(0644,root,bin) %doc /usr/share/man/man1/cta-catalogue-delete-all-data.1cta.gz
%attr(0644,root,bin) %doc /usr/share/man/man1/cta-catalogue-schema-create.1cta.gz
%attr(0644,root,bin) %doc /usr/share/man/man1/cta-catalogue-schema-drop.1cta.gz
%attr(0644,root,bin) %doc /usr/share/man/man1/cta-catalogue-schema-lock.1cta.gz
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment