<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><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]--></head><body bgcolor=white lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>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:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>--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:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>--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:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>--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:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div style='border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt'><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'> spacewalk-list-bounces@redhat.com [mailto:spacewalk-list-bounces@redhat.com] <b>On Behalf Of </b>Kobus Bensch<br><b>Sent:</b> Friday, March 18, 2011 6:04 AM<br><b>To:</b> spacewalk-list@redhat.com<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 href="mailto:kobus.bensch@lovefilm.com"><kobus.bensch@lovefilm.com></a> wrote:<o:p></o:p></pre><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><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 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"><span style='text-decoration:none'><img border=0 width=180 height=58 id="_x0000_i1025" src="cid:image001.gif@01CBE556.CF473690"></span></a><o:p></o:p></p></div><p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'><o:p> </o:p></span></p><div class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'><hr size=2 width="100%" align=center></span></div><p class=MsoNormal><span style='font-size:10.0pt;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:10.0pt;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 href="http://www.mimecast.co.uk">http://www.mimecast.co.uk</a> <o:p></o:p></span></p><div class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'><hr size=2 width="100%" align=center></span></div></div></div></body></html>