components/ruby/puppet/files/solaris/lib/puppet/type/pkg_publisher.rb
branchs11u2-sru
changeset 3460 5c5af6e58474
parent 3423 f15260c4f334
child 4106 ac78e6a526fe
child 5905 085130968f36
equal deleted inserted replaced
3457:6358358b4186 3460:5c5af6e58474
       
     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 require 'puppet/property/list'
       
    27 Puppet::Type.newtype(:pkg_publisher) do
       
    28     @doc = "Manage Oracle Solaris package publishers"
       
    29 
       
    30     ensurable
       
    31 
       
    32     newparam(:name) do
       
    33         desc "The publisher name"
       
    34         isnamevar
       
    35     end
       
    36 
       
    37     newproperty(:origin, :parent => Puppet::Property::List) do
       
    38         desc "Which origin URI(s) to set.  For multiple origins, specify them
       
    39               as a list"
       
    40 
       
    41         # ensure should remains an array
       
    42         def should
       
    43             @should
       
    44         end
       
    45 
       
    46         def insync?(is)
       
    47             is = [] if is == :absent or is.nil?
       
    48             is.sort == self.should.sort
       
    49         end
       
    50 
       
    51         def retrieve
       
    52             provider.origin
       
    53         end
       
    54 
       
    55         # for origins with a file:// URI, strip any trailing / character
       
    56         munge do |value|
       
    57             if value.start_with? "file" and value.end_with? "/"
       
    58                 value = value.chomp("/")
       
    59             else
       
    60                 value
       
    61             end
       
    62         end
       
    63     end
       
    64 
       
    65     newproperty(:enable) do
       
    66         desc "Enable the publisher"
       
    67         newvalues(:true, :false)
       
    68     end
       
    69 
       
    70     newproperty(:sticky) do
       
    71         desc "Set the publisher 'sticky'"
       
    72         newvalues(:true, :false)
       
    73     end
       
    74 
       
    75     newproperty(:searchfirst) do
       
    76         desc "Set the publisher first in the search order"
       
    77         newvalues(:true)
       
    78     end
       
    79 
       
    80     newproperty(:searchafter) do
       
    81         desc "Set the publisher after the specified publisher in the search
       
    82               order"
       
    83     end
       
    84 
       
    85     newproperty(:searchbefore) do
       
    86         desc "Set the publisher before the specified publisher in the search
       
    87               order"
       
    88     end
       
    89 
       
    90     newproperty(:proxy) do
       
    91         desc "Use the specified web proxy URI to retrieve content for the
       
    92               specified origin or mirror"
       
    93     end
       
    94 
       
    95     newproperty(:sslkey) do
       
    96         desc "Specify the client SSL key"
       
    97     end
       
    98 
       
    99     newproperty(:sslcert) do
       
   100         desc "Specify the client SSL certificate"
       
   101     end
       
   102 end