Re: How to use lib389 to create an instance?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxxxxxx
> To unsubscribe send an email to 389-users-leave@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
_______________________________________________
389-users mailing list -- 389-users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to 389-users-leave@xxxxxxxxxxxxxxxxxxxxxxx




[Index of Archives]     [Fedora User Discussion]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora News]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora QA]     [Fedora Triage]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Yosemite Photos]     [Linux Apps]     [Maemo Users]     [Gnome Users]     [KDE Users]     [Fedora Tools]     [Fedora Art]     [Fedora Docs]     [Maemo Users]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Fedora ARM]

  Powered by Linux