On Thu, 2018-01-11 at 18:18 -0700, Rich Megginson wrote:
I keep getting this error:
Traceback (most recent call last):
File "/home/rmeggins/scripts/repltest.py", line 53, in <module>
m1 = tools.DirSrvTools.createInstance(createargs)
File "/home/rmeggins/ds/ds.git/src/lib389/lib389/tools.py", line
627,
in createInstance
cfgdn = lib389.CFGSUFFIX
NameError: global name 'lib389' is not defined
this fixes it (but causes other problems):
--- a/src/lib389/lib389/tools.py
+++ b/src/lib389/lib389/tools.py
@@ -31,6 +31,7 @@ import getpass
# from .nss_ssl import nss_create_new_database
from threading import Timer
+import lib389
from lib389.paths import Paths
_______________________________________________
389-users mailing list -- 389-users(a)lists.fedoraproject.org
To unsubscribe send an email to 389-users-leave(a)lists.fedoraproject.o
rg
Hey mate,
It's probably been a while since you looked at lib389. A lot has
changed!
There are loads of test cases that use this. There are also a few ways
to achieve it.
If you're okay with using a "preconfigured" test instance, then it's as
simple as:
from lib389.topologies import topology_st
def import_example_ldif(topology_st):
# Your instance is at topology_st.standalone
pass
This relies on a pytest environment and makes a single standalone
master.
If you want more manual control you can use the direct .create
arguments after allocate. This is how topology works:
https://pagure.io/389-ds-base/blob/master/f/src/lib389/lib389/topologie
s.py#_71
Finally, if you want manual control *and* to use the "public" api, look
at:
https://pagure.io/389-ds-base/blob/master/f/src/lib389/lib389/tests/ins
tance/setup_test.py
There are some new/better allocate apis coming too that look like:
https://pagure.io/389-ds-base/blob/master/f/src/lib389/lib389/__init__.
py#_412
This will be used in the new ipa-ds integration for install.
It's worth noting that lib389 is part of the main 389-ds-base
package/repo now, so make sure you using it from there.
Hope that helps!
--
Sincerely,
William Brown
Software Engineer
Red Hat, Australia/Brisbane