Giter Site home page Giter Site logo

Comments (15)

whiteinge avatar whiteinge commented on July 17, 2024

Hi, sorry for the slow reply.

I believe that error is complaining about the {{UNQIUE}} Jinja variable on line 57 of that example file. If you're not using the debian_full state you don't need that pillar entry at all and can remove it. If you are using it, you have to replace that with a unique value of your choosing.

We're working on some documentation formatting for formula that will hopefully make things like this a bit more clear. Stay tuned...

from apache-formula.

mklatsky avatar mklatsky commented on July 17, 2024

I am receiving a similar error- although it appears to be unrelated to the {{UNQIUE}} variable. My error is as follows:

web01:
    Data failed to compile:
----------
    Pillar failed to render with the following messages:
----------
    Rendering SLS 'apache' failed, render error:
Undefined jinja variable; line 37 in template

The above is the pillar.example file (renamed to init.sls).

I have added the following line to /etc/salt/pillar/top.sls:

 - apache

I have added the following line to /etc/salt/salt/top.sls:

 - apache.vhost.standard

from apache-formula.

arnisoph avatar arnisoph commented on July 17, 2024

I started to write a small formula for httpd, vhost management will be possible soon.

Take a look at https://github.com/bechtoldt/httpd-formula when you're interested.

from apache-formula.

heldrida avatar heldrida commented on July 17, 2024

This formula doesn't work out of the box. I get the same errors reported on the previous comments and:

local:

Data failed to compile:

Pillar failed to render with the following messages:

Rendering SLS 'apache' failed, render error:

Jinja variable 'id' is undefined; line 40


[...]
CustomLog: {{ logdir }}/{{ id }}-access.log # E.g.: /var/log/apache2/example.com-access.log

  DocumentRoot: {{ wwwdir }}/{{ id }} # E.g., /var/www/example.com

  Directory:
    default: # "default" is a special case; Adds ``{{ wwwdir }}/{{ id }}`` e.g.: /var/www/example.com    <======================
      Options: -Indexes FollowSymLinks
      Order: allow,deny
      Allow: from all
      AllowOverride: None
      Formula_Append: |

[...]

from apache-formula.

whiteinge avatar whiteinge commented on July 17, 2024

Sorry that file isn't more clear -- that needs to be cleaned up. Short explanation: the pillar.example file isn't meant to be a drop-in but rather serve as an example. In most places the values in {{ }} markers are the defaults used if you don't specify that value in your Pillar (pulling those defaults from the map file) -- the exception to that is the id of the vhost.

from apache-formula.

whiteinge avatar whiteinge commented on July 17, 2024

Rephrased: you need to specify the vhost id in your Pillar (e.g.: example.com). Everything else is optional.

from apache-formula.

heldrida avatar heldrida commented on July 17, 2024

Thanks @whiteinge I'll try again tomorrow, but I'm pretty sure I tried to add a key/value id : example.com

from apache-formula.

heldrida avatar heldrida commented on July 17, 2024

@whiteinge are you sure this should work ? http://pastie.org/private/un1vped84pfzywe4p4tig
local:

Data failed to compile:

Pillar failed to render with the following messages:

Rendering SLS 'apache' failed, render error:

Jinja variable 'id' is undefined; line 54

from apache-formula.

whiteinge avatar whiteinge commented on July 17, 2024

@heldrida there is no {{ id }} variable used or defined in your paste. There must be one somewhere else in your Pillar files which is causing the error.

You are right that is the minimum configuration for the state to run. You don't need the id: example.com line. It won't hurt anything; it'll just be ignored. What I meant by id is that the top-level example.com: key in that dictionary is used as the ID declaration of the Salt state.

from apache-formula.

TJuberg avatar TJuberg commented on July 17, 2024

I'm running into the exact same issue as others are experiencing.

    Pillar failed to render with the following messages:
----------
    Rendering SLS 'apache' failed, render error:
Jinja variable 'id' is undefined; line 32

Now, line 32 does not even contain {{ id }}, but it's not the first time the line number being reported is wrong when dealing with jinja. However I'm confused as per the example pillar, the id should be correct

apache:
  sites:
    testsite.com:
      template_file: salt://apache/vhosts/standard.tmpl
      template_engine: jinja

      interface: '*'
      port: '80'

      ServerAdmin: webmaster@{{ id }}

      LogLevel: warn
      ErrorLog: {{ logdir }}/{{ id }}-error.log
      CustomLog: {{ logdir }}/{{ id }}-access.log

      DocumentRoot: {{ wwwdir }}/
...

DocumentRoot being line 32 in this case.

I did try to explicitly set id as well, but hat did nothing.
salt v.2014.1.4

from apache-formula.

heldrida avatar heldrida commented on July 17, 2024

@TJuberg I don't remember how I fixed this and it's been awhile since I used Salt. But what I did was using a different formula or created my own. I tried this one quite a lot without success and lost quite a lot of time.

from apache-formula.

TJuberg avatar TJuberg commented on July 17, 2024

@heldrida Thank you. I'll abandon this for now and explore other avenues.

from apache-formula.

whiteinge avatar whiteinge commented on July 17, 2024

I pushed an update to the example Pillar value that spells out that the values there are intended as examples and not drop-in values. I also replaced the Jinja placeholders with more obvious placeholder text. I tested the formula as well with the minimal Pillar configuration and everything is working as expected.

If anyone is still encountering trouble using this, please reply and include your current Pillar configuration.

from apache-formula.

TJuberg avatar TJuberg commented on July 17, 2024

Well, that explains a lot.

It does not matter if the "values" used are intended as examples when the examples along with their explanation indicate that they are automatically taken from what is explained as passing example.com as {{ id }}.

For those of us that do not know salt very well, had no way of telling that {{ id }} and {{ wwwdir }} had to be replaced as it was presented as something replaced automatically with the value specified as the id when rendering the pillar.

Was very confusing to say the least.
Thanks for fixing this.

from apache-formula.

heldrida avatar heldrida commented on July 17, 2024

@whiteinge thanks for fixing it!

from apache-formula.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.