Ah, yes - that would be nicer. I was cribbing from the code that was
inducing this error, in lib/puppet/application/puppetrun.rb , which looks
like:

begin
    require 'ldap'
rescue LoadError
    $stderr.puts "Failed to load ruby LDAP library. LDAP functionality will
not be available"
end



On Thu, Dec 10, 2009 at 4:09 PM, Luke Kanies <[email protected]> wrote:

> Wouldn't it make more sense to do Puppet.features.ldap? at the top,
> rather than the direct require?
>
> It doesn't hugely matter, but consistency is good.
>
> On Dec 10, 2009, at 3:49 PM, Jesse Wolfe wrote:
>
> > the ldap/connection spec creates a mock LDAP class that causes
> > `require 'ldap'`
> > to explode. If `require 'ldap'` happens first, then we're OK.
> >
> > Signed-off-by: Jesse Wolfe <[email protected]>
> > ---
> > spec/unit/util/ldap/connection.rb |    5 +++++
> > 1 files changed, 5 insertions(+), 0 deletions(-)
> >
> > diff --git a/spec/unit/util/ldap/connection.rb b/spec/unit/util/ldap/
> > connection.rb
> > index 8bc85a6..7a76dbc 100755
> > --- a/spec/unit/util/ldap/connection.rb
> > +++ b/spec/unit/util/ldap/connection.rb
> > @@ -7,6 +7,11 @@ require File.dirname(__FILE__) + '/../../../
> > spec_helper'
> >
> > require 'puppet/util/ldap/connection'
> >
> > +begin
> > +    require 'ldap'
> > +rescue LoadError
> > +end
> > +
> > # So our mocks and such all work, even when ldap isn't available.
> > unless defined?(LDAP::Conn)
> >     class LDAP
> > --
> > 1.6.5
> >
> > --
> >
> > You received this message because you are subscribed to the Google
> > Groups "Puppet Developers" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> [email protected]<puppet-dev%[email protected]>
> > .
> > For more options, visit this group at
> http://groups.google.com/group/puppet-dev?hl=en
> > .
> >
> >
>
>
> --
> On Bureaucracy....
>     The Pythagorean theorem contains 24 words. Archimedes
> Principle, 67. The Ten Commandments, 179. The American Declaration of
> Independence, 300. And recent legislation in Europe concerning when
> and where to smoke, 23,942. -- The European, June 23-29, 1995
> ---------------------------------------------------------------------
> Luke Kanies | http://reductivelabs.com | http://madstop.com
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Puppet Developers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<puppet-dev%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/puppet-dev?hl=en.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.


Reply via email to