[From nobody Fri Aug 2 12:00:13 2013 From: Roman Rakus <reviewboard@gallagherhome.com> Precedence: list MIME-Version: 1.0 To: "Radek Novacek" <rnovacek@redhat.com>, "OpenLMI Developers" <openlmi-reviews@lists.fedorahosted.org>, "Roman Rakus" <rrakus@redhat.com> References: <20130801131956.714.83307@ex-std-node147.prod.rhcloud.com> In-Reply-To: <20130801131956.714.83307@ex-std-node147.prod.rhcloud.com> Date: Thu, 01 Aug 2013 13:53:24 -0000 Reply-To: Roman Rakus <rrakus@redhat.com>, openlmi-reviews@lists.fedorahosted.org Message-ID: <20130801135324.714.73795@ex-std-node147.prod.rhcloud.com> Content-Type: multipart/alternative; boundary="===============6179599296168066896==" Subject: Re: Review Request 670: openlmi-providers [1/1] Add logging to the openlmi-mof-register script Message: 2 --===============6179599296168066896== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: http://reviewboard-openlmi.rhcloud.com/r/670/#review845 ----------------------------------------------------------- openlmi-mof-register <http://reviewboard-openlmi.rhcloud.com/r/670/#comment453> Bash has native print option to print current time: printf "%(%Y-%m-%d)T" -1 openlmi-mof-register <http://reviewboard-openlmi.rhcloud.com/r/670/#comment450> log "COMMAND:" "$@" looks more natural for me. Using this, you will pass as 1st argument the type and other arguments will be command (with parameters) what you like. openlmi-mof-register <http://reviewboard-openlmi.rhcloud.com/r/670/#comment451> Using eval is very error prone; the command injection is very easy to do, we must be careful. We must also take care that parameters doesn't have any shell functionality. To be honest, I don't like it. openlmi-mof-register <http://reviewboard-openlmi.rhcloud.com/r/670/#comment452> Also split to log "CODE:" "$?" openlmi-mof-register <http://reviewboard-openlmi.rhcloud.com/r/670/#comment454> This will not work. You are checking return value from log_command, it's return value is return value from last executed command, which is log, in turn it is printf. openlmi-mof-register <http://reviewboard-openlmi.rhcloud.com/r/670/#comment455> log STARTING "$0" "$@" openlmi-providers.spec <http://reviewboard-openlmi.rhcloud.com/r/670/#comment456> You can encapsulate the all commands to {} and redirect once. Something like: if ... { } >>... fi or do the redirection for the if command: if... fi >>... It's simpler, readable and less error prone. - Roman Rakus On Aug. 1, 2013, 1:19 p.m., Radek Novacek wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > http://reviewboard-openlmi.rhcloud.com/r/670/ > ----------------------------------------------------------- > > (Updated Aug. 1, 2013, 1:19 p.m.) > > > Review request for OpenLMI Developers. > > > Repository: openlmi-providers > > > Description > ------- > > Add logging to the openlmi-mof-register script > > Each command in the registration script is now logged into > /var/log/openlmi-install.log file. > > > Diffs > ----- > > openlmi-mof-register 4e60e31786e22b063e4c3a42116e05038f5275c3 > openlmi-providers.spec 0552a8cc01c8c3979a2304463f0a663fcc993a95 > > Diff: http://reviewboard-openlmi.rhcloud.com/r/670/diff/ > > > Testing > ------- > > > Thanks, > > Radek Novacek > > --===============6179599296168066896== Content-Type: text/html; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit <html> <body> <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;"> <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;"> <tr> <td> This is an automatically generated e-mail. To reply, visit: <a href="http://reviewboard-openlmi.rhcloud.com/r/670/">http://reviewboard-openlmi.rhcloud.com/r/670/</a> </td> </tr> </table> <br /> <div> <table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;"> <thead> <tr> <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;"> <a href="http://reviewboard-openlmi.rhcloud.com/r/670/diff/1/?file=3833#file3833line28" style="color: black; font-weight: bold; text-decoration: underline;">openlmi-mof-register</a> <span style="font-weight: normal;"> (Diff revision 1) </span> </th> </tr> </thead> <tbody> <tr> <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">28</font></th> <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> printf &quot;$(date +&#39;%Y-%m-%d %H:%M:%S&#39;) $*\n&quot; &gt;&amp;2</pre></td> </tr> </tbody> </table> <pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Bash has native print option to print current time: printf &quot;%(%Y-%m-%d)T&quot; -1</pre> </div> <br /> <div> <table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;"> <thead> <tr> <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;"> <a href="http://reviewboard-openlmi.rhcloud.com/r/670/diff/1/?file=3833#file3833line33" style="color: black; font-weight: bold; text-decoration: underline;">openlmi-mof-register</a> <span style="font-weight: normal;"> (Diff revision 1) </span> </th> </tr> </thead> <tbody> <tr> <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">33</font></th> <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> log &quot;COMMAND: $@&quot;</pre></td> </tr> </tbody> </table> <pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">log &quot;COMMAND:&quot; &quot;$@&quot; looks more natural for me. Using this, you will pass as 1st argument the type and other arguments will be command (with parameters) what you like.</pre> </div> <br /> <div> <table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;"> <thead> <tr> <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;"> <a href="http://reviewboard-openlmi.rhcloud.com/r/670/diff/1/?file=3833#file3833line34" style="color: black; font-weight: bold; text-decoration: underline;">openlmi-mof-register</a> <span style="font-weight: normal;"> (Diff revision 1) </span> </th> </tr> </thead> <tbody> <tr> <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">34</font></th> <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> eval &quot;$@&quot;</pre></td> </tr> </tbody> </table> <pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Using eval is very error prone; the command injection is very easy to do, we must be careful. We must also take care that parameters doesn&#39;t have any shell functionality. To be honest, I don&#39;t like it.</pre> </div> <br /> <div> <table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;"> <thead> <tr> <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;"> <a href="http://reviewboard-openlmi.rhcloud.com/r/670/diff/1/?file=3833#file3833line35" style="color: black; font-weight: bold; text-decoration: underline;">openlmi-mof-register</a> <span style="font-weight: normal;"> (Diff revision 1) </span> </th> </tr> </thead> <tbody> <tr> <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">35</font></th> <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> log &quot;CODE: $?&quot;</pre></td> </tr> </tbody> </table> <pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Also split to log &quot;CODE:&quot; &quot;$?&quot;</pre> </div> <br /> <div> <table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;"> <thead> <tr> <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;"> <a href="http://reviewboard-openlmi.rhcloud.com/r/670/diff/1/?file=3833#file3833line47" style="color: black; font-weight: bold; text-decoration: underline;">openlmi-mof-register</a> <span style="font-weight: normal;"> (Diff revision 1) </span> </th> </tr> </thead> <tbody> <tr> <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">29</font></th> <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> /usr/sbin/cimserver daemon=true \</pre></td> <th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">47</font></th> <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="hl"> log_command</span> /usr/sbin/cimserver daemon=true \</pre></td> </tr> </tbody> <tbody> <tr> <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">30</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> enableHttpConnection=false \</pre></td> <th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">48</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> enableHttpConnection=false \</pre></td> </tr> <tr> <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">31</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> enableHttpsConnection=false \</pre></td> <th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">49</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> enableHttpsConnection=false \</pre></td> </tr> <tr> <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">32</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> enableRemotePrivilegedUserAccess=false \</pre></td> <th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">50</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> enableRemotePrivilegedUserAccess=false \</pre></td> </tr> <tr> <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">33</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> slp=false</pre></td> <th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">51</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> slp=false</pre></td> </tr> <tr> <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">34</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">52</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> </tr> <tr> <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">35</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> if [ &quot;$?&quot; != &quot;0&quot; ]; then</pre></td> <th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">53</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> if [ &quot;$?&quot; != &quot;0&quot; ]; then</pre></td> </tr> <tr> <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">36</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> echo &quot;Cannot start Pegasus&quot; &gt;&amp;2</pre></td> <th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">54</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> echo &quot;Cannot start Pegasus&quot; &gt;&amp;2</pre></td> </tr> </tbody> <tbody> <tr> <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">37</font></th> <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> exit 1</pre></td> <th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">55</font></th> <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="hl">log_</span>exit 1</pre></td> </tr> </tbody> <tbody> <tr> <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">38</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> fi</pre></td> <th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">56</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> fi</pre></td> </tr> </tbody> </table> <pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">This will not work. You are checking return value from log_command, it&#39;s return value is return value from last executed command, which is log, in turn it is printf.</pre> </div> <br /> <div> <table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;"> <thead> <tr> <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;"> <a href="http://reviewboard-openlmi.rhcloud.com/r/670/diff/1/?file=3833#file3833line170" style="color: black; font-weight: bold; text-decoration: underline;">openlmi-mof-register</a> <span style="font-weight: normal;"> (Diff revision 1) </span> </th> </tr> </thead> <tbody> <tr> <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">170</font></th> <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">log &quot;STARTING $0 $*&quot;</pre></td> </tr> </tbody> </table> <pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">log STARTING &quot;$0&quot; &quot;$@&quot;</pre> </div> <br /> <div> <table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;"> <thead> <tr> <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;"> <a href="http://reviewboard-openlmi.rhcloud.com/r/670/diff/1/?file=3834#file3834line431" style="color: black; font-weight: bold; text-decoration: underline;">openlmi-providers.spec</a> <span style="font-weight: normal;"> (Diff revision 1) </span> </th> </tr> </thead> <tbody> <tr> <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">428</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">if [ <span class="s2">&quot;$1&quot;</span> -gt 1 ]; then</pre></td> <th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">431</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">if [ <span class="s2">&quot;$1&quot;</span> -gt 1 ]; then</pre></td> </tr> <tr> <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">429</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="kp">%{_bindir}</span>/openlmi-mof-register -v <span class="kc">%{version}</span> unregister \</pre></td> <th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">432</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="kp">%{_bindir}</span>/openlmi-mof-register -v <span class="kc">%{version}</span> unregister \</pre></td> </tr> <tr> <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">430</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="kp">%{_datadir}</span>/<span class="kc">%{name}</span>/60_LMI_Fan.mof \</pre></td> <th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">433</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="kp">%{_datadir}</span>/<span class="kc">%{name}</span>/60_LMI_Fan.mof \</pre></td> </tr> <tr> <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">431</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="kp">%{_datadir}</span>/<span class="kc">%{name}</span>/60_LMI_Fan.reg \</pre></td> <th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">434</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="kp">%{_datadir}</span>/<span class="kc">%{name}</span>/60_LMI_Fan.reg \</pre></td> </tr> </tbody> <tbody> <tr> <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">432</font></th> <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> &gt;<span class="hl"> /dev/null</span> 2&gt;&amp;1 || :;</pre></td> <th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">435</font></th> <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> &gt;<span class="hl">&gt; %logfile</span> 2&gt;&amp;1 || :;</pre></td> </tr> </tbody> <tbody> <tr> <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">433</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="kp">%{_bindir}</span>/openlmi-mof-register --just-mofs -n root/interop -c tog-pegasus unregister \</pre></td> <th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">436</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="kp">%{_bindir}</span>/openlmi-mof-register --just-mofs -n root/interop -c tog-pegasus unregister \</pre></td> </tr> <tr> <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">434</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="kp">%{_datadir}</span>/<span class="kc">%{name}</span>/90_LMI_Fan_Profile.mof \</pre></td> <th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">437</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="kp">%{_datadir}</span>/<span class="kc">%{name}</span>/90_LMI_Fan_Profile.mof \</pre></td> </tr> </tbody> <tbody> <tr> <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">435</font></th> <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> &gt;<span class="hl"> /dev/null</span> 2&gt;&amp;1 || :;</pre></td> <th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">438</font></th> <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> &gt;<span class="hl">&gt; %logfile</span> 2&gt;&amp;1 || :;</pre></td> </tr> </tbody> <tbody> <tr> <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">436</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">fi</pre></td> <th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">439</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">fi</pre></td> </tr> </tbody> </table> <pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">You can encapsulate the all commands to {} and redirect once. Something like: if ... { } &gt;&gt;... fi or do the redirection for the if command: if... fi &gt;&gt;... It&#39;s simpler, readable and less error prone.</pre> </div> <br /> <p>- Roman Rakus</p> <br /> <p>On August 1st, 2013, 1:19 p.m. UTC, Radek Novacek wrote:</p> <table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('http://reviewboard-openlmi.rhcloud.com/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;"> <tr> <td> <div>Review request for OpenLMI Developers.</div> <div>By Radek Novacek.</div> <p style="color: grey;"><i>Updated Aug. 1, 2013, 1:19 p.m.</i></p> <div style="margin-top: 1.5em;"> <b style="color: #575012; font-size: 10pt;">Repository: </b> openlmi-providers </div> <h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1> <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0"> <tr> <td> <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Add logging to the openlmi-mof-register script Each command in the registration script is now logged into /var/log/openlmi-install.log file. </pre> </td> </tr> </table> <h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1> <ul style="margin-left: 3em; padding-left: 0;"> <li>openlmi-mof-register <span style="color: grey">(4e60e31786e22b063e4c3a42116e05038f5275c3)</span></li> <li>openlmi-providers.spec <span style="color: grey">(0552a8cc01c8c3979a2304463f0a663fcc993a95)</span></li> </ul> <p><a href="http://reviewboard-openlmi.rhcloud.com/r/670/diff/" style="margin-left: 3em;">View Diff</a></p> </td> </tr> </table> </div> </body> </html> --===============6179599296168066896==-- ]