heat-smf-method revision 4049
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync#!/usr/bin/python2.7
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync# Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync#
f6fd812d35e1100931d67e2f37b0e54ec3e91c6avboxsync# Licensed under the Apache License, Version 2.0 (the "License"); you may
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync# not use this file except in compliance with the License. You may obtain
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync# a copy of the License at
57958eb1223628d507daf47ed31ea25c4e8c6da9vboxsync#
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync# http://www.apache.org/licenses/LICENSE-2.0
92a27575521748a392dcd1b996fce55b87411a00vboxsync#
92a27575521748a392dcd1b996fce55b87411a00vboxsync# Unless required by applicable law or agreed to in writing, software
92a27575521748a392dcd1b996fce55b87411a00vboxsync# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
92a27575521748a392dcd1b996fce55b87411a00vboxsync# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
92a27575521748a392dcd1b996fce55b87411a00vboxsync# License for the specific language governing permissions and limitations
92a27575521748a392dcd1b996fce55b87411a00vboxsync# under the License.
92a27575521748a392dcd1b996fce55b87411a00vboxsync
92a27575521748a392dcd1b996fce55b87411a00vboxsyncimport errno
92a27575521748a392dcd1b996fce55b87411a00vboxsyncimport os
92a27575521748a392dcd1b996fce55b87411a00vboxsyncimport sys
92a27575521748a392dcd1b996fce55b87411a00vboxsync
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsyncimport smf_include
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync
c9dbeac49601b9e10f0941b1c8e4f97853d4fab5vboxsync
c9dbeac49601b9e10f0941b1c8e4f97853d4fab5vboxsyncdef start():
c9dbeac49601b9e10f0941b1c8e4f97853d4fab5vboxsync # All the Heat services do essentially the same thing, so there's no need
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync # to have different method executables. Just look at the FMRI and run the
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync # appropriate executable from /usr/lib/heat.
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync fmri = os.environ["SMF_FMRI"]
23179f1443b03947d85eccc81cbc6b5153a4abf3vboxsync exefile = os.path.basename(fmri.split(":")[1])
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync exepath = os.path.join("/usr/lib/heat", exefile)
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync smf_include.smf_subprocess(exepath)
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync
fb1975a6972d89de9e515bed0248db93f04ec9d8vboxsyncif __name__ == "__main__":
deb20978ac494bbd4fbd7722912f8acd3c395999vboxsync os.putenv("LC_ALL", "C")
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync smf_include.smf_main()
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync