Bug 1379891 - Installing rhn-virtualization-host on Fedora 23+ clients breaks rhn-profile-sync
Summary: Installing rhn-virtualization-host on Fedora 23+ clients breaks rhn-profile-sync
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Spacewalk
Classification: Community
Component: Clients
Version: 2.5
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
Assignee: Gennadii Altukhov
QA Contact: Radovan Drazny
URL:
Whiteboard:
Depends On:
Blocks: spacewalk-review 1395893 space27
TreeView+ depends on / blocked
 
Reported: 2016-09-28 01:59 UTC by Brian Harrington
Modified: 2017-09-27 19:22 UTC (History)
4 users (show)

Fixed In Version: 5.4.56-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1395893 (view as bug list)
Environment:
Last Closed: 2017-09-27 19:22:21 UTC
Embargoed:


Attachments (Terms of Use)

Description Brian Harrington 2016-09-28 01:59:39 UTC
Description of problem:
Much of the python in the rhn-virtualization-common and rhn-virtualization-host packages is still of the era of python2.

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

How reproducible:
100%

Steps to Reproduce:
1. install Fedora 23 or 24
2. Add the corresponding spacewalk-client repos
3. install rhn-virtualization-common and rhn-virtualization-host
4. run rhn-profile-sync

Actual results:

[root@provisioner rhn]# rhn-profile-sync
Traceback (most recent call last):
  File "/usr/sbin/rhn-profile-sync", line 29, in <module>
    from virtualization import support
  File "/usr/share/rhn/virtualization/support.py", line 230
    print _retrieve_virtual_domain_list()
                                      ^


Expected results:
[root@provisioner rhn]# rhn-profile-sync 
Updating package profile...
Updating hardware profile...


Additional info:
While not great, using 2to3 solves the outright breakage of the functions but does not resolve the propagation of VM information:

2to3 -w  /usr/share/rhn/virtualization/support.py
2to3 -w  /usr/share/rhn/virtualization/domain_control.py
2to3 -w  /usr/share/rhn/virtualization/poller.py
2to3 -w  /usr/share/rhn/virtualization/notification.py
2to3 -w  /usr/share/rhn/virtualization/poller_state_cache.py
2to3 -w  /usr/share/rhn/virtualization/domain_directory.py
2to3 -w  /usr/share/rhn/virtualization/domain_config.py
2to3 -w  /usr/share/rhn/virtualization/start_domain.py

Comment 1 Grant Gainey 2016-10-14 17:21:38 UTC
Ugh - nice catch. 

To (continue) working around the problem, you will also need to:

# sudo dnf install libvirt-python3
# sudo 2to3 -w /usr/share/rhn/virtualization/schedule_poller.py

and make the following changes (in addition to the effects of 2to3):

# diff ORIG/domain_config.py /usr/share/rhn/virtualization/domain_config.py
17d16
< import string
67c66
<         if string.find(uuid, ".xml") > 1 and os.path.exists(uuid):
---
>         if uuid.decode('utf-8').find(".xml") > 1 and os.path.exists(uuid):
250c245
<                     (string.join(tag_path, '/'), self.__file_name)), None, sys.exc_info()[2]
---
>                     (tag_path.join('/'), self.__file_name)).with_traceback(sys.exc_info()[2])



# diff ORIG/domain_directory.py /usr/share/rhn/virtualization/domain_directory.py
214c212
<         cfg_file.write(string.strip(xml))
---
>         cfg_file.write(xml.strip())


# diff ORIG/util.py /usr/share/rhn/virtualization/util.py
45c45
<     return uuid.replace('-', '')
---
>     return uuid.decode('utf-8').replace('-', '')


# diff ORIG/schedule_poller.py /usr/share/rhn/virtualization/schedule_poller.py
18d17
< import string
41,50c40,49
<     if type(minute) != types.StringType:
<         minute = string.strip(str(minute))
<     if type(hour) != types.StringType:
<         hour = string.strip(str(hour))
<     if type(dom) != types.StringType:
<         dom = string.strip(str(dom))
<     if type(month) != types.StringType:
<         month = string.strip(str(month))
<     if type(dow) != types.StringType:
<         dow = string.strip(str(dow))
---
>     if type(minute) != bytes:
>         minute = str(minute).strip()
>     if type(hour) != bytes:
>         hour = str(hour).strip()
>     if type(dom) != bytes:
>         dom = str(dom).strip()
>     if type(month) != bytes:
>         month = str(month).strip()
>     if type(dow) != bytes:
>         dow = str(dow).strip()


With these changes, I was able to get my F23 host registered correctly. If/as you notice any issues, log them here.

Comment 2 Gennadii Altukhov 2016-10-19 11:57:54 UTC
fixed in spacewalk.git:
621f4d1f5a174f2b0df54adbeb2cc96741e01e1a

Switching to modified...

Comment 3 Radovan Drazny 2016-11-11 12:29:13 UTC
Reproduced on rhn-virtualization-{common,host}-5.4.55-1 using the reproducer from initial report with the same result:

# rhn-profile-sync
Traceback (most recent call last):
  File "/usr/sbin/rhn-profile-sync", line 29, in <module>
    from virtualization import support
  File "/usr/share/rhn/virtualization/support.py", line 230
    print _retrieve_virtual_domain_list()
                                      ^
SyntaxError: invalid syntax

After update to rhn-virtualization-common-5.4.56-1:

# rhn-profile-sync
Updating package profile...
Updating hardware profile...

No errors in /var/log/up2date, and the system has Virtualization tab in the SW WebUI.

VERIFIED

Comment 4 Eric Herget 2017-09-27 19:22:21 UTC
This looks like it was fixed in previous release, but I'm closing it in this one.

Spacewalk 2.7 has been released.

https://github.com/spacewalkproject/spacewalk/wiki/ReleaseNotes27


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