Skip to content
This repository was archived by the owner on Aug 29, 2018. It is now read-only.

Commit b35d0ea

Browse files
committed
Add oo-admin-yum-validator for OSE installs
This utility ensures proper yum repo priorities and sets up excludes for certain packages. This utility is expected to be run after all appopriate yum repos have been created and before installing OSE components. More details on this tool: https://github.com/openshift/openshift-extras/tree/master/admin/yum-validator
1 parent 5d07998 commit b35d0ea

6 files changed

+72
-5
lines changed

README_OSE.asciidoc

+11-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,18 @@ Deployment Guide for current prerequisites and supported configuration details.
1717
* 10gen-mms-agent and phpmyadmin cartridges are not included in Openshift Enterprise and therefore have been
1818
removed from the list of default cartridges
1919

20+
=== oo-admin-yum-validator
21+
If ose_version is set then oo-admin-yum-validator with the ---fixall flag will be
22+
run prior to installing OSE packages. Once oo-admin-yum-validator has run
23+
successfully puppet will not run it again. If you modify your yum configuration
24+
after oo-admin-yum-validator has been executed you should you should re-run
25+
oo-admin-yum-validator to ensure proper repo priorities and package exclusions.
26+
2027
=== Yum repositories
21-
Configuring yum repositories via this module is not currently supported. Please ensure subscriptions and/or
22-
yum repositories are configured per the deployment guide. https://access.redhat.com/documentation/en-US/OpenShift_Enterprise/2/html/Deployment_Guide/Red_Hat_Subscription_Requirements.html
28+
Configuring yum repositories via this module is not currently supported. Please
29+
ensure subscriptions and/or yum repositories are configured per the deployment
30+
guide.
31+
https://access.redhat.com/documentation/en-US/OpenShift_Enterprise/2/html/Deployment_Guide/Red_Hat_Subscription_Requirements.html
2332

2433
=== TODO
2534
* Use stored configs to push node dns changes from broker without sharing secrets to nodes

manifests/init.pp

-2
Original file line numberDiff line numberDiff line change
@@ -908,8 +908,6 @@
908908
$install_cartridges_optional_deps = undef,
909909
$manage_firewall = true,
910910
) inherits openshift_origin::params {
911-
include openshift_origin::role
912-
913911
$default_host_domain = $dns_infrastructure_zone ? {
914912
'' => $domain,
915913
default => $dns_infrastructure_zone,

manifests/install_method.pp

+6
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,13 @@
2323
class { 'openshift_origin::yum_install_method':
2424
stage => 'first',
2525
}
26+
Class['Openshift_origin::Yum_install_method'] ->
27+
Class['Openshift_origin::Oo_admin_yum_validator']
2628
}
2729
default: {}
2830
}
31+
class { 'openshift_origin::oo_admin_yum_validator':
32+
stage => 'first',
33+
}
2934
}
35+

manifests/oo_admin_yum_validator.pp

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Runs oo-admin-yum-validator ensuring OSE repos have higher priorities and
2+
# a few key package exclusions in order to assist in ensuring a supportable
3+
# install
4+
#
5+
# oo-admin-yum-validator has the following roles node, broker, client, node-eap,
6+
# node-fuse, node-amq which we have to translate puppet's concept of roles into,
7+
# broker is trivial, node roles get dicey because we have to examine the
8+
# cartridges being installed and add aditional oo-admin-yum-validator roles
9+
# based on those
10+
class openshift_origin::oo_admin_yum_validator {
11+
if $::openshift_origin::ose_version {
12+
package{ 'openshift-enterprise-yum-validator': }
13+
14+
$carts = $::openshift_origin::cartridges_to_install
15+
$roles = $::openshift_origin::roles
16+
if member($carts, 'amq') and member($roles, 'node') { $role_amq = 'node-amq' } else { $role_amq = '' }
17+
if member($carts, 'jbosseap') and member($roles, 'node') { $role_eap = 'node-eap' } else { $role_eap = '' }
18+
if member($carts, 'fuse') and member($roles, 'node') { $role_fuse = 'node-fuse' } else { $role_fuse = '' }
19+
if member($roles, 'node') { $role_node = 'node' } else { $role_node = '' }
20+
if member($roles, 'broker') { $role_broker = 'broker -r client' } else { $role_broker = '' }
21+
$role_list = [$role_node, $role_amq, $role_eap, $role_fuse, $role_broker]
22+
$role_string = join( prefix( delete( $role_list, '' ), ' -r ' ), '' )
23+
24+
# oo-admin-yum-validator -a returns 1 if it made changes and 0 if no changes
25+
# so use a wrapper to fix everything then call it again to check for issues
26+
file { '/usr/local/bin/puppet-oo-admin-yum-validator':
27+
mode => '0755',
28+
content => template('openshift_origin/puppet-oo-admin-yum-validator.erb'),
29+
notify => Exec['Yum validator fix-all'],
30+
}
31+
# refresh only so we only run this when roles change
32+
exec { 'Yum validator fix-all':
33+
command => '/usr/local/bin/puppet-oo-admin-yum-validator',
34+
require => [ Package['openshift-enterprise-yum-validator'],
35+
File['/usr/local/bin/puppet-oo-admin-yum-validator'], ],
36+
refreshonly => true,
37+
}
38+
}
39+
}

manifests/role.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515
#
1616
class openshift_origin::role {
17-
include openshift_origin::install_method
17+
require openshift_origin::install_method
1818
require openshift_origin::firewall::ssh
1919

2020
if ( $::openshift_origin::configure_ntp ) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
# oo-admin-yum-validator exits with 1 when it makes changes
3+
# so run it once with fix-all, then run it in reporting mode
4+
# to see if there are problems, if not write out a success marker
5+
# so puppet doesn't run this again
6+
ooayv=$( /usr/bin/oo-admin-yum-validator -o <%= scope.lookupvar('::openshift_origin::ose_version') %> -a <%= @role_string %> )
7+
ooayv=$( /usr/bin/oo-admin-yum-validator -o <%= scope.lookupvar('::openshift_origin::ose_version') %> <%= @role_string %> )
8+
if [ $? -eq 0 ]
9+
then
10+
touch /etc/yum-validator/.oo_admin_yum_validator_success
11+
exit 0
12+
else
13+
exit 1
14+
fi
15+

0 commit comments

Comments
 (0)