FAQ
I run the following command on all my states (but this requires a test
minion node, and root access, with various environments/pillars/etc
defined). Ideally you'd crate a vm and run this for every common iteration
of pillar/grain environments that define which states get run and how.
  Obviously that can grow geometrically, so this isn't perfect, but it is a
pretty good start as far as testing syntax and making sure results are
sensible.

# test sls file syntax by identifying files, then running state.show_sls.
for state in `salt-call cp.list_states | awk '{print $2}' | grep -v
'^top#39;`; do
   salt-call --retcode-passthrough state.show_sls ${state}
done
On Saturday, June 28, 2014 12:50:12 PM UTC-5, Alex Leonhardt wrote:

Ah, no i meant it more like a "salt parser salt-formula/" - it'd try to
parse the module and ensure that when salt runs on a client it'd work - is
there something similar ?

Alex

On Saturday, 28 June 2014 00:06:26 UTC+1, basepi wrote:

It looks like syntastic (https://github.com/scrooloose/syntastic) does
have support for checking YAML, but I doubt it will play well with jinja
templating. Though I think you can probably find a plugin that at least
highlights non-matched parens and other inconsistencies, but I'm not sure
of one off the top of my head.

--
Colton Myers


On Sun, Jun 22, 2014 at 5:56 AM, Alex Leonhardt <aleonh...@gmail.com>
wrote:
Hiya,

as am starting to get the hang of salt a little, I'm wondering how to do
basic syntax checking for sls formulas and jinja templates ? I mainly use
VIM as editor and already have some plugins I use - but, e.g. if I have a
missing ")" .. i'd like vim to do a quick syntax check to validate whether
the sls formula would be successfully parsed ? Has anyone suggestions or
methods (vim plugins??) they already use ?

Thanks
Alex

--
You received this message because you are subscribed to the Google
Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to salt-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Jean-Michel Smith at Jun 30, 2014 at 2:33 pm
    sigh. ignore the '#39', that should be another single quote instead. I
    hate cut-and-paste on non-Linux boxes.

    for state in `salt-call cp.list_states | awk '{print $2}' | grep -v
    '^top'`; do
    [ ... ]
    On Monday, June 30, 2014 9:31:01 AM UTC-5, Jean-Michel Smith wrote:

    I run the following command on all my states (but this requires a test
    minion node, and root access, with various environments/pillars/etc
    defined). Ideally you'd crate a vm and run this for every common iteration
    of pillar/grain environments that define which states get run and how.
    Obviously that can grow geometrically, so this isn't perfect, but it is a
    pretty good start as far as testing syntax and making sure results are
    sensible.

    # test sls file syntax by identifying files, then running state.show_sls.
    for state in `salt-call cp.list_states | awk '{print $2}' | grep -v
    '^top#39;`; do
    salt-call --retcode-passthrough state.show_sls ${state}
    done
    On Saturday, June 28, 2014 12:50:12 PM UTC-5, Alex Leonhardt wrote:

    Ah, no i meant it more like a "salt parser salt-formula/" - it'd try to
    parse the module and ensure that when salt runs on a client it'd work - is
    there something similar ?

    Alex

    On Saturday, 28 June 2014 00:06:26 UTC+1, basepi wrote:

    It looks like syntastic (https://github.com/scrooloose/syntastic) does
    have support for checking YAML, but I doubt it will play well with jinja
    templating. Though I think you can probably find a plugin that at least
    highlights non-matched parens and other inconsistencies, but I'm not sure
    of one off the top of my head.

    --
    Colton Myers


    On Sun, Jun 22, 2014 at 5:56 AM, Alex Leonhardt <aleonh...@gmail.com>
    wrote:
    Hiya,

    as am starting to get the hang of salt a little, I'm wondering how to
    do basic syntax checking for sls formulas and jinja templates ? I mainly
    use VIM as editor and already have some plugins I use - but, e.g. if I have
    a missing ")" .. i'd like vim to do a quick syntax check to validate
    whether the sls formula would be successfully parsed ? Has anyone
    suggestions or methods (vim plugins??) they already use ?

    Thanks
    Alex

    --
    You received this message because you are subscribed to the Google
    Groups "Salt-users" group.
    To unsubscribe from this group and stop receiving emails from it, send
    an email to salt-users+...@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "Salt-users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Colton Myers at Jul 11, 2014 at 9:23 pm
    You might consider using something like `salt 'myminion'
    state.show_highstate` or `state.show_lowstate`, as those functions will
    compile the state run and you can inspect it to make sure everything came
    out correctly.

    --
    Colton Myers

    On Mon, Jun 30, 2014 at 8:33 AM, Jean-Michel Smith wrote:

    sigh. ignore the '#39', that should be another single quote instead. I
    hate cut-and-paste on non-Linux boxes.

    for state in `salt-call cp.list_states | awk '{print $2}' | grep -v
    '^top'`; do
    [ ... ]
    On Monday, June 30, 2014 9:31:01 AM UTC-5, Jean-Michel Smith wrote:

    I run the following command on all my states (but this requires a test
    minion node, and root access, with various environments/pillars/etc
    defined). Ideally you'd crate a vm and run this for every common iteration
    of pillar/grain environments that define which states get run and how.
    Obviously that can grow geometrically, so this isn't perfect, but it is a
    pretty good start as far as testing syntax and making sure results are
    sensible.

    # test sls file syntax by identifying files, then running state.show_sls.
    for state in `salt-call cp.list_states | awk '{print $2}' | grep -v
    '^top#39;`; do
    salt-call --retcode-passthrough state.show_sls ${state}
    done
    On Saturday, June 28, 2014 12:50:12 PM UTC-5, Alex Leonhardt wrote:

    Ah, no i meant it more like a "salt parser salt-formula/" - it'd try to
    parse the module and ensure that when salt runs on a client it'd work - is
    there something similar ?

    Alex

    On Saturday, 28 June 2014 00:06:26 UTC+1, basepi wrote:

    It looks like syntastic (https://github.com/scrooloose/syntastic) does
    have support for checking YAML, but I doubt it will play well with jinja
    templating. Though I think you can probably find a plugin that at least
    highlights non-matched parens and other inconsistencies, but I'm not sure
    of one off the top of my head.

    --
    Colton Myers


    On Sun, Jun 22, 2014 at 5:56 AM, Alex Leonhardt <aleonh...@gmail.com>
    wrote:
    Hiya,

    as am starting to get the hang of salt a little, I'm wondering how to
    do basic syntax checking for sls formulas and jinja templates ? I mainly
    use VIM as editor and already have some plugins I use - but, e.g. if I have
    a missing ")" .. i'd like vim to do a quick syntax check to validate
    whether the sls formula would be successfully parsed ? Has anyone
    suggestions or methods (vim plugins??) they already use ?

    Thanks
    Alex

    --
    You received this message because you are subscribed to the Google
    Groups "Salt-users" group.
    To unsubscribe from this group and stop receiving emails from it, send
    an email to salt-users+...@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups
    "Salt-users" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to salt-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "Salt-users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupsalt-users @
postedJun 30, '14 at 2:31p
activeJul 11, '14 at 9:23p
posts3
users2

2 users in discussion

Jean-Michel Smith: 2 posts Colton Myers: 1 post

People

Translate

site design / logo © 2022 Grokbase