]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
minor changes
authorRazvan Becheriu <razvan.becheriu@qualitance.com>
Tue, 7 Jun 2016 15:15:38 +0000 (18:15 +0300)
committerTomek Mrugalski <tomasz@isc.org>
Thu, 23 Jun 2016 12:28:07 +0000 (14:28 +0200)
src/bin/admin/admin-utils.sh
src/bin/admin/kea-admin.in
src/lib/dhcpsrv/tests/cql_lease_mgr_unittest.cc
src/lib/dhcpsrv/testutils/cql_schema.cc
src/share/database/scripts/cql/dhcpdb_create.cql

index 03ec7dc5ffb82624ff4031f0eb862dcb1b10b79c..d6f33a4d305fe344034c0736b79be261f74e549d 100755 (executable)
@@ -76,7 +76,7 @@ pgsql_execute_script() {
         retcode=$?
     else
         export PGPASSWORD=$db_password
-        psql --set ON_ERROR_STOP=1 -A -t -h localhost -q -U $db_user -d $db_name -h localhost -f $file
+        psql --set ON_ERROR_STOP=1 -A -t -h localhost -q -U $db_user -d $db_name -f $file
         retcode=$?
     fi
     return $retcode
index 1cd45475b4cf76159bb32f6a25a9ec679f098417..5fa3d70b768d62d7d67bccd246ddb357d5c2c443 100644 (file)
@@ -203,17 +203,6 @@ pgsql_init() {
 cql_init() {
     printf "Checking if there is a database initialized already... Please ignore errors.\n"
 
-    result=`cql_execute "DESCRIBE KEYSPACES;"`
-    if [ "$result" != "" ]; then
-        result=`echo "$result" | sed -n "/$db_name/ p"`
-        if [ "$result" = "" ]; then
-            printf "Creating keyspace $db_name...\n"
-            cql_execute "CREATE KEYSPACE $db_name WITH replication = {'class' : 'SimpleStrategy','replication_factor' : 1};"
-        else
-            printf "Keyspace $db_name already exists.\n"
-        fi
-    fi
-
     result=`cql_execute "USE $db_name; DESCRIBE tables;"`
     if [ "$result"="<empty>" ]; then
         printf "Creating and initializing tables using script %s...\n" $scripts_dir/cql/dhcpdb_create.cql
@@ -225,7 +214,7 @@ cql_init() {
     version=`cql_version`
     printf "Lease DB version reported after initialization: $version\n"
 
-    return 0
+    exit 0
 }
 
 ### Functions that implement database version checking commands
@@ -340,7 +329,7 @@ cql_upgrade() {
 
     version=`cql_version`
     printf "Lease DB version reported after upgrade: $version\n"
-    return 0
+    exit 0
 }
 
 # Utility function which tests if the given file exists and
@@ -535,7 +524,7 @@ cql_dump() {
     # delete the tmp file on success
     rm $tmp_file
     echo lease$dump_type successfully dumped to $dump_file
-    return 0
+    exit 0
 }
 
 ### Script starts here ###
index 616b64f518feeaaea314ac43f7b00f8d37ff0421..b3af9a2c1be990e9da5acea181581231294c5772 100644 (file)
@@ -94,7 +94,7 @@ public:
 /// CqlLeaseMgr test fixure set.  This test checks that the database can be
 /// opened: the fixtures assume that and check basic operations.
 
-TEST(CQLOpenTest, OpenDatabase) {
+TEST(CqlOpenTest, OpenDatabase) {
 
     // Schema needs to be created for the test to work.
     destroyCqlSchema(false, true);
index 20110da2a391cf32a5e3c19afe08b475d0205fc2..b03c8a4814f2b3176565443c419a6e2818c4b229 100644 (file)
@@ -38,15 +38,15 @@ bool softWipeEnabled() {
     return (false);
 }
 
-void destroyCqlSchema(bool , bool show_err) {
-//    if (force_wipe || !softWipeEnabled()) {
+void destroyCqlSchema(bool force_wipe, bool show_err) {
+    if (force_wipe || !softWipeEnabled()) {
         // Do full wipe
         runCqlScript(DATABASE_SCRIPTS_DIR, "cql/dhcpdb_drop.cql", show_err);
-//    } else {
+    } else {
 
         // do soft wipe (just remove the data, not the structures)
-//        runCqlScript(DATABASE_SCRIPTS_DIR, "cql/soft_wipe.cql", show_err);
-//    }
+        runCqlScript(DATABASE_SCRIPTS_DIR, "cql/soft_wipe.cql", show_err);
+    }
 }
 
 void createCqlSchema(bool force_wipe, bool show_err) {
index bf0a95d715e0df34fc1e8dfb470070620402bddf..6cad321bfc9fad73594e8321c4a851138298d2b9 100644 (file)
@@ -29,7 +29,7 @@
 
 -- SOURCE dhcpdb_create.cql
 
--- This script is also called from kea-admin, see kea-admin init cql
+-- This script is also called from kea-admin, see kea-admin lease-init cql
 
 -- Over time, Kea database schema will evolve. Each version is marked with
 -- major.minor version. This file is organized sequentially, i.e. database