mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
ipatests: interactive install prompts for netbios name
The interactive server installation now prompts for netbios name confirmation. Add expected prompt and send response to the installer. Related: https://pagure.io/freeipa/issue/8995 Signed-off-by: Florence Blanc-Renaud <flo@redhat.com> Reviewed-By: Christian Heimes <cheimes@redhat.com> Reviewed-By: Rob Crittenden <rcritten@redhat.com> Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
@@ -23,6 +23,7 @@ All constants centralised in one file.
|
||||
"""
|
||||
|
||||
import os
|
||||
import string
|
||||
|
||||
from ipaplatform.constants import constants as _constants
|
||||
from ipapython.dn import DN
|
||||
@@ -368,3 +369,5 @@ KRA_TRACKING_REQS = {
|
||||
'transportCert cert-pki-kra': 'caTransportCert',
|
||||
'storageCert cert-pki-kra': 'caStorageCert',
|
||||
}
|
||||
|
||||
ALLOWED_NETBIOS_CHARS = string.ascii_uppercase + string.digits + '-'
|
||||
|
||||
@@ -25,7 +25,6 @@ import errno
|
||||
import ldap
|
||||
import tempfile
|
||||
import uuid
|
||||
import string
|
||||
import struct
|
||||
import re
|
||||
import socket
|
||||
@@ -36,7 +35,8 @@ from ipaserver.install import service
|
||||
from ipaserver.install import installutils
|
||||
from ipaserver.install.replication import wait_for_task
|
||||
from ipalib import errors, api
|
||||
from ipalib.constants import SUBID_RANGE_START
|
||||
from ipalib.constants import SUBID_RANGE_START, ALLOWED_NETBIOS_CHARS
|
||||
|
||||
from ipalib.util import normalize_zone
|
||||
from ipapython.dn import DN
|
||||
from ipapython import ipachangeconf
|
||||
@@ -54,8 +54,6 @@ if six.PY3:
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
ALLOWED_NETBIOS_CHARS = string.ascii_uppercase + string.digits + '-'
|
||||
|
||||
UPGRADE_ERROR = """
|
||||
Entry %(dn)s does not exist.
|
||||
This means upgrade from IPA 2.x to 3.x did not went well and required S4U2Proxy
|
||||
|
||||
@@ -60,6 +60,7 @@ def get_install_stdin(cert_passwords=()):
|
||||
'', # Server host name (has default)
|
||||
]
|
||||
lines.extend(cert_passwords) # Enter foo.p12 unlock password
|
||||
lines.extend('IPA') # NetBios name
|
||||
lines += [
|
||||
'no', # configure chrony with NTP server or pool address?
|
||||
'yes', # Continue with these values?
|
||||
|
||||
@@ -22,6 +22,7 @@ from cryptography import x509 as crypto_x509
|
||||
from ipalib import x509
|
||||
from ipalib.constants import DOMAIN_LEVEL_0, KRA_TRACKING_REQS
|
||||
from ipalib.constants import IPA_CA_RECORD
|
||||
from ipalib.constants import ALLOWED_NETBIOS_CHARS
|
||||
from ipalib.sysrestore import SYSRESTORE_STATEFILE, SYSRESTORE_INDEXFILE
|
||||
from ipapython.dn import DN
|
||||
from ipaplatform.constants import constants
|
||||
@@ -69,6 +70,17 @@ def server_cleanup(request):
|
||||
tasks.uninstall_master(host)
|
||||
|
||||
|
||||
def create_netbios_name(host):
|
||||
"""
|
||||
Create a NetBIOS name based on the provided host
|
||||
"""
|
||||
netbios = ''.join(
|
||||
c for c in host.domain.name.split('.')[0].upper() \
|
||||
if c in ALLOWED_NETBIOS_CHARS
|
||||
)[:15]
|
||||
return netbios
|
||||
|
||||
|
||||
class InstallTestBase1(IntegrationTest):
|
||||
|
||||
num_replicas = 3
|
||||
@@ -1171,6 +1183,8 @@ class TestInstallMaster(IntegrationTest):
|
||||
hosts = self.master.get_file_contents(paths.HOSTS, encoding='utf-8')
|
||||
new_hosts = hosts.replace(original_hostname, new_hostname)
|
||||
self.master.put_file_contents(paths.HOSTS, new_hosts)
|
||||
netbios = create_netbios_name(self.master)
|
||||
|
||||
try:
|
||||
cmd = ['ipa-server-install', '--hostname', new_hostname]
|
||||
with self.master.spawn_expect(cmd) as e:
|
||||
@@ -1193,6 +1207,8 @@ class TestInstallMaster(IntegrationTest):
|
||||
e.sendline(self.master.config.admin_password)
|
||||
e.expect_exact('Password (confirm): ')
|
||||
e.sendline(self.master.config.admin_password)
|
||||
e.expect_exact('NetBIOS domain name [{}]: '.format(netbios))
|
||||
e.sendline(netbios)
|
||||
e.expect_exact('Do you want to configure chrony with '
|
||||
'NTP server or pool address? [no]: ')
|
||||
e.sendline('no')
|
||||
@@ -1367,6 +1383,7 @@ class TestInstallMasterDNS(IntegrationTest):
|
||||
https://pagure.io/freeipa/issue/2575
|
||||
"""
|
||||
cmd = ['ipa-server-install']
|
||||
netbios = create_netbios_name(self.master)
|
||||
with self.master.spawn_expect(cmd) as e:
|
||||
e.expect_exact('Do you want to configure integrated '
|
||||
'DNS (BIND)? [no]: ')
|
||||
@@ -1398,6 +1415,8 @@ class TestInstallMasterDNS(IntegrationTest):
|
||||
e.expect_exact('Do you want to search for missing reverse '
|
||||
'zones? [yes]: ')
|
||||
e.sendline('no') # irrelevant for this test
|
||||
e.expect_exact('NetBIOS domain name [{}]: '.format(netbios))
|
||||
e.sendline(netbios)
|
||||
e.expect_exact('Do you want to configure chrony with NTP '
|
||||
'server or pool address? [no]: ')
|
||||
e.sendline('no') # irrelevant for this test
|
||||
|
||||
@@ -260,6 +260,8 @@ class TestNTPoptions(IntegrationTest):
|
||||
"No\n"
|
||||
# Server host name [hostname]:
|
||||
"\n"
|
||||
# Enter the NetBIOS name for the IPA domain
|
||||
"IPA\n"
|
||||
# Do you want to configure chrony with NTP server
|
||||
# or pool address? [no]:
|
||||
"Yes\n"
|
||||
@@ -372,6 +374,7 @@ class TestNTPoptions(IntegrationTest):
|
||||
server_input = (
|
||||
"\n" +
|
||||
"\n"
|
||||
"IPA\n"
|
||||
"No\n"
|
||||
"Yes"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user