components/puppet/files/solaris/lib/puppet/type/svccfg.rb
changeset 1409 9db4ba32e740
child 2031 5b9a9cd91149
equal deleted inserted replaced
1408:8bc5df437e67 1409:9db4ba32e740
       
     1 #
       
     2 # CDDL HEADER START
       
     3 #
       
     4 # The contents of this file are subject to the terms of the
       
     5 # Common Development and Distribution License (the "License").
       
     6 # You may not use this file except in compliance with the License.
       
     7 #
       
     8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
       
     9 # or http://www.opensolaris.org/os/licensing.
       
    10 # See the License for the specific language governing permissions
       
    11 # and limitations under the License.
       
    12 #
       
    13 # When distributing Covered Code, include this CDDL HEADER in each
       
    14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
       
    15 # If applicable, add the following below this CDDL HEADER, with the
       
    16 # fields enclosed by brackets "[]" replaced with your own identifying
       
    17 # information: Portions Copyright [yyyy] [name of copyright owner]
       
    18 #
       
    19 # CDDL HEADER END
       
    20 #
       
    21 
       
    22 #
       
    23 # Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
       
    24 #
       
    25 
       
    26 Puppet::Type.newtype(:svccfg) do
       
    27     @doc = "Manage SMF service properties with svccfg(1M)."
       
    28 
       
    29     ensurable do
       
    30         newvalue(:present) do
       
    31             provider.create
       
    32         end
       
    33 
       
    34         newvalue(:absent) do
       
    35             provider.destroy
       
    36         end
       
    37 
       
    38         newvalue(:delcust) do
       
    39             provider.delcust
       
    40         end
       
    41     end
       
    42 
       
    43     newparam(:name) do
       
    44         desc "The symbolic name for properties to manipulate.  This name is
       
    45               used for human reference only"
       
    46         isnamevar
       
    47     end
       
    48 
       
    49     newparam(:fmri) do
       
    50         desc "SMF service FMRI to manipulate"
       
    51     end
       
    52 
       
    53     newparam(:property) do
       
    54         desc "Name of property - includes Property Group and Propery"
       
    55     end
       
    56 
       
    57     newparam(:type) do
       
    58         desc "Type of the property"
       
    59     end
       
    60 
       
    61     newparam(:value) do
       
    62         desc "Value of the property"
       
    63         munge do |value|
       
    64             # cast the value to an array
       
    65             if not value.is_a? Array
       
    66                 value = Array[value]
       
    67             end
       
    68 
       
    69             # wrap each entry in quotes
       
    70             value = value.collect{ |v| "\"#{v}\"" }
       
    71 
       
    72             value.insert(0, "(")
       
    73             value.insert(-1, ")")
       
    74         end
       
    75     end
       
    76 end