diff options
author | Petr Viktorin <pviktori@redhat.com> | 2016-05-06 17:54:10 +0200 |
---|---|---|
committer | Martin Basti <mbasti@redhat.com> | 2016-05-30 16:44:08 +0200 |
commit | 743828b0f47ca4934125cfb8dc57f79283b95a4d (patch) | |
tree | bf27a357b0d9453a52d2534b66d85964b1f13fc7 /ipaplatform | |
parent | 9ca450ac436344afd3a46d9852d8329a2e9a48d2 (diff) | |
download | freeipa-743828b0f47ca4934125cfb8dc57f79283b95a4d.tar.gz freeipa-743828b0f47ca4934125cfb8dc57f79283b95a4d.tar.xz freeipa-743828b0f47ca4934125cfb8dc57f79283b95a4d.zip |
ipaplatform.redhat: Use bytestrings when calling rpm.so for version comparison
Part of the work for: https://fedorahosted.org/freeipa/ticket/4985
Reviewed-By: Martin Basti <mbasti@redhat.com>
Diffstat (limited to 'ipaplatform')
-rw-r--r-- | ipaplatform/redhat/tasks.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ipaplatform/redhat/tasks.py b/ipaplatform/redhat/tasks.py index ace29bd1c..294a9fe1a 100644 --- a/ipaplatform/redhat/tasks.py +++ b/ipaplatform/redhat/tasks.py @@ -84,13 +84,17 @@ class IPAVersion(object): def __init__(self, version): self.version = version + @property + def _bytes(self): + return self.version.encode('utf-8') + def __eq__(self, other): assert isinstance(other, IPAVersion) - return _librpm.rpmvercmp(self.version, other.version) == 0 + return _librpm.rpmvercmp(self._bytes, other._bytes) == 0 def __lt__(self, other): assert isinstance(other, IPAVersion) - return _librpm.rpmvercmp(self.version, other.version) < 0 + return _librpm.rpmvercmp(self._bytes, other._bytes) < 0 class RedHatTaskNamespace(BaseTaskNamespace): |