<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html>
<head>
  <meta name="Generator" content="Zarafa WebAccess v7.1.11-46050">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <title>RE: reclass and jinja template</title>
  <style type="text/css">
      body
      {
        font-family: Arial, Verdana, Sans-Serif ! important;
        font-size: 12px;
        padding: 5px 5px 5px 5px;
        margin: 0px;
        border-style: none;
        background-color: #ffffff;
      }

      p, ul, li
      {
        margin-top: 0px;
        margin-bottom: 0px;
      }
  </style>
</head>
<body>
<p>Hi Martin,</p><p> </p><p>Thanks for you response, and you create work. The way I get the desired output  at this moment is by doing the following:</p><p> </p><p>In the common class I do this:</p><p> </p><p>applications:<br />  - resolver<br />parameters:<br />  resolver:<br />    searchpaths: ['b-it.internal']<br />    nameservers: ['192.168.1.2','192.168.1.3']<br />    options: []</p><p> </p><p> </p><p>And the node looks like this:</p><p>classes:<br />  - common<br />parameters:<br />  resolver:<br />    searchpaths: ['b-it.internal']<br />    nameservers: ['192.168.1.1']<br />    options: ['single-request-reopen']<br />classes:<br />  - resolver</p><p> </p><p>And this is the content of resolver.yml</p><p>applications:<br />  - resolver</p><p> </p><p>When I run a salt-call pillar.items I get the  desired output. Not sure if this i a correct approach but it seems to work.</p><p>local:<br />    ----------<br />    __reclass__:<br />        ----------<br />        applications:<br />            - resolver<br />        classes:<br />            - resolver<br />        environment:<br />            base<br />        nodename:<br />            nlmbux001<br />    resolver:<br />        ----------<br />        nameservers:<br />            - 192.168.1.1<br />        options:<br />            - single-request-reopen<br />        searchpaths:<br />            - b-it.internal</p><p> </p><p>Met vriendelijke groet, Kind regards,</p><hr /><p><img align="left" src="http://www.b-it.org/files/9713/2722/3937/logo_150.gif" alt="" />    <strong style="color:#333333; text-transform:uppercase; font-size:10px;">Stephan    de Bot</strong></p><div><div style="line-height:16px; margin:6px 0; <br ></div>padding:8px 8px 8px 8px; <br />font-family: 'Lucida Sans', Lucida Grande, Verdana, Arial, Sans-Serif; <br />font-size:11px; color:#555555;">    <a href="http://www.b-it.org">www.b-it.org</a> | <a href="mailto:stephan@b-it.org">stephan@b-it.org</a><br />    Stevensweerterweg 69, Maasbracht, NL, 6051GR</div></div><p> </p><p> </p><p><br /> </p><blockquote style="border-left: 2px solid #325FBA; padding-left: 5px;margin-left:5px;">-----Original message-----<br /><strong>From:</strong>   martin f krafft <madduck@madduck.net><br /><strong>Sent:</strong>       Thu 07-30-2015 08:02 pm<br /><strong>Subject:</strong>        Re: reclass and jinja template<br /><strong>Attachment:</strong>      digital_signature_gpg.asc<br /><strong>To:</strong>   Stephan de Bot <stephan@b-it.org>; <br /><strong>CC:</strong>   reclass@lists.pantsfullofunix.net; <br />Sorry for the late reply.<br /><br />also sprach Stephan de Bot <stephan@b-it.org> [2015-07-25 11:23 +0200]:<br />>         nameservers:<br />>             - 192.168.1.1<br />>             - 192.168.1.2<br />>             - 192.168.1.3<br />>  So the entry on hostlevel does not override the on hosted@ level.<br />>  When I run the state I get all 3 nameservers  in resolv.conf.<br /><br />Yes, this is a feature, and I realise that half the world want it<br />and the other half would prefer if lists were replaced.<br /><br />So far, I have not found a smart way to let you have both, as I am<br />limited by YAML syntax on this one. And I really don't want to go<br />down the path of syntax addons, e.g. hacking such functionality into<br />names and interpreting the parsed output.<br /><br />One idea might be to let an empty list clear an existing list, so<br />that you'd include a helper class after the base class which would<br />set<br /><br />  nameservers: []<br /><br />but this also gets ugly quite fast.<br /><br />So far, the way I've dealt with this was to have the base class<br />define "nameservers_base_set" and define "nameservers" per-host and<br />then either used parameter expansion to seed the per-host list with<br />the base set, or used some Jinja2 logic to get to the result.<br /><br />>  When I define the nameserver in reclass in a different way on hosted@ level:<br />>     nameservers:<br />>       192.168.1.1<br />>       192.168.1.2<br /><br />No you are defining the content of "nameservers" to be a string…<br /><br />>                   +nameserver 1<br />>                   +nameserver 9<br />>                   +nameserver 2<br />[…]<br /><br />and when you iterate a string in Python, this is what you get.<br /><br />-- <br />@martinkrafft | http://madduck.net/ | http://two.sentenc.es/<br /> <br />"i think, therefore i'm single"<br />                                                      -- lizz winstead<br /> <br />spamtraps: madduck.bogus@madduck.net<br /></blockquote><p> </p>
</body>
</html>