<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">On 23/04/2018 10:36, Hamed Haghshenas
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:!&!AAAAAAAAAAAYAAAAAAAAAJ907spmlQJEvyu2%2F21U6fbCgAAAEAAAANGeGj5uDc5AqGyhEdceIbYBAAAAAA==@chavoosh.com">
      <p class="MsoNormal"><span style="font-size:11.0pt">I know, it’s
          work with your example but I have many client subnet in my
          network about 150 subnets .</span><o:p></o:p></p>
      <p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
      <p class="MsoNormal"><span style="font-size:11.0pt">So a little
          hard to write every subnet in separated line,I want to find a
          way to combine these in one line for every service .</span><o:p></o:p></p>
      <p class="MsoNormal"><span style="font-size:11.0pt"></span></p>
    </blockquote>
    <p>The configuration is YAML, so it's very easy to write a script to
      convert from some local representation (in whatever format is
      convenient for you to maintain) to the format that PDNS requires.</p>
    <p><br>
    </p>
    <p><tt>#!/usr/bin/python</tt><tt><br>
      </tt><tt>import yaml</tt><tt><br>
      </tt><tt><br>
      </tt><tt>s1 = yaml.load("""</tt><tt><br>
      </tt><tt>193.178.201.0/24,188.158.188.0/24:
        tcar.geo.gadgetworld.ir</tt><tt><br>
      </tt><tt>""")</tt><tt><br>
      </tt><tt>s2 = {}</tt><tt><br>
      </tt><tt><br>
      </tt><tt>for k, v in s1.items():</tt><tt><br>
      </tt><tt>    for i in k.split(","):</tt><tt><br>
      </tt><tt>        s2[i] = v</tt><tt><br>
      </tt><tt><br>
      </tt><tt>print(yaml.dump(s2, default_flow_style=False))</tt><br>
    </p>
  </body>
</html>