Skip to content

Commit d895c98

Browse files
jsutton24abartlet
authored andcommitted
wintest: Fix invalid escape sequences
Signed-off-by: Joseph Sutton <[email protected]> Reviewed-by: Andrew Bartlett <[email protected]> Autobuild-User(master): Andrew Bartlett <[email protected]> Autobuild-Date(master): Fri Oct 13 04:55:06 UTC 2023 on atb-devel-224
1 parent 3f70da6 commit d895c98

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

wintest/test-s4-howto.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def run_dcpromo(t, vm):
160160
t.info("Joining a windows VM ${WIN_VM} to the domain as a DC using dcpromo")
161161
child = t.open_telnet("${WIN_HOSTNAME}", "administrator", "${WIN_PASS}", set_ip=True, set_noexpire=True)
162162
child.sendline("copy /Y con answers.txt")
163-
child.sendline(b'''
163+
child.sendline(br'''
164164
[DCINSTALL]
165165
RebootOnSuccess=Yes
166166
RebootOnCompletion=Yes
@@ -171,7 +171,7 @@ def run_dcpromo(t, vm):
171171
ConfirmGc=Yes
172172
CreateDNSDelegation=No
173173
UserDomain=${LCREALM}
174-
UserName=${LCREALM}\\administrator
174+
UserName=${LCREALM}\administrator
175175
Password=${PASSWORD1}
176176
DatabasePath="C:\Windows\NTDS"
177177
LogPath="C:\Windows\NTDS"
@@ -187,7 +187,7 @@ def run_dcpromo(t, vm):
187187
if i == 1 or i == 2:
188188
child.sendline("echo off")
189189
child.sendline("echo START DCPROMO log")
190-
child.sendline("more c:\windows\debug\dcpromoui.log")
190+
child.sendline(r"more c:\windows\debug\dcpromoui.log")
191191
child.sendline("echo END DCPROMO log")
192192
child.expect("END DCPROMO")
193193
raise Exception("dcpromo failed")
@@ -315,7 +315,7 @@ def run_dcpromo_rodc(t, vm):
315315
t.vm_restore("${WIN_VM}", "${WIN_SNAPSHOT}")
316316
child = t.open_telnet("${WIN_HOSTNAME}", "administrator", "${WIN_PASS}", set_ip=True)
317317
child.sendline("copy /Y con answers.txt")
318-
child.sendline(b'''
318+
child.sendline(br'''
319319
[DCInstall]
320320
ReplicaOrNewDomain=ReadOnlyReplica
321321
ReplicaDomainDNSName=${LCREALM}
@@ -325,13 +325,13 @@ def run_dcpromo_rodc(t, vm):
325325
PasswordReplicationDenied="BUILTIN\Account Operators"
326326
PasswordReplicationDenied="${DOMAIN}\Denied RODC Password Replication Group"
327327
PasswordReplicationAllowed="${DOMAIN}\Allowed RODC Password Replication Group"
328-
DelegatedAdmin="${DOMAIN}\\Administrator"
328+
DelegatedAdmin="${DOMAIN}\Administrator"
329329
SiteName=Default-First-Site-Name
330330
InstallDNS=No
331331
ConfirmGc=Yes
332332
CreateDNSDelegation=No
333333
UserDomain=${LCREALM}
334-
UserName=${LCREALM}\\administrator
334+
UserName=${LCREALM}\administrator
335335
Password=${PASSWORD1}
336336
DatabasePath="C:\Windows\NTDS"
337337
LogPath="C:\Windows\NTDS"
@@ -346,7 +346,7 @@ def run_dcpromo_rodc(t, vm):
346346
if i != 0:
347347
child.sendline("echo off")
348348
child.sendline("echo START DCPROMO log")
349-
child.sendline("more c:\windows\debug\dcpromoui.log")
349+
child.sendline(r"more c:\windows\debug\dcpromoui.log")
350350
child.sendline("echo END DCPROMO log")
351351
child.expect("END DCPROMO")
352352
raise Exception("dcpromo failed")

wintest/wintest.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ def get_nameserver(self):
295295
if i == 0:
296296
child.expect('your original resolv.conf')
297297
child.expect('nameserver')
298-
child.expect('\d+.\d+.\d+.\d+')
298+
child.expect(r'\d+.\d+.\d+.\d+')
299299
return child.after
300300

301301
def rndc_cmd(self, cmd, checkfail=True):
@@ -554,16 +554,16 @@ def get_ipconfig(self, child):
554554
'''get the IP configuration of the child'''
555555
child.sendline("ipconfig /all")
556556
child.expect('Ethernet adapter ')
557-
child.expect("[\w\s]+")
557+
child.expect(r"[\w\s]+")
558558
self.setvar("WIN_NIC", child.after)
559559
child.expect(['IPv4 Address', 'IP Address'])
560-
child.expect('\d+.\d+.\d+.\d+')
560+
child.expect(r'\d+.\d+.\d+.\d+')
561561
self.setvar('WIN_IPV4_ADDRESS', child.after)
562562
child.expect('Subnet Mask')
563-
child.expect('\d+.\d+.\d+.\d+')
563+
child.expect(r'\d+.\d+.\d+.\d+')
564564
self.setvar('WIN_SUBNET_MASK', child.after)
565565
child.expect('Default Gateway')
566-
i = child.expect(['\d+.\d+.\d+.\d+', "C:"])
566+
i = child.expect([r'\d+.\d+.\d+.\d+', "C:"])
567567
if i == 0:
568568
self.setvar('WIN_DEFAULT_GATEWAY', child.after)
569569
child.expect("C:")
@@ -581,7 +581,7 @@ def get_is_dc(self, child):
581581
child.expect("C:")
582582
child.sendline("net config Workstation")
583583
child.expect("Workstation domain")
584-
child.expect('[\S]+')
584+
child.expect(r'[\S]+')
585585
domain = child.after
586586
i = child.expect(["Workstation Domain DNS Name", "Logon domain"])
587587
'''If we get the Logon domain first, we are not in an AD domain'''
@@ -590,7 +590,7 @@ def get_is_dc(self, child):
590590
if domain.upper() == self.getvar("WIN_DOMAIN").upper():
591591
return True
592592

593-
child.expect('[\S]+')
593+
child.expect(r'[\S]+')
594594
hostname = child.after
595595
if hostname.upper() == self.getvar("WIN_HOSTNAME").upper():
596596
return True
@@ -659,7 +659,7 @@ def resolve_ip(self, hostname, retries=60, delay=5):
659659
child = self.pexpect_spawn("bin/nmblookup %s" % hostname)
660660
i = 0
661661
while i == 0:
662-
i = child.expect(["querying", '\d+.\d+.\d+.\d+', hostname, "Lookup failed"])
662+
i = child.expect(["querying", r'\d+.\d+.\d+.\d+', hostname, "Lookup failed"])
663663
if i == 0:
664664
child.expect("\r")
665665
if i == 1:
@@ -833,7 +833,7 @@ def run_dcpromo_as_first_dc(self, vm, func_level=None):
833833

834834
"""This server must therefore not yet be a directory server, so we must promote it"""
835835
child.sendline("copy /Y con answers.txt")
836-
child.sendline(b'''
836+
child.sendline(br'''
837837
[DCInstall]
838838
; New forest promotion
839839
ReplicaOrNewDomain=Domain

0 commit comments

Comments
 (0)