Bug 689958

Summary: Generating a bootstrap w/o config files & remote commands does not include correct code
Product: Red Hat Satellite 5 Reporter: Matthew Davis <mdavis>
Component: ServerAssignee: Jan Pazdziora <jpazdziora>
Status: CLOSED DEFERRED QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 540CC: cperry
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-07-04 13:28:08 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 462714    

Description Matthew Davis 2011-03-22 21:11:44 UTC
Description of problem:

When you create a bootstrap file using the webui or 'rhn-bootstrap' and you do not select remote commands or config files, the code to do the config files or remote commands does not get populated in the bootstrap file.

Version-Release number of selected component (if applicable):
spacewalk-certs-tools-1.1.1-1.el5sat


How reproducible:
Everytime

Steps to Reproduce:
1. Generate a bootstrap using the webui or CLI
2. Be sure to check remote commands or config management
3. Generate another bootstrap using the webui or CLI
4. This time do NOT check remote commands or config management

See term output below:

[root@satellite bootstrap]# rhn-bootstrap --allow-config-actions
* bootstrap overrides (written):
  '/var/www/html/pub/bootstrap/client-config-overrides.txt'

Values written:
enableProxy              '0'
serverURL                'https://satellite.example.com/XMLRPC'
proxyPassword            ''
proxyUser                ''
sslCACert                '/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT'
httpProxy                ''
noSSLServerURL           'http://satellite.example.com/XMLRPC'
enableProxyAuth          '0'
useGPG                   1
* bootstrap script (written):
    '/var/www/html/pub/bootstrap/bootstrap.sh'

[root@satellite bootstrap]# rhn-bootstrap 
* WARNING: if there were hand edits to the rotated (backed up) file,
           some settings may need to be migrated.
* bootstrap overrides (written):
  '/var/www/html/pub/bootstrap/client-config-overrides.txt'

Values written:
enableProxy              '0'
serverURL                'https://satellite.example.com/XMLRPC'
proxyPassword            ''
proxyUser                ''
sslCACert                '/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT'
httpProxy                ''
noSSLServerURL           'http://satellite.example.com/XMLRPC'
enableProxyAuth          '0'
useGPG                   1
* rotating /var/www/html/pub/bootstrap/bootstrap.sh --> /var/www/html/pub/bootstrap/bootstrap.sh.1
* bootstrap script (written):
    '/var/www/html/pub/bootstrap/bootstrap.sh'

[root@satellite bootstrap]# diff -u bootstrap.sh bootstrap.sh.1
--- bootstrap.sh        2011-03-22 17:10:22.000000000 -0400
+++ bootstrap.sh.1      2011-03-22 17:10:20.000000000 -0400
@@ -87,7 +87,7 @@
 
 REGISTER_THIS_BOX=1
 
-ALLOW_CONFIG_ACTIONS=0
+ALLOW_CONFIG_ACTIONS=1
 ALLOW_REMOTE_COMMANDS=0
 
 FULLY_UPDATE_THIS_BOX=1
@@ -240,6 +240,30 @@
     echo "* explicitely not registering"
 fi
 
+if [ $ALLOW_CONFIG_ACTIONS -eq 1 ] ; then 
+    echo
+    echo "* setting permissions to allow configuration management"
+    echo "  NOTE: use an activation key to subscribe to the tools"
+    if [ "$YUM" == yum ] ; then
+        echo "        channel and yum upgrade rhncfg-actions"
+    else
+        echo "        channel and up2date rhncfg-actions"
+    fi
+    if [ -x "/usr/bin/rhn-actions-control" ] ; then
+        rhn-actions-control --enable-all
+        rhn-actions-control --disable-run
+    else
+        echo "Error setting permissions for configuration management."
+        echo "    Please ensure that the activation key subscribes the"
+        if [ "$YUM" == yum ] ; then
+            echo "    system to the tools channel and yum updates rhncfg-actions."
+        else
+            echo "    system to the tools channel and up2dates rhncfg-actions."
+        fi
+        exit
+    fi
+fi
+
 echo
 echo "OTHER ACTIONS"
 echo "------------------------------------------------------"
[root@satellite bootstrap]#

Comment 1 Matthew Davis 2011-03-22 21:14:29 UTC
This is a problem if you generate a bootstrap w/o any params (--allow-config-actions), then want to allow config actions after the fact. The variable ALLOW_CONFIG_ACTIONS exists, but the code is not there to use the variable. Technically there is code there, but it doesn't work.

Namely this code.


    if [ $ALLOW_CONFIG_ACTIONS -eq 1 ] ; then
        for i in "/etc/sysconfig/rhn/allowed-actions /etc/sysconfig/rhn/allowed-actions/configfiles"; do
            [ -d "$i" ] || (mkdir -p $i && directories="$directories $i")
        done
        [ -f /etc/sysconfig/rhn/allowed-actions/configfiles/all ] || files="$files /etc/sysconfig/rhn/allowed-actions/configfiles/all"
        [ -n "$files" ] && touch  $files
    fi


That doesn't work correctly and should be removed.