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

How to escape ${var} in parameter value #55

Open
franky4u opened this issue Aug 2, 2016 · 7 comments
Open

How to escape ${var} in parameter value #55

franky4u opened this issue Aug 2, 2016 · 7 comments

Comments

@franky4u
Copy link

franky4u commented Aug 2, 2016

I've a class test.yml with the following def:
parameters:
url: http://my.domain.com/tst/do?nr=${nr}

${nr} is not a reclass variable just a normal string which should be passed to app...
How to escape ${nr} in parameter string? (e.g. ${nr} or similar)
The error I got:
reclass-salt --pillar node1
Traceback (most recent call last):
File "/usr/bin/reclass-salt", line 9, in
load_entry_point('reclass==1.4.1', 'console_scripts', 'reclass-salt')()
File "build/bdist.linux-x86_64/egg/reclass/adapters/salt.py", line 105, in cli
File "build/bdist.linux-x86_64/egg/reclass/adapters/salt.py", line 38, in ext_pillar
File "build/bdist.linux-x86_64/egg/reclass/core.py", line 136, in nodeinfo
File "build/bdist.linux-x86_64/egg/reclass/core.py", line 122, in _nodeinfo
File "build/bdist.linux-x86_64/egg/reclass/datatypes/entity.py", line 65, in interpolate
File "build/bdist.linux-x86_64/egg/reclass/datatypes/parameters.py", line 180, in interpolate
File "build/bdist.linux-x86_64/egg/reclass/datatypes/parameters.py", line 219, in _interpolate_inner
AttributeError: 'UndefinedVariableError' object has no attribute 'var'

@madduck
Copy link
Owner

madduck commented Aug 2, 2016

I have not catered for this, I don't think. But it shouldn't be hard to add an escape handler.

@franky4u
Copy link
Author

franky4u commented Aug 3, 2016

Hi Martin,

Thx for the reply. I’m not very good in python – so I want to ask you to invest some more of your time in your splendid product.

Do you think it’s possible for you to fix that?

Best regards
Franky


Frank Stuppy
ITERGO Informationstechnologie GmbH
ERV Basisinfrastruktur (PEBE M)
Thomas-Dehler-Straße 2
81737 München
Tel. 089/4166-1250
Fax 089/4166-2250
[email protected]:[email protected]

Vorsitzender des Aufsichtsrats: Christian Diedrich
Geschäftsführung: Tomasz Smaczny (Vorsitzender),
Lothar Engelke, Joachim Fensch, Bernd Jung, Dr. Michael Regauer.
Sitz: Düsseldorf, Handelsregister: Amtsgericht Düsseldorf, HRB 37996

Von: martin f. krafft [mailto:[email protected]]
Gesendet: Dienstag, 2. August 2016 20:40
An: madduck/reclass [email protected]
Cc: Stuppy Frank [email protected]; Author [email protected]
Betreff: Re: [madduck/reclass] How to escape ${var} in parameter value (#55)

I have not catered for this, I don't think. But it shouldn't be hard to add an escape handler.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com//issues/55#issuecomment-237000780, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AL7qhI9Hy_OHgVBigZrSvWc6ZcB7EjbYks5qb48AgaJpZM4JaV78.

@madduck
Copy link
Owner

madduck commented Aug 3, 2016

Not anytime soon. I am totally busy elsewhere after I've funding for reclass has been removed.

@lottspot
Copy link
Collaborator

lottspot commented Aug 7, 2016

I can look into implementing this in my fork. I'll open a PR back to upstream if I produce anything worth looking at.

@Sjd-Risca
Copy link

I agree with this problem, but how would you solve it?

I suppose you could insert an escape like \${var}, but what should you type if you'd need to write exactly \ followed instead by a variable substitution?

Maybe it could be define by the following rule: is possible to escape a variable substitution if it is placed a backslash before the dollar, but is you'd need to post a backslash before a variable substitution you should place again a backslash before it.

@lottspot
Copy link
Collaborator

Haven't had time to circle back to this issue yet, and a couple other features have come up which we're looking at with priority. PRs are welcome in the meantime.

@eburghar
Copy link

eburghar commented May 5, 2017

We are doing this way:

parameters:
  dollar: '$' # escaping
  url: http://my.domain.com/tst/do?nr=${dollar}{nr}

AndrewPickford pushed a commit to AndrewPickford/reclass that referenced this issue Sep 11, 2018
Fix: use returned parameter from _render_simple_dict/list in exports class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants