rdelval edited a comment on issue #64: update thermos_profile cmdline
URL: https://github.com/apache/aurora/pull/64#issuecomment-524476788
 
 
   @rcuza I'm unable to replicate this exact error but I figured out where it 
comes from.
   
   Using `'''` for multi line strings in python means everything (even 
whitespace) is included as part of the string.
   
   So the following happens when setting the variable like that:
   ```
   >>> cmdline = '''cat <<EOF > .thermos_profile
   ...                export RESULT=hello
   ...                EOF'''
   >>> print(cmdline)
   cat <<EOF > .thermos_profile
                  export RESULT=hello
                  EOF
   ```
   You can notice that there spaces before export and `EOF` are now included in 
the string.
   
   This unfortunately causes issues because bash is looking for an exact 
delimiter match of `EOF` to signal the end of the data being passed into the 
arg. Since there's spaces, bash gets confused.
   
   The simple solution to this is to change:
   
   ```
   setup_env = Process(
     name = 'setup'
     cmdline = '''cat <<EOF > .thermos_profile
                  export RESULT=hello
                  EOF'''
   )
   ```
   To:
   ```
   setup_env = Process(
     name = 'setup',
     cmdline = 
   '''cat <<EOF > .thermos_profile
   export RESULT=hello
   EOF'''
   )
   ```
   
   Which will yield the expected results. Notice I also included a comma at the 
end of name ='setup'
   (without it the job parsing will fail.)
   
   Thanks for pointing this out I can't believe the documentation has been 
around this long and no one else has hit this. 
   
   If you could please test my suggestion out and report back if it works for 
you we'd really appreciate it.
   
   Apologies for taking so long to get to testing this, appreciate you taking 
the time to submit a patch to us!
   
   If it does work, do you mind changing up your patch to use that solution?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to