Py3: Replace six.text_type with str

On Python 3, six.text_type (singular) is an alias for str.

See: https://pagure.io/freeipa/issue/7715
Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
This commit is contained in:
Christian Heimes
2018-09-26 12:39:56 +02:00
parent ea396528b7
commit 61156b0a50
15 changed files with 25 additions and 31 deletions

View File

@@ -173,12 +173,12 @@ def _acl_make_request(principal_type, principal, ca_id, profile_id):
groups = []
if principal_type == 'user':
user_obj = api.Command.user_show(
six.text_type(principal.username))['result']
str(principal.username))['result']
groups = user_obj.get('memberof_group', [])
groups += user_obj.get('memberofindirect_group', [])
elif principal_type == 'host':
host_obj = api.Command.host_show(
six.text_type(principal.hostname))['result']
str(principal.hostname))['result']
groups = host_obj.get('memberof_hostgroup', [])
groups += host_obj.get('memberofindirect_hostgroup', [])
req.user.groups = sorted(set(groups))
@@ -957,7 +957,7 @@ class cert_request(Create, BaseCertMethod, VirtualCommand):
if add:
if principal.is_service and not principal.is_host:
self.api.Command.service_add(
six.text_type(principal), all=True, force=True)
str(principal), all=True, force=True)
return self.lookup_principal(principal) # we want an LDAPEntry
else:
if principal.is_user:

View File

@@ -2165,7 +2165,7 @@ class DNSZoneBase_add(LDAPCreate):
try:
check_zone_overlap(keys[-1], raise_on_error=False)
except ValueError as e:
raise errors.InvocationError(six.text_type(e))
raise errors.InvocationError(str(e))
return dn

View File

@@ -546,7 +546,7 @@ class service(LDAPObject):
def get_dn(self, *keys, **kwargs):
key = keys[0]
if isinstance(key, six.text_type):
if isinstance(key, str):
key = kerberos.Principal(key)
key = unicode(normalize_principal(key))