Bug 1061311 - rhqctl contains user modifiable values that result in an unsupported rhqctl script
Summary: rhqctl contains user modifiable values that result in an unsupported rhqctl s...
Alias: None
Product: JBoss Operations Network
Classification: JBoss
Component: Launch Scripts
Version: JON 3.2
Hardware: Unspecified
OS: Unspecified
Target Milestone: ER02
: JON 3.3.0
Assignee: Jay Shaughnessy
QA Contact: Filip Brychta
Depends On:
TreeView+ depends on / blocked
Reported: 2014-02-04 15:53 UTC by Larry O'Leary
Modified: 2018-12-04 17:19 UTC (History)
3 users (show)

The way documentation was worded in the rhqctl script suggested that environment variables could be modified directly in the script, rather than in a sourced file. Users who modified the script directly could have lost their changes if this script was updated in subsequent product releases. The script now adds support for a /bin/rhq-server-env.sh|bat file. The file is not mandatory, and is sourced by the tool only if it is present. The rhqctl script also includes error handling relating to this file to verify whether environment variables are required but not supplied by the user. The improved features of rhqctl remove any confusion about where to specify environment variables.
Clone Of:
Last Closed: 2014-12-11 13:59:14 UTC

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 699423 None None None Never
Red Hat Bugzilla 1059235 None None None Never
Red Hat Bugzilla 1066556 None None None Never
Red Hat Bugzilla 1085270 None None None Never
Red Hat Bugzilla 1095805 None None None Never
Red Hat Bugzilla 1130085 None None None Never

Internal Trackers: 1059235 1066556 1085270 1095805 1130085

Description Larry O'Leary 2014-02-04 15:53:53 UTC
Description of problem:
The rhqctl script contains environment variables that lead the user to believe they should change/modify them directly within the script.

Modifications to the binary/scripts provided as part of the base distribution can not be supported. These settings must be externalized so the user can easily modify them without direct modification to the control script itself.

Version-Release number of selected component (if applicable):

Additional info:
As with any script or execution environment, user supplied settings are provided via a sourced file. For example, rhqctl.conf may should contain such values.

This is very important for the following reasons:
- modification of a script file is error prone and may result in an invalid script file that can not be recovered;
- upgrades and patches may need to update rhqctl but if user configuration is mixed in the file the users configuration will always be lost;
- keeping configuration separate from execution makes it easier to identify active configuration values;

Comment 2 Jay Shaughnessy 2014-04-04 14:45:43 UTC
I don't think the intent of our script documentation is to encourage editing the script itself, but perhaps we should call that out more explicitly in the script comments/documentation.

If that is not sufficient then I think we would need to do as Larry suggests and add an rhq-server-env.sh|bat that gets sourced by the various server-side scripts.  I think a single file is best because it consolidates all of the settings in one place.  Common settings like RHQ_JAVA_HOME can be set once, and specific variables can be grouped and inspected against each other easily.

Comment 3 Jay Shaughnessy 2014-04-07 22:00:30 UTC
master commit 54af334ddb67f8286a2da6a614be8392342bfde3
Author: Jay Shaughnessy <jshaughn@redhat.com>
Date:   Mon Apr 7 16:25:03 2014 -0400

 Introduce rhq-server-env.bat.  Analogous .sh file coming in subsequent commit.

master commit 60e45c64874989f4136134827399bfaa4f7e164b
Author: Jay Shaughnessy <jshaughn@redhat.com>
Date:   Mon Apr 7 17:54:15 2014 -0400

 Introduce rhq-server-env.sh.  Now environment variables are set outside of the
 actual scripts used for installation, etc.

Comment 4 Jay Shaughnessy 2014-04-08 15:20:02 UTC
master commit 7f4465405f70af01080aa6af8674f47fe7b14059
Author: Jay Shaughnessy <jshaughn@redhat.com>
Date:   Tue Apr 8 11:17:58 2014 -0400

 Add logic to 'rhqctl upgrade' command to copy rhq-server-env.sh|bat from the
 old to new server, if it exists.  The old, potentially edited, version will
 be used and the new version will be backed up for reference in case it has
 new env variables and/or documentation.  This behavior is analogous to what
 we currently do for rhq-agent-env.sh|bat during an agent update.

 Also: fix an upgrade problem with server stop at the end of the upgrade.

Comment 6 Jay Shaughnessy 2014-04-24 20:10:35 UTC
master commit e7c9066d73b55c7f453ed29997c521c8a9d3c057
Author: Jay Shaughnessy <jshaughn@redhat.com>
Date:   Thu Apr 24 16:09:03 2014 -0400

    - Fix issues with rhq-encode-password.sh|bat
    - Don't abort script if rhq-server-env.sh|bat is not found

Comment 7 Simeon Pinder 2014-07-31 15:49:43 UTC
Moving to ON_QA as available to test with brew build of DR01: https://brewweb.devel.redhat.com//buildinfo?buildID=373993

Comment 8 Filip Brychta 2014-08-14 11:45:47 UTC
Result of scenario from comment 5:
[hudson@fbr-upg-s bin]$ rm -rf rhq-server-env.sh 
[hudson@fbr-upg-s bin]$ ./rhqctl install
Failed to find rhq-server-env.sh. This file should exist in the bin directory.

It works correctly on windows.

Version :	
Build Number :	

Comment 9 Jay Shaughnessy 2014-08-19 14:49:10 UTC

master commit 3ba9855c298f6155cf77017e4e9eae0d664de590
Author: Jay Shaughnessy <jshaughn@redhat.com>
Date:   Tue Aug 19 10:45:10 2014 -0400

    Apply a missing fix to to rhqctl that was already in the .bat.

release/jon3.3.x commit 2d322b3533c3d7e86f107dad1ac499177fe64725
Author: Jay Shaughnessy <jshaughn@redhat.com>
Date:   Tue Aug 19 10:48:09 2014 -0400

    Cherry-pick master 7898bbbb65029a9cc6c1dd06584336a40d1117b5

Comment 10 Simeon Pinder 2014-09-03 20:31:20 UTC
Moving to ON_QA as available for test with the following brew build:

Comment 11 Filip Brychta 2014-09-08 11:22:48 UTC
Verified on
Version :	
Build Number :	

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