Ben Rockwood writes:
> I'm curious if its possible (speaking in terms of XML semantics) to allow
> an element to defined for a service and then over-riden by a later
> instance. 
> 
> An example would be to define a method_context within the service element,
> then to create multiple instance, only one of which uses a different
> method_context which would be defined within the instance element to
> effectively "over-ride" the (for lack of a better term) global definition. 
> 
> Based on my testing, as it stands now, anything that will differ between
> instances must be defined within each instance locally and not "shared"
> globally for the service. 
> 
> Being able to do this seems more intuitive to me, but maybe isn't good
> style.  I'm not sure.  Just an idea. 
> 
> benr.
>  
>  
> This message posted from opensolaris.org
> _______________________________________________
> smf-discuss mailing list
> smf-discuss at opensolaris.org

I ran a little test, and it appears to me that an instance will inherit the
service's method_context unless it is overriden in the instance
definition.  Here is my test manifest:

<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--
        Service manifest to see if instance can override service method
        context.
-->

<service_bundle type='manifest' name='nopkg:bogus_1'>

<service
        name='system/bogus_1'
        version='1'
        type='service'>

        <dependency
                name='usr'
                type='service'
                grouping='require_all'
                restart_on='none'>
                <service_fmri value='svc:/system/filesystem/local' />
        </dependency>

        <method_context working_directory='/var/tmp'>
                <method_credential user='smf_tst1' group='other' />
                <method_environment>
                        <envvar name='BOGUS' value='smft1' />
                </method_environment>
        </method_context>

        <exec_method
                type='method'
                name='start'
                exec='/var/tmp/bogus_1 start'
                timeout_seconds='60' />

        <exec_method
                type='method'
                name='stop'
                exec='/var/tmp/bogus_1 stop'
                timeout_seconds='60' />

        <exec_method
                type='method'
                name='refresh'
                exec='/var/tmp/bogus_1 refresh'
                timeout_seconds='60' />

        <exec_method
                type='method'
                name='restart'
                exec='/var/tmp/bogus_1 restart'
                timeout_seconds='60' />

        <property_group name='startd' type='framework'>
                <propval name='duration' type='astring'
                        value='transient' />
        </property_group>

        <instance name='a' enabled='false'>
                <method_context working_directory='/var/tmp'>
                        <method_credential user='root' group='staff' />
                        <method_environment>
                                <envvar name='BOGUS' value='a' />
                        </method_environment>
                </method_context>
        </instance>

        <instance name='b' enabled='false'>
        </instance>

        <stability value='Unstable' />

        <template>
                <common_name>
                        <loctext xml:lang='C'>
                                Manifest to test inheritance
                        </loctext>
                </common_name>

                <documentation>
                </documentation>
        </template>
</service>

</service_bundle>

Reply via email to