components/openstack/keystone/files/keystone
changeset 5405 66fd59fecd68
parent 4049 150852e281c4
child 6851 f984e52b96bb
--- a/components/openstack/keystone/files/keystone	Fri Feb 05 11:09:10 2016 -0800
+++ b/components/openstack/keystone/files/keystone	Fri Feb 05 17:54:17 2016 -0500
@@ -19,20 +19,41 @@
 
 import smf_include
 
-from subprocess import CalledProcessError, check_call
+from subprocess import CalledProcessError, check_call, Popen
+
+
+def httpd(cmd):
+    cmd = ['/usr/apache2/2.4/bin/httpd', '-f',
+           '/var/lib/keystone/keystone.httpd.conf', '-k', cmd]
+    try:
+        Popen(cmd, stdout=sys.stdout, stderr=sys.stderr)
+    except CalledProcessError as err:
+        print >> sys.stderr, 'Error executing %s: %s' % (cmd, err)
+        sys.exit(smf_include.SMF_EXIT_ERR_FATAL)
+
+    sys.exit(smf_include.SMF_EXIT_OK)
 
 
 def start():
     # sync the database to make sure it's ready
-    cmd = ["/usr/bin/keystone-manage", "db_sync"]
+    cmd = ['/usr/bin/keystone-manage', 'db_sync']
     try:
         check_call(cmd)
     except CalledProcessError as err:
-        print "Unable to create database for Keystone:  %s" % err
+        print 'Unable to create database for Keystone:  %s' % err
         sys.exit(smf_include.SMF_EXIT_ERR_CONFIG)
 
-    smf_include.smf_subprocess("/usr/lib/keystone/keystone-all")
+    httpd('start')
+
+
+def stop():
+    httpd('stop')
+
 
-if __name__ == "__main__":
-    os.putenv("LC_ALL", "C")
+def restart():
+    httpd('restart')
+
+
+if __name__ == '__main__':
+    os.putenv('LC_ALL', 'C')
     smf_include.smf_main()