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