Bug 713526

Summary: rhn_check executed as non-root (using sudo) fails satellite provisioning install
Product: Red Hat Satellite 5 Reporter: Mike <MikeDawg>
Component: ProvisioningAssignee: Tomas Lestach <tlestach>
Status: CLOSED DEFERRED QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: low Docs Contact:
Priority: unspecified    
Version: 540CC: slukasik
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: 2015-05-29 20:02:43 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    
Attachments:
Description Flags
Proposed patch for /usr/share/rhn/spacewalkkoan.py none

Description Mike 2011-06-15 17:11:53 UTC
Description of problem:

Configured a system for a remote kickstart.  Went in to the advanced options to configure the network for the kickstart, and chose the option to use current network configuration of eth0.

In order to get the server to pick up the remote kickstart more quickly, I executed (as non-root user):  sudo /usr/sbin/rhn_check

The rhn_check failed, as well as the attempt to provision the host remotely.

Version-Release number of selected component (if applicable):
RHN Satellite Server: 5.4.0
Remote host:  Red Hat 5.6 x86_64

How reproducible:
Every time

Steps to Reproduce:
1. Schedule a remote kickstart of a server.
2. Choose to use static information from the Advanced Options page. (existing eth0 configuration, which is a static IP address, NOT DHCP) 
3. On the server that is being provisioned, execute (as non-root): sudo /usr/sbin/rhn_check
  
Actual results:

Get the following error:
[<redacted username>@<redacted servername> ~]$ sudo /usr/sbin/rhn_check

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.



[sudo] password for <redacted username>:
Preserve files! : []
sh: route: command not found
exceptions.IndexError
list index out of range
  File "/usr/share/rhn/spacewalkkoan/spacewalkkoan.py", line 100, in initiate
    update_static_device_records(kickstart_host, static_device)
   File "/usr/share/rhn/spacewalkkoan/spacewalkkoan.py", line 74, in update_static_device_records
    data = {"gateway": find_gateway(),\
   File "/usr/share/rhn/spacewalkkoan/spacewalkkoan.py", line 64, in find_gateway
    return response[0]


Expected results:

This command should execute as normal, and allow non-root user's (using sudo) to check in the system with rhn via /usr/sbin/rhn_check

Additional info:

Comment 1 Mike 2011-06-15 17:22:29 UTC
Created attachment 504911 [details]
Proposed patch for /usr/share/rhn/spacewalkkoan.py

Patch to path to /sbin/ to allow a non-root user (running command as sudo).

Comment 3 Tomas Lestach 2011-06-16 08:08:28 UTC
Please ignore Comment#2 ...

Preferred way is to use:
$ sudo -i /usr/sbin/rhn_check -vv