Merge "Fix errors preventing novajoin to start on Python 3"
This commit is contained in:
commit
6a1f2e1a87
|
@ -3,6 +3,7 @@ files/join.conf
|
|||
tools/lintstack.head.py
|
||||
*.pyc
|
||||
*.egg-info/
|
||||
.eggs/
|
||||
.tox
|
||||
.testrepository
|
||||
.stestr
|
||||
|
|
|
@ -56,7 +56,7 @@ import nss.nss as nss
|
|||
|
||||
logger = logging.getLogger()
|
||||
|
||||
allowed_chars = string.letters + string.digits
|
||||
allowed_chars = string.ascii_letters + string.digits
|
||||
|
||||
KRB5_CONF_TMPL = """
|
||||
includedir /var/lib/sss/pubconf/krb5.include.d/
|
||||
|
|
|
@ -105,7 +105,7 @@ class IPANovaJoinBase(object):
|
|||
def split_hostname(self, hostname):
|
||||
"""Split a hostname into its host and domain parts"""
|
||||
parts = hostname.split('.')
|
||||
domain = ('.'.join(parts[1:]) + '.').decode('UTF-8')
|
||||
domain = six.text_type('.'.join(parts[1:]) + '.')
|
||||
return (parts[0], domain)
|
||||
|
||||
def get_host_and_realm(self):
|
||||
|
@ -282,7 +282,7 @@ class IPAClient(IPANovaJoinBase):
|
|||
# 'description': 'IPA host for %s' % inst.display_description,
|
||||
hostargs = {
|
||||
'description': u'IPA host for OpenStack',
|
||||
'userpassword': ipaotp.decode('UTF-8'),
|
||||
'userpassword': six.text_type(ipaotp),
|
||||
'force': True # we don't have an ip addr yet so
|
||||
# use force to add anyway
|
||||
}
|
||||
|
@ -295,23 +295,23 @@ class IPAClient(IPANovaJoinBase):
|
|||
hostargs['nshostlocation'] = location
|
||||
|
||||
modargs = {
|
||||
'userpassword': ipaotp.decode('UTF-8'),
|
||||
'userpassword': six.text_type(ipaotp),
|
||||
}
|
||||
|
||||
try:
|
||||
self._call_ipa('host_mod', *params, **modargs)
|
||||
self.host_cache[hostname] = ipaotp.decode('UTF-8')
|
||||
self.host_cache[hostname] = six.text_type(ipaotp)
|
||||
except errors.NotFound:
|
||||
try:
|
||||
self._call_ipa('host_add', *params, **hostargs)
|
||||
self.host_cache[hostname] = ipaotp.decode('UTF-8')
|
||||
self.host_cache[hostname] = six.text_type(ipaotp)
|
||||
except errors.DuplicateEntry:
|
||||
# We have no idea what the OTP is for the existing host.
|
||||
return False
|
||||
except (errors.ValidationError, errors.DNSNotARecordError):
|
||||
# Assumes despite these exceptions the host was created
|
||||
# and the OTP was set.
|
||||
self.host_cache[hostname] = ipaotp.decode('UTF-8')
|
||||
self.host_cache[hostname] = six.text_type(ipaotp)
|
||||
except errors.ValidationError:
|
||||
# Updating the OTP on an enrolled-host is not allowed
|
||||
# in IPA and really a no-op.
|
||||
|
|
|
@ -9,6 +9,7 @@ six>=1.10.0 # MIT
|
|||
python-keystoneclient>=3.8.0 # Apache-2.0
|
||||
keystoneauth1>=3.3.0 # Apache-2.0
|
||||
oslo.concurrency>=3.25.0 # Apache-2.0
|
||||
oslo.config>=6.1.0 # Apache-2.0
|
||||
oslo.messaging>=5.29.0 # Apache-2.0
|
||||
oslo.policy>=1.30.0 # Apache-2.0
|
||||
oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/python
|
||||
#!/usr/bin/env python
|
||||
# Copyright 2016 Red Hat, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
|
@ -79,8 +79,7 @@ def install(opts):
|
|||
os.environ['OS_USERNAME']
|
||||
os.environ['OS_AUTH_URL']
|
||||
except KeyError as e:
|
||||
raise ConfigurationError('%s environment variable not set.'
|
||||
% e.message)
|
||||
raise ConfigurationError('%s environment variable not set.' % e)
|
||||
|
||||
try:
|
||||
pwd.getpwnam(opts.user)
|
||||
|
@ -89,12 +88,13 @@ def install(opts):
|
|||
opts.user)
|
||||
|
||||
api.bootstrap(context='novajoin')
|
||||
api.finalize()
|
||||
|
||||
novajoin = configure_ipa.NovajoinRole(user=opts.user)
|
||||
if not opts.no_kinit:
|
||||
novajoin.kinit(opts.principal, api.env.realm, opts.password)
|
||||
|
||||
api.finalize()
|
||||
|
||||
try:
|
||||
api.Backend.rpcclient.connect()
|
||||
except errors.CCacheError:
|
||||
|
|
|
@ -32,9 +32,6 @@ data_files =
|
|||
/etc/novajoin =
|
||||
files/join-api-paste.ini
|
||||
files/cloud-config-novajoin.json
|
||||
/usr/sbin =
|
||||
scripts/novajoin-install
|
||||
/usr/libexec = scripts/novajoin-ipa-setup
|
||||
/usr/share/man/man1 =
|
||||
man/novajoin-install.1
|
||||
man/novajoin-notify.1
|
||||
|
@ -43,6 +40,10 @@ data_files =
|
|||
packages =
|
||||
novajoin
|
||||
|
||||
scripts =
|
||||
scripts/novajoin-install
|
||||
scripts/novajoin-ipa-setup
|
||||
|
||||
[build_sphinx]
|
||||
source-dir = doc/source
|
||||
build-dir = doc/build
|
||||
|
|
Loading…
Reference in New Issue