#49909 Remove Junk from resolving of git cherry-pick conflict
Closed 3 years ago by spichugi. Opened 5 years ago by slev.
slev/389-ds-base fix_cherry_pick  into  389-ds-base-1.3.8

file modified
+14 -30
@@ -8,6 +8,7 @@ 

  

  # Replacement of the dbgen.pl utility

  

+ from lib389.utils import pseudolocalize

  import random

  import os

  import pwd
@@ -95,7 +96,7 @@ 

  carLicense: 21SJJAG

  l: {LOCATION}

  ou: {OU}

- mail: {FIRST}.{LAST}@example.com

+ mail: {UID}@example.com

  postalAddress: 518,  Dept #851, Room#{OU}

  title: {TITLE}

  usercertificate;binary:: MIIBvjCCASegAwIBAgIBAjANBgkqhkiG9w0BAQQFADAnMQ8wDQYD
@@ -113,43 +114,21 @@ 

  DBGEN_HEADER = """dn: {SUFFIX}

  objectClass: top

  objectClass: domain

- <<<<<<< HEAD

- dc: example

- aci: (target=ldap:///{SUFFIX})(targetattr=*)(version 3.0; acl "acl1"; allow(write) userdn = "ldap:///self";) 

- =======

  dc: {RDN}

  aci: (target=ldap:///{SUFFIX})(targetattr=*)(version 3.0; acl "acl1"; allow(write) userdn = "ldap:///self";)

- >>>>>>> 8fa838a4f... Ticket 49830 - Import fails if backend name is "default"

  aci: (target=ldap:///{SUFFIX})(targetattr=*)(version 3.0; acl "acl2"; allow(write) groupdn = "ldap:///cn=Directory Administrators, {SUFFIX}";)

  aci: (target=ldap:///{SUFFIX})(targetattr=*)(version 3.0; acl "acl3"; allow(read, search, compare) userdn = "ldap:///anyone";)

  

- dn: ou=Accounting,{SUFFIX}

- objectClass: top

- objectClass: organizationalUnit

- ou: Accounting

- 

- dn: ou=Product Development,{SUFFIX}

- objectClass: top

- objectClass: organizationalUnit

- ou: Product Development

- 

- dn: ou=Product Testing,{SUFFIX}

- objectClass: top

- objectClass: organizationalUnit

- ou: Product Testing

- 

- dn: ou=Human Resources,{SUFFIX}

- objectClass: top

- objectClass: organizationalUnit

- ou: Human Resources

+ """

  

- dn: ou=Payroll,{SUFFIX}

+ DBGEN_OU_TEMPLATE = """dn: ou={OU},{SUFFIX}

  objectClass: top

  objectClass: organizationalUnit

- ou: Payroll

+ ou: {OU}

  

  """

  

+ 

  def dbgen(instance, number, ldif_file, suffix, pseudol10n=False):

      familyname_file = os.path.join(instance.ds_paths.data_dir, 'dirsrv/data/dbgen-FamilyNames')

      givename_file = os.path.join(instance.ds_paths.data_dir, 'dirsrv/data/dbgen-GivenNames')
@@ -174,9 +153,16 @@ 

              # How do we subscript from a generator?

              initials = "%s. %s" % (first[0], last[0])

              uid = "%s%s%s" % (first[0], last, i)

-             dn = "uid=%s,ou=%s,%s" % (uid, ou, suffix)

              l = random.choice(DBGEN_LOCATIONS)

              title = "%s %s" % (random.choice(DBGEN_TITLE_LEVELS), random.choice(DBGEN_POSITIONS))

+             if pseudol10n:

+                 ou = pseudolocalize(ou)

+                 first = pseudolocalize(first)

+                 last = pseudolocalize(last)

+                 initials = pseudolocalize(initials)

+                 l = pseudolocalize(l)

+                 title = pseudolocalize(title)

+             dn = "uid=%s,ou=%s,%s" % (uid, ou, suffix)

              output.write(DBGEN_TEMPLATE.format(

                  DN=dn,

                  UID=uid,
@@ -196,5 +182,3 @@ 

          uid = pwd.getpwnam(instance.userid).pw_uid

          gid = grp.getgrnam(instance.userid).gr_gid

          os.chown(ldif_file, uid, gid)

- 

- 

file modified
+110
@@ -32,6 +32,7 @@ 

  import time

  import sys

  import filecmp

+ import six

We are using python3 now, so is this still necessary?

  from socket import getfqdn

  from ldapurl import LDAPUrl

  from contextlib import closing
@@ -75,6 +76,105 @@ 

                 '(&(objectclass=glue)(objectclass=extensibleobject))', ['dn'])

  }

  

+ # Map table for pseudolocalized strings

+ _chars = {

+     " ": six.u("\u2003"),

+     "!": six.u("\u00a1"),

+     "\"": six.u("\u2033"),

+     "#": six.u("\u266f"),

+     "$": six.u("\u20ac"),

+     "%": six.u("\u2030"),

+     "&": six.u("\u214b"),

+     "'": six.u("\u00b4"),

+     ")": six.u("}"),

+     "(": six.u("{"),

+     "*": six.u("\u204e"),

+     "+": six.u("\u207a"),

+     ",": six.u("\u060c"),

+     "-": six.u("\u2010"),

+     ".": six.u("\u00b7"),

+     "/": six.u("\u2044"),

+     "0": six.u("\u24ea"),

+     "1": six.u("\u2460"),

+     "2": six.u("\u2461"),

+     "3": six.u("\u2462"),

+     "4": six.u("\u2463"),

+     "5": six.u("\u2464"),

+     "6": six.u("\u2465"),

+     "7": six.u("\u2466"),

+     "8": six.u("\u2467"),

+     "9": six.u("\u2468"),

+     ":": six.u("\u2236"),

+     ";": six.u("\u204f"),

+     "<": six.u("\u2264"),

+     "=": six.u("\u2242"),

+     ">": six.u("\u2265"),

+     "?": six.u("\u00bf"),

+     "@": six.u("\u055e"),

+     "A": six.u("\u00c5"),

+     "B": six.u("\u0181"),

+     "C": six.u("\u00c7"),

+     "D": six.u("\u00d0"),

+     "E": six.u("\u00c9"),

+     "F": six.u("\u0191"),

+     "G": six.u("\u011c"),

+     "H": six.u("\u0124"),

+     "I": six.u("\u00ce"),

+     "J": six.u("\u0134"),

+     "K": six.u("\u0136"),

+     "L": six.u("\u013b"),

+     "M": six.u("\u1e40"),

+     "N": six.u("\u00d1"),

+     "O": six.u("\u00d6"),

+     "P": six.u("\u00de"),

+     "Q": six.u("\u01ea"),

+     "R": six.u("\u0154"),

+     "S": six.u("\u0160"),

+     "T": six.u("\u0162"),

+     "U": six.u("\u00db"),

+     "V": six.u("\u1e7c"),

+     "W": six.u("\u0174"),

+     "X": six.u("\u1e8a"),

+     "Y": six.u("\u00dd"),

+     "Z": six.u("\u017d"),

+     "[": six.u("\u2045"),

+     "\\": six.u("\u2216"),

+     "]": six.u("\u2046"),

+     "^": six.u("\u02c4"),

+     "_": six.u("\u203f"),

+     "`": six.u("\u2035"),

+     "a": six.u("\u00e5"),

+     "b": six.u("\u0180"),

+     "c": six.u("\u00e7"),

+     "d": six.u("\u00f0"),

+     "e": six.u("\u00e9"),

+     "f": six.u("\u0192"),

+     "g": six.u("\u011d"),

+     "h": six.u("\u0125"),

+     "i": six.u("\u00ee"),

+     "j": six.u("\u0135"),

+     "k": six.u("\u0137"),

+     "l": six.u("\u013c"),

+     "m": six.u("\u0271"),

+     "n": six.u("\u00f1"),

+     "o": six.u("\u00f6"),

+     "p": six.u("\u00fe"),

+     "q": six.u("\u01eb"),

+     "r": six.u("\u0155"),

+     "s": six.u("\u0161"),

+     "t": six.u("\u0163"),

+     "u": six.u("\u00fb"),

+     "v": six.u("\u1e7d"),

+     "w": six.u("\u0175"),

+     "x": six.u("\u1e8b"),

+     "y": six.u("\u00fd"),

+     "z": six.u("\u017e"),

+     "{": six.u("("),

+     "}": six.u(")"),

+     "|": six.u("\u00a6"),

+     "~": six.u("\u02de"),

+ }

+ 

  #

  # Utilities

  #
@@ -871,3 +971,13 @@ 

          else:

              retdict[k] = ensure_str(val[k])

      return retdict

+ 

+ 

+ def pseudolocalize(string):

+     pseudo_string = six.u("")

+     for char in string:

+         try:

+             pseudo_string += _chars[char]

+         except KeyError:

+             pseudo_string += char

+     return pseudo_string

Easy fix for https://pagure.io/389-ds-base/issue/49908.
Just revert incorrect cherry, and then cherry-pick 2 commits.

Tests are OK:

 py.test3 /usr/lib/python3/site-packages/dirsrvtests/tests/suites/basic/
===================================== test session starts =====================================platform linux -- Python 3.6.5, pytest-3.4.2, py-1.5.3, pluggy-0.6.0
rootdir: /usr/lib/python3/site-packages/dirsrvtests/tests/suites/basic, inifile:
collected 23 items

../usr/lib/python3/site-packages/dirsrvtests/tests/suites/basic/basic_test.py ......... [ 39%]
..............                                                                          [100%]

================================= 23 passed in 157.33 seconds =================================

@mreynolds What happened here :|

Anyway, the change looks reasonable to me, but I want input from someone who is familiar with why this got into the repo in the first place.

Thanks @slev

@mreynolds What happened here :|

Yeah somehow I missed this when I cherry-picked https://pagure.io/389-ds-base/pull-request/49831 to 1.3.8

My bad :'-(

We are using python3 now, so is this still necessary?

Probably not. Remove and see what screams?

We are using python3 now, so is this still necessary?

As I see the problem is still here ( 389-ds-base-1.3.8 branch ).
Is it a problem to fix it instead of leaving as is?

We are using python3 now, so is this still necessary?

As I see the problem is still here ( 389-ds-base-1.3.8 branch ).
Is it a problem to fix it instead of leaving as is?

Oh right, yeah 1.3.8 still has this issue. 1.4.0 is now using python3.

Two issues I see: one this needs to goto master branch as well (without all the python-six stuff), and I want @firstyear to confirm if he's okay with changing the mail attribute value from "first.lastname@mail.com" to "uid@mail.com"

Sorry I only just saw this: I have no issue with that change, it's just a dbgen test. :)

Looks good to me too. @slev could you please rebase it? We'll test it once again and we can merge

we may need to rebase and test ourselves, it has been a while and @slev may have moved on or be busy :)

rebased onto c787b13

5 years ago

Hi, I rebased to upstream/389-ds-base-1.3.8

Thank you @slev, this looks good to me. @spichugi I'll let you check, but please merge asap to prevent any more rebasing needed.

Pull-Request has been merged by mreynolds

5 years ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This pull request has been cloned to Github as issue and is available here:
- https://github.com/389ds/389-ds-base/issues/2968

If you want to continue to work on the PR, please navigate to the github issue,
download the patch from the attachments and file a new pull request.

Thank you for understanding. We apologize for all inconvenience.

Pull-Request has been closed by spichugi

3 years ago