Here is what I did a couple of years ago when I ran into this same problem:

I modified the beginning of the gensystemid code farther to find the 1st 
occurrence of  site-packages and stick the mrepo or rhn libraries before it 
like so:

import os, sys, getopt, getpass, urlparse, re
False = 0
True = 1
def find(target,items):
        texp = re.compile(target)
        found = False
        i = 0
        while (not(found) and i < len(items)):
            if (texp.search(items[i])):
                found = True
            i += 1
        return i

i = find('.*site-packages',sys.path)

print "Packages at ", i

if os.path.exists('/usr/share/mrepo/up2date_client/'):
    sys.path.insert(i-1, '/usr/share/mrepo/')
    sys.path.insert(i, '/usr/share/mrepo/up2date_client/')
#    sys.path.insert(-1, '/usr/share/mrepo/rhn/')
elif os.path.exists('/usr/share/rhn/up2date_client/'):
    sys.path.insert(i-1, '/usr/share/rhn/')
    sys.path.insert(i, '/usr/share/rhn/up2date_client/')
else:
    print >>sys.stderr, 'rhnget: up2date libraries are not installed. Aborting 
execution'
    sys.exit(1)

And from another message:

If you're having trouble with gensystemid Try changing the first few lines of 
the code like this:

if os.path.exists('/usr/share/mrepo/up2date_client/'):
    sys.path.insert(7, '/usr/share/mrepo/')
    sys.path.insert(7, '/usr/share/mrepo/up2date_client/')
elif os.path.exists('/usr/share/rhn/up2date_client/'):
    sys.path.insert(7, '/usr/share/rhn/')
    sys.path.insert(7, '/usr/share/rhn/up2date_client/')

This will insert the mrepo or rhn libraries ahead of the python site-packages.  
For some reason the site packages were promoted by several hops in the path 
list.

A better alternative would be to actually search the list and insert the rhn or 
mrepo libraries just prior to the site packages.   Maybe I'll have to learn 
enough python to pull this off.

In any event, I'm now getting an intelligible error message . Error 
communicating with the server. The message was:  Name or service not known.   

That is something I can investigate more directly I think.

Robert

From: [email protected] 
[mailto:[email protected]] On Behalf Of Boyd, Robert
Sent: Monday, August 06, 2012 5:52 PM
To: [email protected]; Alan Pittman; '[email protected]'
Subject: Re: [Spacewalk-list] mrepo / gensystemid errors

I found one answer to my question.   There is a handy tool called dumpObj that 
you can copy from 
http://code.activestate.com/recipes/137951-dump-all-the-attributes-of-an-object/

So I copied it and inserted it into gensystemid on both servers.   Here is the 
key thing I see that is different:

On the server where gensystemid fails (RHEL6.3) :

__file__              /usr/lib/python2.6/site-packages/rhn/rpclib.pyc
  __name__              rhn.rpclib
  __package__           rhn
  __version__           $Revision$

With sys.path:  ['/root', '/usr/lib64/python26.zip', '/usr/lib64/python2.6', 
'/usr/lib64/python2.6/plat-linux2', '/usr/lib64/python2.6/lib-tk', 
'/usr/lib64/python2.6/lib-old', '/usr/lib64/python2.6/lib-dynload', 
'/usr/lib64/python2.6/site-packages', 
'/usr/lib64/python2.6/site-packages/gst-0.10', 
'/usr/lib64/python2.6/site-packages/gtk-2.0', 
'/usr/lib64/python2.6/site-packages/webkit-1.0', 
'/usr/lib/python2.6/site-packages', '/usr/share/mrepo/', 
'/usr/share/mrepo/up2date_client/', 
'/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info']

On the RHEL 5.8 server where it works:

__file__              /usr/share/mrepo/rhn/rpclib.pyc
  __name__              rhn.rpclib
  __version__           $Revision: 118741 $

sys.path:  ['/root', '/usr/lib64/python24.zip', '/usr/lib64/python2.4', 
'/usr/lib64/python2.4/plat-linux2', '/usr/lib64/python2.4/lib-tk', 
'/usr/lib64/python2.4/lib-dynload', '/usr/lib64/python2.4/site-packages', 
'/usr/lib64/python2.4/site-packages/Numeric', 
'/usr/lib64/python2.4/site-packages/gtk-2.0', '/usr/share/mrepo/', 
'/usr/share/mrepo/up2date_client/', '/usr/lib/python2.4/site-packages']

So on the failing configuration somehow it's not finding the module which is 
clearly there.   I checked.  

Is there something wrong with the new search order?   I see that there are many 
differences in these 2 lists.   Anyone have a suggestion about what needs to be 
changed on the RHEL 6.3/Python 2.6 configuration to get the right module found?



Robert Boyd
Sr. Systems Engineer 
PeopleFluent
p. 919-645-2972 | c. 919-306-4681
e. [email protected]


Click here to experience the power of the new PeopleFluent Mirror Suite T

Visit: www.peoplefluent.com | Read: PeopleFluent Blog | Follow: @PeopleFluent

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Lichtinger, Bernhard
Sent: Wednesday, October 01, 2014 3:08 AM
To: [email protected]
Subject: Re: [Spacewalk-list] RHEL6 - Spacewalk - MREPO [SEC=UNOFFICIAL]

Hi,

I had to "patch" /usr/bin/gensystemid on my spacewalk-server to resolve this 
error.

> [root@xxxxxx ~]# gensystemid --release=6Server /var/mrepo
> gensystemid: Architecture not supplied, using system architecture 
> x86_64 RHN Username: <username> RHN Password:
> Traceback (most recent call last):
>  File "/usr/bin/gensystemid", line 271, in <module>
>    main()
>  File "/usr/bin/gensystemid", line 238, in main
>    except rpclib.Fault, f:
> AttributeError: 'module' object has no attribute 'Fault'

I added the line

   sys.path.insert(0, '/usr/share/mrepo/')

above the line

   from up2date_client import config, rpcServer, up2dateErrors

to make sure, gensystemid uses the rpclib from mrepo and not from the spacewalk 
installation.

I am on Centos6 with python-2.6.6 and mrepo-0.8.8 


Regards,
Bernhard

_______________________________________________
Spacewalk-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/spacewalk-list

Reply via email to