Inline scripts token expansion broken in 2.6.9. How to escape the @ character? #2021

Closed
kureus opened this Issue Aug 22, 2016 · 8 comments

Projects

None yet

3 participants

@kureus
kureus commented Aug 22, 2016

Upgraded to latest release and some of my scripts broke where I have an @ character in use.
So for example uploading a file using curl needs an @ to indicate its a file, e.g.

curl -F file=@/path/To/File http://somedomain/?filename=@option.filename@

In 2.6.6 this worked and the option.filename token was expanded properly. In 2.6.9 RD seems to pick up the first @ and expand from there.
Was there a major change to how token expansion works?
Do I now need too escape the first @ to get this working again or is this a bug?


Orginally posted this in the google group and was asked to create an issue here
https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/rundeck-discuss/JNC8aP-c1kU/UXHNR_dxAgAJ

@gschueler gschueler added the bug label Aug 22, 2016
@gschueler gschueler added this to the 2.6.x milestone Aug 22, 2016
@gschueler
Contributor

I'm unable to reproduce this. Can you post your job definition (xml) with the error?

@kureus
kureus commented Sep 19, 2016 edited

Simple test case to reproduce the issue I was talking about.

<joblist>
  <job>
    <context>
      <options preserveOrder='true'>
        <option name='domain' value='mydomain.com' />
      </options>
    </context>
    <description></description>
    <executionEnabled>true</executionEnabled>
    <id>198f2bdf-fd17-4435-9eb3-919a6e52a66d</id>
    <loglevel>INFO</loglevel>
    <name>Token expansion test</name>
    <scheduleEnabled>true</scheduleEnabled>
    <sequence keepgoing='false' strategy='node-first'>
      <command>
        <script><![CDATA[echo 'hello@@option.domain@']]></script>
        <scriptargs />
      </command>
    </sequence>
    <uuid>198f2bdf-fd17-4435-9eb3-919a6e52a66d</uuid>
  </job>
</joblist>

I would expect this to write out hello@mydomain.com but instead it writes out hellooption.domain@
Ran on Rundeck 2.6.9-1 cafe bonbon indigo tower 2016-08-03

@gschueler
Contributor

thanks for the test case

@kureus
kureus commented Oct 27, 2016

@gschueler Any further news on this?

@gschueler gschueler self-assigned this Nov 2, 2016
@gschueler gschueler closed this in 4b7fd4f Nov 2, 2016
@gschueler gschueler removed the in progress label Nov 2, 2016
@kureus
kureus commented Nov 2, 2016

Fantastic @gschueler. Many thanks

@schast
schast commented Nov 18, 2016

Hi,

have big problems with this change.
i have inline script perl code with functions like this:

sub perlFunction {
    ...
    return \@files;
}

the script would now be generated without the backslash:

sub perlFunction {
    ...
    return @files;
}

i have tried to escape with:

rundeck inline script: \\@files
generated file: \\@files;

rundeck inline script: \\\@files
generated file: \\@files;

Please reopen this Ticket.

@gschueler
Contributor

@schast i will open a new ticket. would you prefer a way to disable it completely?

@gschueler
Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment