summaryrefslogtreecommitdiffstats
path: root/src/db/sysdb_upgrade.c
diff options
context:
space:
mode:
authorNikolai Kondrashov <Nikolai.Kondrashov@redhat.com>2014-02-12 10:12:59 -0500
committerJakub Hrozek <jhrozek@redhat.com>2014-02-12 22:31:02 +0100
commit83bf46f4066e3d5e838a32357c201de9bd6ecdfd (patch)
tree65f491f7661bd533398625e015f2b5e5bff3badf /src/db/sysdb_upgrade.c
parent45a1d9d597df977354428440aeff11c6a0a947fe (diff)
downloadsssd-83bf46f4066e3d5e838a32357c201de9bd6ecdfd.tar.gz
sssd-83bf46f4066e3d5e838a32357c201de9bd6ecdfd.tar.xz
sssd-83bf46f4066e3d5e838a32357c201de9bd6ecdfd.zip
Update DEBUG* invocations to use new levels
Use a script to update DEBUG* macro invocations, which use literal numbers for levels, to use bitmask macros instead: grep -rl --include '*.[hc]' DEBUG . | while read f; do mv "$f"{,.orig} perl -e 'use strict; use File::Slurp; my @map=qw" SSSDBG_FATAL_FAILURE SSSDBG_CRIT_FAILURE SSSDBG_OP_FAILURE SSSDBG_MINOR_FAILURE SSSDBG_CONF_SETTINGS SSSDBG_FUNC_DATA SSSDBG_TRACE_FUNC SSSDBG_TRACE_LIBS SSSDBG_TRACE_INTERNAL SSSDBG_TRACE_ALL "; my $text=read_file(\*STDIN); my $repl; $text=~s/ ^ ( .* \b (DEBUG|DEBUG_PAM_DATA|DEBUG_GR_MEM) \s* \(\s* )( [0-9] )( \s*, ) ( \s* ) ( .* ) $ / $repl = $1.$map[$3].$4.$5.$6, length($repl) <= 80 ? $repl : $1.$map[$3].$4."\n".(" " x length($1)).$6 /xmge; print $text; ' < "$f.orig" > "$f" rm "$f.orig" done Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Stephen Gallagher <sgallagh@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
Diffstat (limited to 'src/db/sysdb_upgrade.c')
-rw-r--r--src/db/sysdb_upgrade.c42
1 files changed, 26 insertions, 16 deletions
diff --git a/src/db/sysdb_upgrade.c b/src/db/sysdb_upgrade.c
index dc3619986..fd13d3df3 100644
--- a/src/db/sysdb_upgrade.c
+++ b/src/db/sysdb_upgrade.c
@@ -185,7 +185,8 @@ int sysdb_upgrade_01(struct ldb_context *ldb, const char **ver)
for (i = 0; i < res->count; i++) {
el = ldb_msg_find_element(res->msgs[i], "memberUid");
if (!el) {
- DEBUG(1, "memberUid is missing from message [%s], skipping\n",
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ "memberUid is missing from message [%s], skipping\n",
ldb_dn_get_linearized(res->msgs[i]->dn));
continue;
}
@@ -290,7 +291,7 @@ int sysdb_check_upgrade_02(struct sss_domain_info *domains,
ret = sysdb_ldb_connect(tmp_ctx, ldb_file, &ldb);
if (ret != EOK) {
- DEBUG(1, "sysdb_ldb_connect failed.\n");
+ DEBUG(SSSDBG_CRIT_FAILURE, "sysdb_ldb_connect failed.\n");
return ret;
}
@@ -333,7 +334,8 @@ int sysdb_check_upgrade_02(struct sss_domain_info *domains,
goto exit;
}
- DEBUG(4, "Upgrading DB from version: %s\n", version);
+ DEBUG(SSSDBG_CONF_SETTINGS,
+ "Upgrading DB from version: %s\n", version);
if (strcmp(version, SYSDB_VERSION_0_1) == 0) {
/* convert database */
@@ -358,7 +360,8 @@ int sysdb_check_upgrade_02(struct sss_domain_info *domains,
/* == V2->V3 UPGRADE == */
- DEBUG(0, "UPGRADING DB TO VERSION %s\n", SYSDB_VERSION_0_3);
+ DEBUG(SSSDBG_FATAL_FAILURE,
+ "UPGRADING DB TO VERSION %s\n", SYSDB_VERSION_0_3);
/* ldb uses posix locks,
* posix is stupid and kills all locks when you close *any* file
@@ -379,14 +382,15 @@ int sysdb_check_upgrade_02(struct sss_domain_info *domains,
/* reopen */
ret = sysdb_ldb_connect(tmp_ctx, ldb_file, &ldb);
if (ret != EOK) {
- DEBUG(1, "sysdb_ldb_connect failed.\n");
+ DEBUG(SSSDBG_CRIT_FAILURE, "sysdb_ldb_connect failed.\n");
return ret;
}
/* open a transaction */
ret = ldb_transaction_start(ldb);
if (ret != LDB_SUCCESS) {
- DEBUG(1, "Failed to start ldb transaction! (%d)\n", ret);
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ "Failed to start ldb transaction! (%d)\n", ret);
ret = EIO;
goto exit;
}
@@ -413,7 +417,8 @@ int sysdb_check_upgrade_02(struct sss_domain_info *domains,
ret = ldb_transaction_start(sysdb->ldb);
if (ret != LDB_SUCCESS) {
- DEBUG(1, "Failed to start ldb transaction! (%d)\n", ret);
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ "Failed to start ldb transaction! (%d)\n", ret);
ret = EIO;
goto done;
}
@@ -477,7 +482,7 @@ int sysdb_check_upgrade_02(struct sss_domain_info *domains,
ret = ldb_add(sysdb->ldb, msg);
if (ret != LDB_SUCCESS) {
- DEBUG(0, "WARNING: Could not add entry %s,"
+ DEBUG(SSSDBG_FATAL_FAILURE, "WARNING: Could not add entry %s,"
" to new ldb file! (%d [%s])\n",
ldb_dn_get_linearized(msg->dn),
ret, ldb_errstring(sysdb->ldb));
@@ -485,7 +490,8 @@ int sysdb_check_upgrade_02(struct sss_domain_info *domains,
ret = ldb_delete(ldb, orig_dn);
if (ret != LDB_SUCCESS) {
- DEBUG(0, "WARNING: Could not remove entry %s,"
+ DEBUG(SSSDBG_FATAL_FAILURE,
+ "WARNING: Could not remove entry %s,"
" from old ldb file! (%d [%s])\n",
ldb_dn_get_linearized(orig_dn),
ret, ldb_errstring(ldb));
@@ -497,21 +503,21 @@ int sysdb_check_upgrade_02(struct sss_domain_info *domains,
* of failure just for tracing */
ret = ldb_delete(ldb, groups_dn);
if (ret != LDB_SUCCESS) {
- DEBUG(9, "WARNING: Could not remove entry %s,"
+ DEBUG(SSSDBG_TRACE_ALL, "WARNING: Could not remove entry %s,"
" from old ldb file! (%d [%s])\n",
ldb_dn_get_linearized(groups_dn),
ret, ldb_errstring(ldb));
}
ret = ldb_delete(ldb, users_dn);
if (ret != LDB_SUCCESS) {
- DEBUG(9, "WARNING: Could not remove entry %s,"
+ DEBUG(SSSDBG_TRACE_ALL, "WARNING: Could not remove entry %s,"
" from old ldb file! (%d [%s])\n",
ldb_dn_get_linearized(users_dn),
ret, ldb_errstring(ldb));
}
ret = ldb_delete(ldb, domain_dn);
if (ret != LDB_SUCCESS) {
- DEBUG(9, "WARNING: Could not remove entry %s,"
+ DEBUG(SSSDBG_TRACE_ALL, "WARNING: Could not remove entry %s,"
" from old ldb file! (%d [%s])\n",
ldb_dn_get_linearized(domain_dn),
ret, ldb_errstring(ldb));
@@ -519,7 +525,8 @@ int sysdb_check_upgrade_02(struct sss_domain_info *domains,
ret = ldb_transaction_commit(sysdb->ldb);
if (ret != LDB_SUCCESS) {
- DEBUG(1, "Failed to commit ldb transaction! (%d)\n", ret);
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ "Failed to commit ldb transaction! (%d)\n", ret);
ret = EIO;
goto done;
}
@@ -562,7 +569,8 @@ int sysdb_check_upgrade_02(struct sss_domain_info *domains,
ret = ldb_transaction_commit(ldb);
if (ret != LDB_SUCCESS) {
- DEBUG(1, "Failed to commit ldb transaction! (%d)\n", ret);
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ "Failed to commit ldb transaction! (%d)\n", ret);
ret = EIO;
goto exit;
}
@@ -574,12 +582,14 @@ done:
if (ctx_trans) {
ret = ldb_transaction_cancel(sysdb->ldb);
if (ret != LDB_SUCCESS) {
- DEBUG(1, "Failed to cancel ldb transaction! (%d)\n", ret);
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ "Failed to cancel ldb transaction! (%d)\n", ret);
}
}
ret = ldb_transaction_cancel(ldb);
if (ret != LDB_SUCCESS) {
- DEBUG(1, "Failed to cancel ldb transaction! (%d)\n", ret);
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ "Failed to cancel ldb transaction! (%d)\n", ret);
}
}