18 # |
18 # |
19 # CDDL HEADER END |
19 # CDDL HEADER END |
20 # |
20 # |
21 |
21 |
22 # |
22 # |
23 # Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
23 # Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. |
24 # |
24 # |
25 |
25 |
26 Puppet::Type.type(:pkg_publisher).provide(:pkg_publisher) do |
26 Puppet::Type.type(:pkg_publisher).provide(:pkg_publisher) do |
27 desc "Provider for Solaris publishers" |
27 desc "Provider for Solaris publishers" |
28 confine :operatingsystem => [:solaris] |
28 confine :operatingsystem => [:solaris] |
44 # strip off any trailing "/" characters |
44 # strip off any trailing "/" characters |
45 if origin.end_with?("/") |
45 if origin.end_with?("/") |
46 origin = origin[0..-2] |
46 origin = origin[0..-2] |
47 end |
47 end |
48 |
48 |
49 if publishers.has_key?(name): |
49 if publishers.has_key?(name) |
50 # if we've seen this publisher before, simply update the origin |
50 # if we've seen this publisher before, simply update the origin |
51 # array |
51 # array |
52 publishers[name]["origin"] << origin |
52 publishers[name]["origin"] << origin |
53 else |
53 else |
54 # create a new hash entry for this publisher |
54 # create a new hash entry for this publisher |
55 publishers[name] = {'sticky' => sticky, 'enable' => enabled, |
55 publishers[name] = {'sticky' => sticky, 'enable' => enabled, |
56 'origin' => Array[origin]} |
56 'origin' => Array[origin]} |
57 publishers[name]["proxy"] = proxy if proxy != "-" |
57 publishers[name]["proxy"] = proxy if proxy != "-" |
58 |
58 |
59 index = publisher_order.index(name) |
59 index = publisher_order.index(name) |
60 if index == 0: |
60 if index == 0 |
61 publishers[name]["searchfirst"] = true |
61 publishers[name]["searchfirst"] = true |
62 publishers[name]["searchafter"] = nil |
62 publishers[name]["searchafter"] = nil |
63 else |
63 else |
64 publishers[name]["searchfirst"] = nil |
64 publishers[name]["searchfirst"] = nil |
65 publishers[name]["searchafter"] = publisher_order[index-1] |
65 publishers[name]["searchafter"] = publisher_order[index-1] |