Giter VIP home page Giter VIP logo

salt-debug's Introduction

crappy salt debug for template renders

a simple to use debug module for seeing how a template looks to a minion

it is hacked together out of salts file module. not my original work but am using it to learn some python while I'm at it.

pretty simple to use put salt where it can bee seen from the root file_dir then run salt '*' saltutil.sync_all or salt '*' saltutil.sync_modules

then just point it at the salt:// file you want it to render and tell it the template.

such as salt '*' debug.render source=salt://ntp/files/ntp.jinja template=jinja

so far Two functions exist

debug.render

debug.render
  inputs:
    template: The template type. aka jinja, maco, py, pydsl, ect. 
    source: the location of the file to rendered. so far only tested with salt:// locations
    saltenv: (optional, default "base") the enviroment for the source above
    context: (optional, default None) just like file.* this is a context dict for filleing in extra variables.
    defaults: (optional, default None) same as context
  output:
    either the rendered output, or jinja errors

debug.yamllint

depends: yamllint

debug.yamllint
  inputs:
    template: The template type. aka jinja, maco, py, pydsl, ect. 
    source: the location of the file to rendered. so far only tested with salt:// locations
    saltenv: (optional, default "base") the enviroment for the source above
    context: (optional, default None) just like file.* this is a context dict for filleing in extra variables.
    defaults: (optional, default None) same as context
    yamlconf: (optional, default None) if you don't want to use the default of relaxed the yamllint config file location.
  output:
    a 2 part dict of the output. part 1 is problems. a list of yaml errors detected in the output of a debug.render performed on the code.
    part 2 source. the output from the debug.render performed

salt-debug's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

salt-debug's Issues

Get default saltenv from minion config [enhancement]

I'm using saltenv and pillarenv different from base for my development servers, so every time I'd have to specify saltenv manually, which is rather tedious.

My servers have saltenv in the minion config which means that their default saltenv will be present in __opts__. I don't know if there are other ways to configure default saltenv for a minion.

So the code could look like this:

def render(..., saltenv=None, ...):
   """
   docstring
   """
   if saltenv is None:
      saltenv = __opts__.get('saltenv', 'base')
   ...

That would work for me. But again, I'm not sure if that's a 100% reliable way to obtain the default saltenv for a minion.

could this be converted into a jinja2 -> sls "previewer"?

@whytewolf I am maintaining most of the new 'salt-winrepo-ng' repo and ever since this added the ability to use and mix/in jinja2 templatized code, I find myself wondering, if it is correct and will it render, etc, when I write new 'salt-winrepo-ng' sls files. And more than once I managed to submit broken sls files that had syntax errors or were missing parts, and if I had tried rendering them before submitting them, I could have avoided those. (see saltstack/salt#28899 )

To that end I tried writing a simple python loop to rneder the jinja2 in the sls file. ( see saltstack/salt#28898 )

But I didn't get very far. But now I have seen this simple 'salt-debug' module of yours. Do you think if it used/added the 'tpldir' functionality (see saltstack/salt#28898 (comment) ) I could have it look at (or render) local files that aren't yet somewhere under the "file_roots://" on the master? (also see saltstack/salt#29063 (comment) )

Hoping that you can give helpful input on some of these?

salt-rsp-formula

Hi Thomas.

sorry this is not an issue. but i don't found another way to leave a message for you.
I'm searching for one of your git project : https://github.com/whytewolf/salt-rsp-formula that is no more existing on github.

I'm new saltstack user and want to use it for applying security patchs on and infrastructure containing windows and redhat servers

could you please re share this project so i can take it as example ?

PS: if needed you can email me : [email protected]

Thanks and regards
Ridha.

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.