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, 2014, 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 meaningful only within Puppet manifests and not expressed to |
|
46 SMF in any way." |
|
47 isnamevar |
|
48 end |
|
49 |
|
50 newparam(:fmri) do |
|
51 desc "SMF service FMRI to manipulate" |
|
52 end |
|
53 |
|
54 newparam(:property) do |
|
55 desc "Name of property - includes Property Group and Property. If |
|
56 the service, instance, or property group does not exist, they |
|
57 will be created." |
|
58 end |
|
59 |
|
60 newparam(:type) do |
|
61 desc "Type of the property" |
|
62 end |
|
63 |
|
64 newparam(:value) do |
|
65 desc "Value of the property" |
|
66 munge do |value| |
|
67 # cast the value to an array. This is done for the case where a |
|
68 # property needs to be set. exists? will undo all of this and |
|
69 # revert the value into a simple string for comparisons. |
|
70 if not value.is_a? Array |
|
71 value = Array[value] |
|
72 end |
|
73 |
|
74 # wrap each entry in quotes |
|
75 value = value.collect{ |v| "\"#{v}\"" } |
|
76 |
|
77 value.insert(0, "(") |
|
78 value.insert(-1, ")") |
|
79 end |
|
80 end |
|
81 end |
|