You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by mp...@apache.org on 2015/08/03 16:48:16 UTC

ambari git commit: AMBARI-12560. Ambari-server reset action works incorrectly for external DB. (Vitaly Brodetskyi via mpapirkovskyy)

Repository: ambari
Updated Branches:
  refs/heads/trunk 6c4eba4af -> 2f950f9c2


AMBARI-12560. Ambari-server reset action works incorrectly for external DB. (Vitaly Brodetskyi via mpapirkovskyy)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2f950f9c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2f950f9c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2f950f9c

Branch: refs/heads/trunk
Commit: 2f950f9c2a84359eeb61e119a248240a12457e54
Parents: 6c4eba4
Author: Myroslav Papirkovskyy <mp...@hortonworks.com>
Authored: Mon Aug 3 17:08:40 2015 +0300
Committer: Myroslav Papirkovskyy <mp...@hortonworks.com>
Committed: Mon Aug 3 17:09:46 2015 +0300

----------------------------------------------------------------------
 .../src/main/python/ambari_server/serverSetup.py    | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2f950f9c/ambari-server/src/main/python/ambari_server/serverSetup.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari_server/serverSetup.py b/ambari-server/src/main/python/ambari_server/serverSetup.py
index e76d2bc..123ae3b 100644
--- a/ambari-server/src/main/python/ambari_server/serverSetup.py
+++ b/ambari-server/src/main/python/ambari_server/serverSetup.py
@@ -54,6 +54,8 @@ SE_STATUS_ENABLED = "enabled"
 SE_MODE_ENFORCING = "enforcing"
 SE_MODE_PERMISSIVE = "permissive"
 
+PERSISTENCE_TYPE_PROPERTY = "server.persistence.type"
+
 # Non-root user setup commands
 NR_USER_COMMENT = "Ambari user"
 
@@ -928,11 +930,17 @@ def _reset_database(options):
   if properties == -1:
     print_error_msg("Error getting ambari properties")
     return -1
+  persistence_type = properties[PERSISTENCE_TYPE_PROPERTY]
+  if persistence_type == "remote":
+      err = 'Ambari doesn\'t support resetting exernal DB automatically. ' \
+            'To reset Ambari Server schema you must first drop and then create it ' \
+            'using DDL scripts from "\/var/lib/ambari-server/resources/\"'
+      raise FatalException(1, err)
+  else:
+    factory = DBMSConfigFactory()
 
-  factory = DBMSConfigFactory()
-
-  dbmsAmbari = factory.create(options, properties)
-  dbmsAmbari.reset_database()
+    dbmsAmbari = factory.create(options, properties)
+    dbmsAmbari.reset_database()
 
 
 #