<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">Hi Željko,</span><br><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div>On Tue, Jan 28, 2014 at 4:15 AM, Željko Filipin <span dir="ltr"><<a href="mailto:zfilipin@wikimedia.org" target="_blank">zfilipin@wikimedia.org</a>></span> wrote:<br>
</div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">
<div class="gmail_extra"><div class="gmail_quote"><div class="im">On Mon, Jan 27, 2014 at 8:17 PM, Gergo Tisza <span dir="ltr"><<a href="mailto:gtisza@wikimedia.org" target="_blank">gtisza@wikimedia.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I have some issues with how the environment variables are handled, I left some comments in gerrit.</blockquote>
<div><br></div></div><div>I have left my lengthy comment[1] there too. :)</div></div></div></div></blockquote><div><br></div><div>I see what you mean - I didn't realize exports are echoed back.</div><div><br></div><div>
At the risk of overcomplicating things, you could just disable that before setting the parameter. It could be even wrapped into a function to look neater:</div><div><br></div><div><div><font face="courier new, monospace">function copy_variable {</font></div>
<div><font face="courier new, monospace"> set +x;</font></div><div><font face="courier new, monospace"> export $2=${!1};</font></div><div><font face="courier new, monospace"> set -x;</font></div><div><font face="courier new, monospace">}</font></div>
</div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">copy_variable MEDIAWIKI_PASSWORD_COMMONS MEDIAWIKI_PASSWORD</font></div><div><font face="courier new, monospace"># run script</font></div>
<div><br></div><div>...but I'm fine with the double os.getenv version if you don't like this (admittedly it would be more robust than relying on bash tricks).</div><div> </div><div>This reminded me to something that I forgot to mention, though: the <font face="courier new, monospace">set -e</font> flag should be set at the beginning of the script, otherwise only the return value of last command is checked for error status, and any errors in the non-gen_new_image version are ignored.</div>
<div><br></div><div>regards</div><div>Gergő</div></div></div></div>