Bug 1178484 - [puppet]The value of roles shouldn't include characters [",]
Summary: [puppet]The value of roles shouldn't include characters [",]
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Installer
Version: 2.2.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Scott Dodson
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-01-04 08:39 UTC by Ma xiaoqiang
Modified: 2016-07-04 00:45 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-05-12 16:36:48 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:1065 0 normal SHIPPED_LIVE Red Hat OpenShift Enterprise atomic-openshift-utils bug fix update 2016-05-12 20:32:56 UTC

Description Ma xiaoqiang 2015-01-04 08:39:00 UTC
Description of problem:
The value of roles should be a string

Version-Release number of selected component (if applicable):
openshift-openshift_origin (v4.1.2)


How reproducible:
100%


Steps to Reproduce:
1. Install node according to the following configuration:
node /^node2/ {
  class { 'openshift_origin':
    roles                           => ["node"],
    msgserver_tls_enabled           => 'enabled',
    msgserver_tls_ca                => '/etc/puppetlabs/puppet/ssl/certs/ca.pem',
    msgserver_tls_cert              => inline_template('<%= "/etc/puppetlabs/puppet/ssl/certs/#{fqdn.downcase}.pem" %>'),
    msgserver_tls_key               => inline_template('<%= "/etc/puppetlabs/puppet/ssl/private_keys/#{fqdn.downcase}.pem" %>'),
    install_cartridges_optional_deps => ["php", "jbosseap"],
    install_cartridges              => ["php", "jbosseap"],
    node_hostname                   => 'node2.ose22-test.com.cn',
    domain                          => 'ose22-test.com.cn',
    bind_key                        => '4q9vJH2UPhtwHfQJzl8zu8XXtCYzExBMevU5SLG7VuGsLRi4hk8AuPVozb2fx3BJ4y1ejFZvpPJk1rtaOGEmqg==',
    install_method                  => 'none',
    node_ip_addr                    => '10.66.79.136',
    nameserver_ip_addr              => '10.66.79.142',
    ose_version                     => '2.2',
    conf_nameserver_upstream_dns    => ['10.66.127.17'],
    register_host_with_nameserver   => true,
  }
}

2. Check the script '/usr/local/bin/puppet-oo-admin-yum-validator'
#vim /usr/local/bin/puppet-oo-admin-yum-validator
ooayv=$( /usr/bin/oo-admin-yum-validator -a [" -r node", " -r node-eap"] )
ooayv=$( /usr/bin/oo-admin-yum-validator  [" -r node", " -r node-eap"] )
if [ $? -eq 0 ]
then
   touch /etc/yum-validator/.oo_admin_yum_validator_success
   exit 0
else
   exit 1
fi


Actual results:
The value of roles is as below
ooayv=$( /usr/bin/oo-admin-yum-validator -a [" -r node", " -r node-eap"] )
ooayv=$( /usr/bin/oo-admin-yum-validator  [" -r node", " -r node-eap"] )

Expected results:
The roles should be transfered as  "ooayv=$( /usr/bin/oo-admin-yum-validator -a  -r node  -r node-eap )
Should run oo-admin-yum-validator with specified version of ose

Additional info:

Comment 1 Scott Dodson 2015-01-07 20:15:18 UTC
Interesting find, I can only reproduce this when using a puppet master or when using puppet enterprise, one of the two. Masterless configs using puppet opensource are fine.

Comment 2 Scott Dodson 2015-01-07 20:44:02 UTC
Ruby 1.8.7 flattens arrays into strings automatically where as Ruby 1.9.x doesn't. So we must call join to explicitly flatten the array into a string with no separators.

I've pushed an additional commit to the pull request which should address this.

commit ef11e2d6329290ed9baf56aebec6654ed69dad47
Author: Scott Dodson <sdodson>
Date:   Wed Jan 7 15:40:35 2015 -0500

    Use join to flatten the array into a string.
    
    Ruby 1.8.7 seems to automatically flatten the array into a string where as
    Ruby 1.9.1 (as packaged in PE3.3.2 and PE3.7) don't.

diff --git a/manifests/oo_admin_yum_validator.pp b/manifests/oo_admin_yum_validator.pp
index 31e09ab..ad1a203 100644
--- a/manifests/oo_admin_yum_validator.pp
+++ b/manifests/oo_admin_yum_validator.pp
@@ -19,7 +19,7 @@ class openshift_origin::oo_admin_yum_validator {
     if member($roles, 'node') { $role_node = 'node' } else { $role_node = '' }
     if member($roles, 'broker') { $role_broker = 'broker -r client' } else { $role_broker = '' }
     $role_list = [$role_node, $role_amq, $role_eap, $role_fuse, $role_broker]
-    $role_string = prefix(delete($role_list,''), ' -r ')
+    $role_string = join( prefix( delete( $role_list, '' ), ' -r ' ), '' )
 
     # oo-admin-yum-validator -a returns 1 if it made changes and 0 if no changes
     # so use a wrapper to fix everything then call it again to check for issues

Comment 3 Ma xiaoqiang 2015-01-08 00:51:24 UTC
Please specify the version of ose in 'puppet-oo-admin-yum-validator.erb' file, or oo-admin-yum-validator will prompt that it can not detect the version of ose.

Comment 4 Scott Dodson 2015-01-09 16:08:43 UTC
Ma,

Ok I pushed another change. The version should be carried through from ose_version parameter now. I tested this on a clean machine and it ran fine without any prior setup other than ensuring the repos were available. Hopefully everything works now, thanks for your attention to detail!

--
Scott

Comment 5 Ma xiaoqiang 2015-01-12 05:32:34 UTC
it works fine.

Comment 7 errata-xmlrpc 2016-05-12 16:36:48 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2016:1065


Note You need to log in before you can comment on or make changes to this bug.