|
45 | 45 | -> Package[ $::subscription_manager::package_names ]
|
46 | 46 | }
|
47 | 47 |
|
48 |
| - # shorten several really long names |
49 |
| - $_ca = $::facts['rhsm_ca_name'] |
50 |
| - $_id = $::facts['rhsm_identity'] |
51 |
| - $_prefix = $::subscription_manager::ca_package_prefix |
52 |
| - $_hostname = $::subscription_manager::server_hostname |
53 |
| - $_pkg = "${_prefix}${_hostname}" # 80-column puppet-lint limit workaround |
| 48 | + if $::subscription_manager::ca_package { |
| 49 | + # shorten several really long names |
| 50 | + $_ca = $::facts['rhsm_ca_name'] |
| 51 | + $_id = $::facts['rhsm_identity'] |
| 52 | + $_prefix = $::subscription_manager::ca_package_prefix |
| 53 | + $_hostname = $::subscription_manager::server_hostname |
| 54 | + $_pkg = "${_prefix}${_hostname}" # 80-column puppet-lint limit workaround |
54 | 55 |
|
55 |
| - # four scenarios |
56 |
| - # I. never registered |
57 |
| - # - no ca_name |
58 |
| - # - no identity |
59 |
| - # - just install normally |
60 |
| - package { $_pkg: |
61 |
| - ensure => 'present', |
62 |
| - provider => 'rpm', |
63 |
| - source => |
64 |
| - "http://${_hostname}/pub/${_prefix}latest.noarch.rpm", |
65 |
| - } |
| 56 | + # four scenarios |
| 57 | + # I. never registered |
| 58 | + # - no ca_name |
| 59 | + # - no identity |
| 60 | + # - just install normally |
| 61 | + package { $_pkg: |
| 62 | + ensure => 'present', |
| 63 | + provider => 'rpm', |
| 64 | + source => |
| 65 | + "http://${_hostname}/pub/${_prefix}latest.noarch.rpm", |
| 66 | + } |
66 | 67 |
|
67 |
| - # II. registered to correct server |
68 |
| - # - ca_name == server_hostname |
69 |
| - # - identity is set |
70 |
| - # - do nothing new, let puppet idempotency handle it |
| 68 | + # II. registered to correct server |
| 69 | + # - ca_name == server_hostname |
| 70 | + # - identity is set |
| 71 | + # - do nothing new, let puppet idempotency handle it |
71 | 72 |
|
72 |
| - # III. registered to different server |
73 |
| - # - ca_name != server_hostname |
74 |
| - # - identity may or may not be set |
75 |
| - # - remove old, install new |
76 |
| - if $_ca != '' and $_ca != undef { |
77 |
| - # an SSL Certificate Authority is detected |
78 |
| - # does it match server_hostname (aka _suffix for the package) |
79 |
| - if $_ca != $_hostname { |
80 |
| - # but CA is changing |
81 |
| - # remove the old package |
82 |
| - package { "${_prefix}${_ca}": ensure => 'absent', } |
83 |
| - Package["${_prefix}${_ca}"] -> Package[$_pkg] |
| 73 | + # III. registered to different server |
| 74 | + # - ca_name != server_hostname |
| 75 | + # - identity may or may not be set |
| 76 | + # - remove old, install new |
| 77 | + if $_ca != '' and $_ca != undef { |
| 78 | + # an SSL Certificate Authority is detected |
| 79 | + # does it match server_hostname (aka _suffix for the package) |
| 80 | + if $_ca != $_hostname { |
| 81 | + # but CA is changing |
| 82 | + # remove the old package |
| 83 | + package { "${_prefix}${_ca}": ensure => 'absent', } |
| 84 | + Package["${_prefix}${_ca}"] -> Package[$_pkg] |
| 85 | + } |
84 | 86 | }
|
85 |
| - } |
86 | 87 |
|
87 |
| - # IV. registered to same server but CA is bad |
88 |
| - # - ca_name == server_hostname |
89 |
| - # - identity is not set |
90 |
| - # - reinstall (this requires a pupetlabs-transition) |
91 |
| - # This case is meant to prevent extra regitrations on pre-6.2 Satellite |
92 |
| - if ((($_id == '' or $_id == undef) and $_ca == $_hostname) or |
93 |
| - ($_ca == $_hostname and $::subscription_manager::force == true )) { |
94 |
| - $_attributes = { |
95 |
| - 'ensure' => 'absent', |
96 |
| - 'provider' => 'rpm', |
97 |
| - 'install_options' => [ '--force', '--nodeps' ], |
98 |
| - } |
99 |
| - transition {'purge-bad-rhsm_ca-package': |
100 |
| - resource => Package[$_pkg], |
101 |
| - attributes => $_attributes, |
102 |
| - prior_to => Package[$_pkg], |
| 88 | + # IV. registered to same server but CA is bad |
| 89 | + # - ca_name == server_hostname |
| 90 | + # - identity is not set |
| 91 | + # - reinstall (this requires a pupetlabs-transition) |
| 92 | + # This case is meant to prevent extra regitrations on pre-6.2 Satellite |
| 93 | + if ((($_id == '' or $_id == undef) and $_ca == $_hostname) or |
| 94 | + ($_ca == $_hostname and $::subscription_manager::force == true )) { |
| 95 | + $_attributes = { |
| 96 | + 'ensure' => 'absent', |
| 97 | + 'provider' => 'rpm', |
| 98 | + 'install_options' => [ '--force', '--nodeps' ], |
| 99 | + } |
| 100 | + transition {'purge-bad-rhsm_ca-package': |
| 101 | + resource => Package[$_pkg], |
| 102 | + attributes => $_attributes, |
| 103 | + prior_to => Package[$_pkg], |
| 104 | + } |
103 | 105 | }
|
104 | 106 | }
|
105 |
| - |
106 | 107 | }
|
0 commit comments