4049N/A#!/usr/bin/python2.7
2521N/A
6847N/A# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
2521N/A#
2521N/A# Licensed under the Apache License, Version 2.0 (the "License"); you may
2521N/A# not use this file except in compliance with the License. You may obtain
2521N/A# a copy of the License at
2521N/A#
2521N/A# http://www.apache.org/licenses/LICENSE-2.0
2521N/A#
2521N/A# Unless required by applicable law or agreed to in writing, software
2521N/A# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
2521N/A# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
2521N/A# License for the specific language governing permissions and limitations
2521N/A# under the License.
2521N/A
2521N/Aimport os
6847N/Afrom subprocess import CalledProcessError, check_call, Popen
6847N/Aimport sys
2521N/A
2521N/Aimport smf_include
2521N/A
2521N/A
6847N/Adef httpd(cmd):
6847N/A cmd = ['/usr/apache2/2.4/bin/httpd', '-f',
6847N/A '/var/lib/cinder/cinder.httpd.conf', '-k', cmd]
6847N/A try:
6847N/A Popen(cmd, stdout=sys.stdout, stderr=sys.stderr)
6847N/A except CalledProcessError as err:
6847N/A print >> sys.stderr, 'Error executing %s: %s' % (cmd, err)
6847N/A sys.exit(smf_include.SMF_EXIT_ERR_FATAL)
6847N/A
6847N/A sys.exit(smf_include.SMF_EXIT_OK)
6847N/A
6847N/A
2521N/Adef start():
6847N/A httpd('start')
6847N/A
6847N/A
6847N/Adef stop():
6847N/A httpd('stop')
6847N/A
6847N/A
6847N/Adef restart():
6847N/A httpd('restart')
6847N/A
2521N/A
2521N/Aif __name__ == "__main__":
2521N/A os.putenv("LC_ALL", "C")
2521N/A smf_include.smf_main()