<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    This is brilliant thank you.<br>
    <br>
    On 18/03/11 14:51, Brian Collins wrote:
    <blockquote
cite="mid:2779CAD4A7612E4C99DFA78D744D811408E789A7@exchange.sedc.sedata.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <meta name="Generator" content="Microsoft Word 14 (filtered
        medium)">
      <!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]-->
      <style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Consolas","serif";
        color:black;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span style="font-size: 11pt; font-family:
            "Calibri","sans-serif"; color: rgb(31,
            73, 125);">I wrote the attached python script to do
            something similar for us (in our case, it set the custom
            value public_ip, because most of our deployments are behind
            NAT, and this gives us an easy way to look them up when we
            need to SSH to them).  It can be adapted easily to do what
            you're looking for.  A couple of notes:<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size: 11pt; font-family:
            "Calibri","sans-serif"; color: rgb(31,
            73, 125);">--I changed it slightly - I usually have my
            scripts read Satellite credentials from a file, and keep
            that code in a separate python script that I import; I
            removed it to make this script simpler<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size: 11pt; font-family:
            "Calibri","sans-serif"; color: rgb(31,
            73, 125);">--instead of reading from a file, it's trivial to
            get an environment variable for your custom data using the
            'os' module in python<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size: 11pt; font-family:
            "Calibri","sans-serif"; color: rgb(31,
            73, 125);">--I realize that I took some liberties with
            global variables here; when I wrote this, it was a quick
            hack to get something done<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size: 11pt; font-family:
            "Calibri","sans-serif"; color: rgb(31,
            73, 125);"><o:p> </o:p></span></p>
        <div style="border-width: medium medium medium 1.5pt;
          border-style: none none none solid; border-color:
          -moz-use-text-color -moz-use-text-color -moz-use-text-color
          blue; padding: 0in 0in 0in 4pt;">
          <div>
            <div style="border-right: medium none; border-width: 1pt
              medium medium; border-style: solid none none;
              border-color: rgb(181, 196, 223) -moz-use-text-color
              -moz-use-text-color; padding: 3pt 0in 0in;">
              <p class="MsoNormal"><b><span style="font-size: 10pt;
                    font-family:
                    "Tahoma","sans-serif"; color:
                    windowtext;">From:</span></b><span style="font-size:
                  10pt; font-family:
                  "Tahoma","sans-serif"; color:
                  windowtext;"> <a class="moz-txt-link-abbreviated" href="mailto:spacewalk-list-bounces@redhat.com">spacewalk-list-bounces@redhat.com</a>
                  [<a class="moz-txt-link-freetext" href="mailto:spacewalk-list-bounces@redhat.com">mailto:spacewalk-list-bounces@redhat.com</a>] <b>On
                    Behalf Of </b>Kobus Bensch<br>
                  <b>Sent:</b> Friday, March 18, 2011 6:04 AM<br>
                  <b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:spacewalk-list@redhat.com">spacewalk-list@redhat.com</a><br>
                  <b>Subject:</b> Re: [Spacewalk-list]
                  rhn.system.custom_info(key_name)<o:p></o:p></span></p>
            </div>
          </div>
          <p class="MsoNormal"><o:p> </o:p></p>
          <p class="MsoNormal">Thanks for the reply, but the bit you
            described i already sussed. I would like to populate the
            custom_info from a system based variable, ie.:<br>
            <br>
            var set on system of like export SYS_VAR_HOST_JOB=SVNSRVR<br>
            <br>
            I would like this system based var to be imported and set in
            SW under custom info key SW_CUST_INF_HOST_JOB so that I can
            use it in scripts like <br>
            <br>
            {|rhn.system.custom_info(SW_CUST_INF_HOST_JOB) =
            $SYS_VAR_HOST_JOB<br>
            <br>
            On 17/03/11 22:55, Colin Coe wrote: <o:p></o:p></p>
          <pre>On Thu, Mar 17, 2011 at 6:00 PM, Kobus Bensch <a moz-do-not-send="true" href="mailto:kobus.bensch@lovefilm.com"><kobus.bensch@lovefilm.com></a> wrote:<o:p></o:p></pre>
          <blockquote style="margin-top: 5pt; margin-bottom: 5pt;">
            <pre>Hi everyone<o:p></o:p></pre>
            <pre><o:p> </o:p></pre>
            <pre>I am looking at custom info. Is there a way I can use vars set on the<o:p></o:p></pre>
            <pre>server to populate the key to then use in the config file?<o:p></o:p></pre>
            <pre><o:p> </o:p></pre>
            <pre>Kobus<o:p></o:p></pre>
            <pre><o:p> </o:p></pre>
          </blockquote>
          <pre><o:p> </o:p></pre>
          <pre>Custom info keys are defined globally (with an org) but can<o:p></o:p></pre>
          <pre>potentially have a different value for each system.  Case in point we<o:p></o:p></pre>
          <pre>have two data centres about 1600km apart.  Nodes at location A use NFS<o:p></o:p></pre>
          <pre>server A, while those in location B use NFS server B.  A simple script<o:p></o:p></pre>
          <pre>is used to set the nfs_server custom info key for each server and then<o:p></o:p></pre>
          <pre>the key is just referenced in the autofs file like:<o:p></o:p></pre>
          <pre>/fileshare      -rw,hard,intr     {|<o:p></o:p></pre>
          <pre>rhn.system.custom_info(nfs_server) = defaultnfs.company.com<o:p></o:p></pre>
          <pre>|}:/fileshare<o:p></o:p></pre>
          <pre><o:p> </o:p></pre>
          <pre>If the custom info key is not set for a server it will use<o:p></o:p></pre>
          <pre>'defaultnfs.company.com'.<o:p></o:p></pre>
          <pre><o:p> </o:p></pre>
          <pre>I hope this is what you were after.<o:p></o:p></pre>
          <pre><o:p> </o:p></pre>
          <pre>CC<o:p></o:p></pre>
          <pre><o:p> </o:p></pre>
          <p class="MsoNormal"><o:p> </o:p></p>
          <div>
            <p class="MsoNormal">-- <br>
              <b>Kobus Bensch</b><br>
              Linux Administrator<br>
              <a moz-do-not-send="true"
                href="mailto:kobus.bensch@lovefilm.com">kobus.bensch@lovefilm.com</a><br>
              <br>
              No.9 | 6 Portal Way | London | W3 6RU |<br>
              T: +44 (0)20 8896 8014 | F: +44 (0)20 8896 8111<br>
              <a moz-do-not-send="true" href="http://www.lovefilm.com"><span
                  style="text-decoration: none;"><img id="_x0000_i1025"
                    src="cid:part1.06010606.07090005@lovefilm.com"
                    border="0" height="58" width="180"></span></a><o:p></o:p></p>
          </div>
          <p class="MsoNormal" style="margin-bottom: 12pt;"><span
              style="font-size: 10pt; font-family:
              "Arial","sans-serif";"><o:p> </o:p></span></p>
          <div class="MsoNormal" style="text-align: center;"
            align="center"><span style="font-size: 10pt; font-family:
              "Arial","sans-serif";">
              <hr size="2" align="center" width="100%"></span></div>
          <p class="MsoNormal"><span style="font-size: 10pt;
              font-family: "Verdana","sans-serif";">LOVEFiLM
              UK Limited is a company registered in England and Wales. <br>
              Registered Number: 06528297. <br>
              Registered Office: No.9, 6 Portal Way, London W3 6RU,
              United Kingdom.</span><o:p></o:p></p>
          <p><span style="font-size: 10pt; font-family:
              "Verdana","sans-serif";">This e-mail
              is confidential to the ordinary user of the e-mail address
              to which it was <br>
              addressed. If you have received it in error, please delete
              it from your system and notify <br>
              the sender immediately.<br>
              <br>
              This email message has been delivered safely and archived
              online by Mimecast.<br>
              For more information please visit <a
                moz-do-not-send="true" href="http://www.mimecast.co.uk">http://www.mimecast.co.uk</a>
              <o:p></o:p></span></p>
          <div class="MsoNormal" style="text-align: center;"
            align="center"><span style="font-size: 10pt; font-family:
              "Verdana","sans-serif";">
              <hr size="2" align="center" width="100%"></span></div>
        </div>
      </div>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Spacewalk-list mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Spacewalk-list@redhat.com">Spacewalk-list@redhat.com</a>
<a class="moz-txt-link-freetext" href="https://www.redhat.com/mailman/listinfo/spacewalk-list">https://www.redhat.com/mailman/listinfo/spacewalk-list</a></pre>
    </blockquote>
    <br>
    <div class="moz-signature">-- <br>
      <b>Kobus Bensch</b><br>
      Linux Administrator<br>
      <a class="moz-txt-link-abbreviated" href="mailto:kobus.bensch@lovefilm.com">kobus.bensch@lovefilm.com</a><br>
      <br>
      No.9 | 6 Portal Way | London | W3 6RU |<br>
      T: +44 (0)20 8896 8014 | F: +44 (0)20 8896 8111<br>
      <a href="http://www.lovefilm.com"><img
          src="cid:part2.04000801.00060906@lovefilm.com"></a>
    </div>
  </body>
</html>