Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No ability to use custom salt jinja2 filter in custom cloud deploy scripts #52442

Open
rf-vivanovs opened this issue Apr 8, 2019 · 4 comments
Labels
Confirmed Salt engineer has confirmed bug/feature - often including a MCVE Feature new functionality including changes to functionality and code refactors, etc. Salt-Cloud
Milestone

Comments

@rf-vivanovs
Copy link

rf-vivanovs commented Apr 8, 2019

Description of Issue/Question

When writing deploy scripts vm, opt, and minion dicts are available.
minion is str, but vm and opt are dicts, and we can't dump them directly.

The problem is that if you need to dump/pass information that is json/yaml, you don't have the ability to do that from the deployer script, because no json/yaml filter is available.

I'm not sure if it is intended or not, but would be nice to have an ability to use them.

Setup

I have a custom cloud deployer with "custom" opts:

minion:
  master: xxx
  grains: {}
env-specific-settings:
  some_yaml:
    more_yaml:
      - more_yaml

Then in my custom deployer script I have (just an example)

cat > /tmp/dump <<EOF
{{ opts }}
{{ opts.my_value }}
{{ opts | yaml(False) }}
EOF

Steps to Reproduce Issue

If you deploy a VM with the custom deployer script you will see an error and traceback:

                    File "/usr/lib/python2.7/site-packages/jinja2/environment.py", line 742, in handle_exception
                      reraise(exc_type, exc_value, tb)
                    File "<unknown>", line 14, in template
                  TemplateAssertionError: no filter named 'yaml
Runner function 'cloud.profile' failed.

and the raw dump of data looks like:

{u'key_cache': u'', u'regen_thin': False, u'tcp_master_workers': 4515, u'external_auth': {}, u'fileserver_backend': [u'gitfs', u'roots']....

Versions Report

Salt Version:
           Salt: 2019.2.0

Dependency Versions:
           cffi: 1.6.0
       cherrypy: Not Installed
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: 0.6.4
      gitpython: 1.0.1
          ioflo: Not Installed
         Jinja2: 2.7.2
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.5.6
   mysql-python: Not Installed
      pycparser: 2.14
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.5 (default, Oct 30 2018, 23:45:53)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.3.0
           RAET: Not Installed
          smmap: 0.9.0
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4

System Versions:
           dist: centos 7.6.1810 Core
         locale: ANSI_X3.4-1968
        machine: x86_64
        release: 3.10.0-957.1.3.el7.x86_64
         system: Linux
        version: CentOS Linux 7.6.1810 Core
@rf-vivanovs
Copy link
Author

PR for the feature: #52443

@Ch3LL
Copy link
Contributor

Ch3LL commented Apr 8, 2019

thanks for the PR!!

@Ch3LL Ch3LL added Feature new functionality including changes to functionality and code refactors, etc. Salt-Cloud labels Apr 8, 2019
@Ch3LL Ch3LL added this to the Approved milestone Apr 8, 2019
@stale
Copy link

stale bot commented Jan 8, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

@stale stale bot added the stale label Jan 8, 2020
@sagetherage sagetherage added the Confirmed Salt engineer has confirmed bug/feature - often including a MCVE label Jan 9, 2020
@stale
Copy link

stale bot commented Jan 9, 2020

Thank you for updating this issue. It is no longer marked as stale.

@stale stale bot removed the stale label Jan 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Confirmed Salt engineer has confirmed bug/feature - often including a MCVE Feature new functionality including changes to functionality and code refactors, etc. Salt-Cloud
Projects
None yet
Development

No branches or pull requests

3 participants