components/ruby/puppet/files/solaris/lib/puppet/provider/nis/solaris.rb
author Kristina Tripp <Kristina.Tripp@oracle.com>
Fri, 07 Nov 2014 12:43:50 -0800
branchs11u2-sru
changeset 3460 5c5af6e58474
parent 2928 components/puppet/files/solaris/lib/puppet/provider/nis/solaris.rb@43b3da52b84a
permissions -rw-r--r--
18960221 problem in UTILITY/PUPPET 18960237 Update Puppet to 3.6.2 19612179 Prepare puppet code to support multiple or different releases of ruby 19652539 gmake install of puppet fails due to Makefile omission 19646558 puppet-19 package not installed if ruby-19 not installed 19685659 salvage warning upgrading puppet 19988165 Puppet <name>~ files from patch process are included in puppet-19 package
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2771
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
     1
#
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
     2
# CDDL HEADER START
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
     3
#
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
     4
# The contents of this file are subject to the terms of the
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
     5
# Common Development and Distribution License (the "License").
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
     6
# You may not use this file except in compliance with the License.
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
     7
#
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
     8
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
     9
# or http://www.opensolaris.org/os/licensing.
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    10
# See the License for the specific language governing permissions
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    11
# and limitations under the License.
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    12
#
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    13
# When distributing Covered Code, include this CDDL HEADER in each
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    14
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    15
# If applicable, add the following below this CDDL HEADER, with the
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    16
# fields enclosed by brackets "[]" replaced with your own identifying
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    17
# information: Portions Copyright [yyyy] [name of copyright owner]
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    18
#
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    19
# CDDL HEADER END
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    20
#
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    21
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    22
#
2928
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
    23
# Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
2771
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    24
#
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    25
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    26
Puppet::Type.type(:nis).provide(:nis) do
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    27
    desc "Provider for management of NIS client for Oracle Solaris"
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    28
    confine :operatingsystem => [:solaris]
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    29
    defaultfor :osfamily => :solaris, :kernelrelease => ['5.11', '5.12']
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    30
    commands :svccfg => '/usr/sbin/svccfg', :svcprop => '/usr/bin/svcprop'
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    31
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    32
    class << self; attr_accessor :client_fmri, :domain_fmri end
2928
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
    33
    Client_fmri = "svc:/network/nis/client"
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
    34
    Domain_fmri = "svc:/network/nis/domain"
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
    35
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
    36
    def initialize(value={})
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
    37
        super(value)
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
    38
        @client_refresh = false
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
    39
        @domain_refresh = false
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
    40
    end
2771
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    41
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    42
    def self.instances
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    43
        props = {}
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    44
        validprops = Puppet::Type.type(:nis).validproperties
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    45
2928
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
    46
        [Client_fmri, Domain_fmri].each do |svc|
2771
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    47
            svcprop("-p", "config", svc).split("\n").collect do |line|
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    48
                data = line.split()
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    49
                fullprop = data[0]
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    50
                type = data[1]
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    51
                if data.length > 2
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    52
                    value = data[2..-1].join(" ")
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    53
                else
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    54
                    value = nil
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    55
                end
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    56
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    57
                pg, prop = fullprop.split("/")
2928
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
    58
                props[prop] = value if validprops.include? prop.to_sym
2771
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    59
            end
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    60
        end
2928
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
    61
        props[:name] = "current"
2771
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    62
        return Array new(props)
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    63
    end
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    64
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    65
    # svc:/network/nis/client properties
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    66
    [:use_broadcast, :use_ypsetme].each do |field|
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    67
        define_method(field) do
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    68
            begin
2928
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
    69
                svcprop("-p", "config/" + field.to_s, Client_fmri).strip()
2771
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    70
            rescue
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    71
                # if the property isn't set, don't raise an error
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    72
                nil
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    73
            end
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    74
        end
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    75
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    76
        define_method(field.to_s + "=") do |should|
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    77
            begin
2928
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
    78
                if not should.to_s.empty?
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
    79
                    value = "\"" + should.to_s + "\""
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
    80
                else
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
    81
                    value = should.to_s
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
    82
                end
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
    83
                svccfg("-s", Client_fmri, "setprop", "config/" + field.to_s,
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
    84
                       "=", value)
2771
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    85
            rescue => detail
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    86
                raise Puppet::Error,
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    87
                    "Unable to set #{field.to_s} to #{should.inspect}\n"
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    88
                    "#{detail}\n"
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    89
            end
2928
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
    90
            @client_refresh = true
2771
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    91
        end
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    92
    end
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    93
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    94
    # svc:/network/nis/domain properties
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    95
    [:domainname, :ypservers, :securenets].each do |field|
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    96
        define_method(field) do
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    97
            begin
2928
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
    98
                svcprop("-p", "config/" + field.to_s, Domain_fmri).strip()
2771
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
    99
            rescue
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
   100
                # if the property isn't set, don't raise an error
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
   101
                nil
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
   102
            end
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
   103
        end
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
   104
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
   105
        define_method(field.to_s + "=") do |should|
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
   106
            begin
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
   107
                if should.is_a? Array
2928
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
   108
                    # in Solaris 11, the list of values needs to be single
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
   109
                    # argument to svccfg.
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
   110
                    values = ""
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
   111
                    for entry in should
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
   112
                        values += "\"#{entry}\" "
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
   113
                    end
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
   114
                    values = "(" + values + ")"
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
   115
                    svccfg("-s", Domain_fmri, "setprop",
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
   116
                           "config/" + field.to_s, "=", values)
2771
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
   117
                else
2928
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
   118
                    # Puppet seems to get confused about when to pass an empty
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
   119
                    # string or "\"\"".  Catch either condition to handle
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
   120
                    # passing values to SMF correctly
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
   121
                    if should.to_s.empty? or should.to_s == '""'
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
   122
                        value = should.to_s
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
   123
                    else
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
   124
                        value = "\"" + should.to_s + "\""
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
   125
                    end
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
   126
                    svccfg("-s", Domain_fmri, "setprop",
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
   127
                           "config/" + field.to_s, "=", value)
2771
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
   128
                end
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
   129
            rescue => detail
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
   130
                raise Puppet::Error,
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
   131
                    "Unable to set #{field.to_s} to #{should.inspect}\n"
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
   132
                    "#{detail}\n"
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
   133
            end
2928
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
   134
            @domain_refresh = true
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
   135
        end
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
   136
    end
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
   137
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
   138
    def flush
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
   139
        if @domain_refresh == true
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
   140
            svccfg("-s", Domain_fmri, "refresh")
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
   141
        end
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
   142
        if @client_refresh == true
43b3da52b84a PSARC 2013/426 Puppet 3.4.1
Drew Fisher <drew.fisher@oracle.com>
parents: 2771
diff changeset
   143
            svccfg("-s", Client_fmri, "refresh")
2771
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
   144
        end
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
   145
    end
8e4227dc2fc4 16453463 Update Puppet's offerings on Solaris
Virginia Wray <virginia.wray@oracle.com>
parents:
diff changeset
   146
end