incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maha...@apache.org
Subject svn commit: r1401566 [2/2] - in /incubator/ambari/branches/AMBARI-666: ./ ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/ ambari-agent/src/main/python/ambari_agent/ ambari-server/src/main/java/org/apache/ambari/server/api/resources/ ambar...
Date Wed, 24 Oct 2012 06:24:21 GMT
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/python/ambari-server.py
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/python/ambari-server.py?rev=1401566&r1=1401565&r2=1401566&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/python/ambari-server.py (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/python/ambari-server.py Wed
Oct 24 06:24:20 2012
@@ -28,7 +28,7 @@ import re
 SETUP_ACTION = "setup"
 START_ACTION = "start"
 STOP_ACTION = "stop"
-SETUP_DB_CMD = "psql -W -f{2} -d{0} --username {1}"
+SETUP_DB_CMD = "sudo -u postgres psql -f {1} -d {0}"
 GET_SE_LINUX_ST_CMD = "sestatus"
 SE_STATUS_DISABLED="disabled"
 SE_STATUS_ENABLED="enabled"
@@ -42,6 +42,8 @@ AMBARI_CONF_VAR="AMBARI_CONF_DIR"
 PG_ST_CMD = "service postgresql status"
 PG_START_CMD = "service postgresql start"
 PG_STATUS_RUNNING = "running"
+PID_DIR="/var/run/ambari-server"
+PID_NAME="ambari-server.pid"
 
 def run_os_command(cmd):
   print 'about to run command: ' + cmd
@@ -55,9 +57,8 @@ def run_os_command(cmd):
 
 def setup_db(args):
   dbname = args.postgredbname
-  username = args.postgreuser
   file = args.init_script_file
-  command = SETUP_DB_CMD.format(dbname, username, file)
+  command = SETUP_DB_CMD.format(dbname, file)
   retcode, outdata, errdata = run_os_command(command)
   if not retcode == 0:
     print errdata
@@ -90,7 +91,10 @@ def ip_tables_down():
 
 def check_postgre_up():
   retcode, out, err = run_os_command(PG_ST_CMD)
-  pg_status = re.search('(stopped|running)', out).group(0)
+  try:
+    pg_status = re.search('(stopped|running)', out).group(0)
+  except AttributeError:
+    pg_status = None
   if pg_status == PG_STATUS_RUNNING:
     print "Postgre is running"
     return 0
@@ -142,15 +146,17 @@ def start(args):
   command = SERVER_START_CMD.format(conf_dir)
       
   server_process = subprocess.Popen(command.split(' '))
-  f = open("pid", "w")
+  f = open(PID_DIR + os.sep + PID_NAME, "w")
   f.write(str(server_process.pid))
   f.close()
   
 def stop(args):
-  f = open("pid", "r")
+  f = open(PID_DIR + os.sep + PID_NAME, "r")
   pid = int(f.readline())
   os.kill(pid, signal.SIGKILL)
   f.close()
+  os.remove(f.name)
+  
   
   
   
@@ -159,8 +165,6 @@ def main():
   parser = optparse.OptionParser(usage="usage: %prog [options] action",)
   parser.add_option('-d', '--postgredbname', default='postgres',
                       help="Database name in postgresql")
-  parser.add_option('-u', '--postgreuser', default='postgres',
-                      help="User in postgresql to run init scripts")
   parser.add_option('-f', '--init-script-file', default='setup_db.sql',
                       help="File with setup script")
 

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/resources/META-INF/persistence.xml?rev=1401566&r1=1401565&r2=1401566&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/resources/META-INF/persistence.xml
(original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/resources/META-INF/persistence.xml
Wed Oct 24 06:24:20 2012
@@ -23,6 +23,8 @@
     <class>org.apache.ambari.server.orm.entities.ClusterConfigEntity</class>
     <class>org.apache.ambari.server.orm.entities.ClusterServiceEntity</class>
     <class>org.apache.ambari.server.orm.entities.ClusterStateEntity</class>
+    <class>org.apache.ambari.server.orm.entities.ComponentConfigMappingEntity</class>
+    <class>org.apache.ambari.server.orm.entities.HostComponentConfigMappingEntity</class>
     <class>org.apache.ambari.server.orm.entities.HostComponentDesiredStateEntity</class>
     <class>org.apache.ambari.server.orm.entities.HostComponentStateEntity</class>
     <class>org.apache.ambari.server.orm.entities.HostComponentMappingEntity</class>
@@ -32,6 +34,7 @@
     <class>org.apache.ambari.server.orm.entities.ServiceComponentDesiredStateEntity</class>
     <class>org.apache.ambari.server.orm.entities.ServiceComponentHostConfigEntity</class>
     <class>org.apache.ambari.server.orm.entities.ServiceConfigEntity</class>
+    <class>org.apache.ambari.server.orm.entities.ServiceConfigMappingEntity</class>
     <class>org.apache.ambari.server.orm.entities.ServiceDesiredStateEntity</class>
     <class>org.apache.ambari.server.orm.entities.RoleEntity</class>
     <class>org.apache.ambari.server.orm.entities.UserEntity</class>
@@ -54,6 +57,8 @@
     <class>org.apache.ambari.server.orm.entities.ClusterConfigEntity</class>
     <class>org.apache.ambari.server.orm.entities.ClusterServiceEntity</class>
     <class>org.apache.ambari.server.orm.entities.ClusterStateEntity</class>
+    <class>org.apache.ambari.server.orm.entities.ComponentConfigMappingEntity</class>
+    <class>org.apache.ambari.server.orm.entities.HostComponentConfigMappingEntity</class>
     <class>org.apache.ambari.server.orm.entities.HostComponentDesiredStateEntity</class>
     <class>org.apache.ambari.server.orm.entities.HostComponentStateEntity</class>
     <class>org.apache.ambari.server.orm.entities.HostComponentMappingEntity</class>
@@ -63,6 +68,7 @@
     <class>org.apache.ambari.server.orm.entities.ServiceComponentDesiredStateEntity</class>
     <class>org.apache.ambari.server.orm.entities.ServiceComponentHostConfigEntity</class>
     <class>org.apache.ambari.server.orm.entities.ServiceConfigEntity</class>
+    <class>org.apache.ambari.server.orm.entities.ServiceConfigMappingEntity</class>
     <class>org.apache.ambari.server.orm.entities.ServiceDesiredStateEntity</class>
     <class>org.apache.ambari.server.orm.entities.RoleEntity</class>
     <class>org.apache.ambari.server.orm.entities.UserEntity</class>



Mime
View raw message