Maintained by: NLnet Labs

[Unbound-users] accesing config_stub from pythonmod

Anton Tereshchenkov
Wed Jun 5 05:03:51 CEST 2013


Hello,

I have two forward zones defined in config file:
forward-zone:
        name: "somedomain.com."
        forward-addr: 8.8.8.8
        forward-addr: 8.8.4.4

forward-zone:
        name: "anotherone.net."
        forward-addr: 8.8.8.8
        forward-addr: 8.8.4.4

And when I try to get their names from init function using pythonmod:
  def init(id, cfg):
    cfg.forwards.next()
    print cfg.forwards.name
    return True

Attribute error is raised ('SwigPyObject' object has no attribute 'name').
Same when I'm trying to access any other attribute defined in struct
config_stub (addrs, hosts, isfirst).

And one more thing... can't access to mod_env global variable since it is
set to None.
  print type(mod_env)
  <type 'NoneType'>

Using unbound version 1.4.20
Am I missing something?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://unbound.nlnetlabs.nl/pipermail/unbound-users/attachments/20130605/f3e656a1/attachment.html>