Removing decode(UTF-8) to make python compatible

Now that python3 it's already UTF-8 compatible, there is no
need to decode from UTF-8 anymore. We just need to use
six.text_type() instead.

Change-Id: Ica16721ca43300bc51b292591a3cfa602944df3d
This commit is contained in:
Raildo Mascena 2019-07-15 10:05:22 -03:00
parent 35d07534e0
commit 424b981b30
1 changed files with 7 additions and 6 deletions

View File

@ -14,6 +14,7 @@
# under the License. # under the License.
import os import os
import six
import time import time
import uuid import uuid
try: try:
@ -163,25 +164,25 @@ class IPABase(object):
class IPAClient(IPABase): class IPAClient(IPABase):
def find_host(self, hostname): def find_host(self, hostname):
params = [hostname.decode('UTF-8')] params = [six.text_type(hostname)]
return self._call_ipa('host_find', *params) return self._call_ipa('host_find', *params)
def show_host(self, hostname): def show_host(self, hostname):
params = [hostname.decode('UTF-8')] params = [six.text_type(hostname)]
return self._call_ipa('host_show', *params) return self._call_ipa('host_show', *params)
def find_service(self, service_principal): def find_service(self, service_principal):
params = [service_principal.decode('UTF-8')] params = [six.text_type(service_principal)]
service_args = {} service_args = {}
return self._call_ipa('service_find', *params, **service_args) return self._call_ipa('service_find', *params, **service_args)
def show_service(self, service_principal): def show_service(self, service_principal):
params = [service_principal.decode('UTF-8')] params = [six.text_type(service_principal)]
service_args = {} service_args = {}
return self._call_ipa('service_show', *params, **service_args) return self._call_ipa('service_show', *params, **service_args)
def get_service_cert(self, service_principal): def get_service_cert(self, service_principal):
params = [service_principal.decode('UTF-8')] params = [six.text_type(service_principal)]
service_args = {} service_args = {}
result = self._call_ipa('service_find', *params, **service_args) result = self._call_ipa('service_find', *params, **service_args)
serviceresult = result['result'][0] serviceresult = result['result'][0]
@ -192,7 +193,7 @@ class IPAClient(IPABase):
def service_managed_by_host(self, service_principal, host): def service_managed_by_host(self, service_principal, host):
"""Return True if service is managed by specified host""" """Return True if service is managed by specified host"""
params = [service_principal.decode('UTF-8')] params = [six.text_type(service_principal)]
service_args = {} service_args = {}
try: try:
result = self._call_ipa('service_show', *params, **service_args) result = self._call_ipa('service_show', *params, **service_args)