V Fri, 22 Mar 2019 12:46:39 +1000
William Brown <[email protected]> napsáno:

> Hi,
> 
> I’ve been working on the yast-auth-server module recently in an attempt to 
> update it to work with newer versions of 389 Directory Server
> 
> At this point I’m a bit stuck, and would like some advice.
> 
> The first thing is that when running “rake run” from the directory, 
> src/clients/krb-server.rb is always run first. What’s the right way to 
> rake-run which can select to run src/clients/ldap-server.rb

Hi Wiliam,
for running specific client use `rake run[ldap-server]` it is how you can in 
rake pass params and we accept one param for run and it is name of client. 
Otherwise it use the first it find.

> 
> The other thing is that there seems to be an error occuring (very very 
> silently) between:
> 
> 
> https://github.com/Firstyear/yast-auth-server/blob/2019-03-19-update-ds-create/src/lib/authserver/ui/new_dir_inst.rb#L102
> 
> In .y2log I can see the package management section complete, but then at 
> gen_setup_ini/exec_setup, the entire process is silently failing and 
> returning to the menu. No log or error is provided, no popup appears, and 
> there is no trace or artefact of an error.

That is quite strange. It probably need more logging to see where exactly it 
failed. One tip is also to use `Y2DEBUG=1 rake run[ldap-server]` which will 
enable additional logging.

> 
> I really feel a bit lost here, so how would I debug this further to diagnose 
> the error?
> 
> As a follow up point, this module appears to attempt to create it’s own log 
> as can be seen:
> 
> https://github.com/Firstyear/yast-auth-server/blob/2019-03-19-update-ds-create/src/lib/authserver/dir/ds389.rb#L87
> 
> How can I properly log messages to ‘.y2log’ instead of using a custom logging 
> function?

it is really easy. Simply include to your class Y2Logger to your class and then 
you can use method log method to pass things to logger.

so e.g. at 
https://github.com/Firstyear/yast-auth-server/blob/2019-03-19-update-ds-create/src/lib/authserver/ui/new_dir_inst.rb#L28
 you already have it ( but if I can comment code I do not think it is good idea 
to include whole Yast namespace to class due to some class collisions with ruby 
world ), so without inclusion of whole Yast it will look `include Yast::Logger`.
And then you can simply use our logger, which has identical API as ruby logger: 
https://ruby-doc.org/stdlib-2.4.0/libdoc/logger/rdoc/Logger.html

so you can use something like

log.debug "If you are interested, I am here, but you probably are not."
log.info "JFYI: I am here"
log.warn "Hey! I am here."
log.error "I am here and you have problem."

> 
> 
> My branch and work can be found:
> 
> https://github.com/Firstyear/yast-auth-server/tree/2019-03-19-update-ds-create
> 

Feel free to upen draft pull request on github and ask us for code review. We 
can give you bunch of hints, tips and resources how to improve code.

> Thanks! 
>

Thanks to you for making module better.

Josef
 
> —
> Sincerely,
> 
> William Brown
> 
> Senior Software Engineer, 389 Directory Server
> SUSE Labs
> 

--
To unsubscribe, e-mail: [email protected]
To contact the owner, e-mail: [email protected]

Reply via email to