Skip to content

Commit

Permalink
Fixes: Python SyntaxWarnings about invalid escape sequences
Browse files Browse the repository at this point in the history
Otherwise we get some SyntaxWarnings about invalid escape sequences
such as '\d' and '\{', e.g.:
  /usr/sbin/ipa-replica-manage:393: SyntaxWarning: invalid escape sequence '\{'
    data = re.match('\{replica (\d+) (ldap://.*:\d+)\}(\s+\w+\s+\w*){0,1}', ruv)
  /usr/sbin/ipa-replica-manage:721: SyntaxWarning: invalid escape sequence '\d'
    (re.sub(':\d+', '', x), y)
  /usr/sbin/ipa-replica-manage:726: SyntaxWarning: invalid escape sequence '\d'
    (re.sub(':\d+', '', x), y)

Fixes: https://pagure.io/freeipa/issue/9483

Signed-off-by: Jeremy Frasier <jeremy.frasier@gwe.cisa.dhs.gov>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
  • Loading branch information
jsf9k authored and rcritten committed Nov 16, 2023
1 parent 07e5637 commit c63fe92
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions install/tools/ipa-replica-manage.in
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,10 @@ def get_ruv(realm, host, dirman_passwd, nolookup=False, ca=False):
for ruv in e['nsds50ruv']:
if ruv.startswith('{replicageneration'):
continue
data = re.match('\{replica (\d+) (ldap://.*:\d+)\}(\s+\w+\s+\w*){0,1}', ruv)
data = re.match(
r'\{replica (\d+) (ldap://.*:\d+)\}(\s+\w+\s+\w*){0,1}',
ruv
)
if data:
rid = data.group(1)
(
Expand Down Expand Up @@ -718,12 +721,12 @@ def clean_dangling_ruvs(realm, host, options):
# This needs needs to be split off
if ruv_dict.get('domain'):
master_info['ruvs'] = {
(re.sub(':\d+', '', x), y)
(re.sub(r':\d+', '', x), y)
for (x, y) in ruv_dict['domain']
}
if ruv_dict.get('ca'):
master_info['csruvs'] = {
(re.sub(':\d+', '', x), y)
(re.sub(r':\d+', '', x), y)
for (x, y) in ruv_dict['ca']
}
except Exception as e:
Expand Down

0 comments on commit c63fe92

Please sign in to comment.