# HG changeset patch # User Stephen Talley # Date 1328632647 18000 # Node ID 801fce0dc0e227e6cc1c56b691578c37cfb1266d # Parent c7589c9a52a784ffcb94027812f77e06391c5f63 7143270 rad_dev.py shouldn't be part of smf delivery diff -r c7589c9a52a7 -r 801fce0dc0e2 usr/src/lib/pysmf/Makefile --- a/usr/src/lib/pysmf/Makefile Tue Feb 07 11:30:56 2012 -0500 +++ b/usr/src/lib/pysmf/Makefile Tue Feb 07 11:37:27 2012 -0500 @@ -20,13 +20,13 @@ # # -# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. # include $(SRC)/Makefile.env PROTO_PYRAD = $(PROTO_PYTHON)/smf -PYSRCS = __init__.py rad_dev.py rad.py fmri.py +PYSRCS = __init__.py rad.py fmri.py PYOBJS = $(PYSRCS:%.py=%.pyc) PYFILES = $(PYSRCS) $(PYOBJS) INSTFILES = $(PYFILES:%=$(PROTO_PYRAD)/%) diff -r c7589c9a52a7 -r 801fce0dc0e2 usr/src/lib/pysmf/rad_dev.py --- a/usr/src/lib/pysmf/rad_dev.py Tue Feb 07 11:30:56 2012 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. -# - -""" A thin wrapper around the SMF support provided by rad """ - -from __future__ import absolute_import -import rad.client as client -import rad.adaptor as adaptor -import rad.util as util -import threading -import smf.fmri -import os - -_RAD_SMF_DOMAIN = "org.opensolaris.os.smf" -_RAD_SMF_MODULE = "/usr/lib/rad/module/mod_smf_old.so" -_RAD_SMF_AGGREGATOR = client.Name(_RAD_SMF_DOMAIN, [("type", "aggregator")]) - -class Repository: - """ Represents a connection to the SCF repository """ - - def __init__(self, doorpath = None): - """ Establishes a connection to the SCF repository """ - if doorpath: - env = os.environ.copy() - env["LIBSCF_DOORPATH"] = doorpath - else: - env = None - self._rc = util.connect_private([ _RAD_SMF_MODULE ], env = env) - self._lock = threading.Lock() - self._aggr = None - - @staticmethod - def parts_to_name(service, instance = None): - """ Converts service and/or instance to a rad.client.Name """ - kvs = [("type", "service"), ("service", service)] - if instance: - kvs.append(("instance", instance)) - return client.Name(_RAD_SMF_DOMAIN, kvs) - - @staticmethod - def fmri_to_name(fmri): - """ Converts an FMRI object to a rad.client.Name """ - if fmri.get_scope() and fmri.get_scope() != "localhost": - raise ValueError, "non-localhost scope is unsupported" - - return Repository.parts_to_name(fmri.get_service(), - fmri.get_instance()) - - def lookup_byname(self, name): - """ Look up a service/instance object by rad.client.Name """ - return adaptor.RawAdaptor(self._rc.get_object(name)) - - def lookup(self, fmri): - """ Look up a service/instance object by FMRI object """ - return self.lookup_byname(self.fmri_to_name(fmri)) - - def lookup_byfmri(self, fmri): - """ Look up a service/instance object by svc: FMRI string """ - return self.lookup(smf.fmri.FMRI.parse(fmri)) - - def lookup_byparts(self, service, instance = None): - """ Look up a service/instance object by svc and/or inst """ - return self.lookup(self.parts_to_name(service, instance)) - - def get_master(self): - """ Returns the SMF master object """ - with self._lock: - if self._aggr == None: - self._aggr = self.lookup_byname( - _RAD_SMF_AGGREGATOR) - return self._aggr - - def close(self): - """ Closes the connection to the SCF repository """ - self._rc.close() diff -r c7589c9a52a7 -r 801fce0dc0e2 usr/src/pkg/manifests/library-python-2-python-smf.p5m --- a/usr/src/pkg/manifests/library-python-2-python-smf.p5m Tue Feb 07 11:30:56 2012 -0500 +++ b/usr/src/pkg/manifests/library-python-2-python-smf.p5m Tue Feb 07 11:37:27 2012 -0500 @@ -20,7 +20,7 @@ # # -# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. # license cr_Oracle license=cr_Oracle @@ -38,8 +38,6 @@ file path=usr/lib/python2.6/vendor-packages/smf/__init__.pyc file path=usr/lib/python2.6/vendor-packages/smf/rad.py file path=usr/lib/python2.6/vendor-packages/smf/rad.pyc -file path=usr/lib/python2.6/vendor-packages/smf/rad_dev.py -file path=usr/lib/python2.6/vendor-packages/smf/rad_dev.pyc file path=usr/lib/python2.6/vendor-packages/smf/fmri.py file path=usr/lib/python2.6/vendor-packages/smf/fmri.pyc depend fmri=pkg:/runtime/python-26 type=require