[Spacewalk-list] rhn.system.custom_info(key_name)
Kobus Bensch
kobus.bensch at lovefilm.com
Fri Mar 18 15:09:02 UTC 2011
This is brilliant thank you.
On 18/03/11 14:51, Brian Collins wrote:
>
> 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:
>
> --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
>
> --instead of reading from a file, it's trivial to get an environment
> variable for your custom data using the 'os' module in python
>
> --I realize that I took some liberties with global variables here;
> when I wrote this, it was a quick hack to get something done
>
> *From:*spacewalk-list-bounces at redhat.com
> [mailto:spacewalk-list-bounces at redhat.com] *On Behalf Of *Kobus Bensch
> *Sent:* Friday, March 18, 2011 6:04 AM
> *To:* spacewalk-list at redhat.com
> *Subject:* Re: [Spacewalk-list] rhn.system.custom_info(key_name)
>
> 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.:
>
> var set on system of like export SYS_VAR_HOST_JOB=SVNSRVR
>
> 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
>
> {|rhn.system.custom_info(SW_CUST_INF_HOST_JOB) = $SYS_VAR_HOST_JOB
>
> On 17/03/11 22:55, Colin Coe wrote:
>
> On Thu, Mar 17, 2011 at 6:00 PM, Kobus Bensch<kobus.bensch at lovefilm.com> <mailto:kobus.bensch at lovefilm.com> wrote:
>
> Hi everyone
>
>
>
> I am looking at custom info. Is there a way I can use vars set on the
>
> server to populate the key to then use in the config file?
>
>
>
> Kobus
>
>
>
>
> Custom info keys are defined globally (with an org) but can
> potentially have a different value for each system. Case in point we
> have two data centres about 1600km apart. Nodes at location A use NFS
> server A, while those in location B use NFS server B. A simple script
> is used to set the nfs_server custom info key for each server and then
> the key is just referenced in the autofs file like:
> /fileshare -rw,hard,intr {|
> rhn.system.custom_info(nfs_server) = defaultnfs.company.com
> |}:/fileshare
>
> If the custom info key is not set for a server it will use
> 'defaultnfs.company.com'.
>
> I hope this is what you were after.
>
> CC
>
>
> --
> *Kobus Bensch*
> Linux Administrator
> kobus.bensch at lovefilm.com <mailto:kobus.bensch at lovefilm.com>
>
> No.9 | 6 Portal Way | London | W3 6RU |
> T: +44 (0)20 8896 8014 | F: +44 (0)20 8896 8111
> <http://www.lovefilm.com>
>
> ------------------------------------------------------------------------
>
> LOVEFiLM UK Limited is a company registered in England and Wales.
> Registered Number: 06528297.
> Registered Office: No.9, 6 Portal Way, London W3 6RU, United Kingdom.
>
> This e-mail is confidential to the ordinary user of the e-mail address
> to which it was
> addressed. If you have received it in error, please delete it from
> your system and notify
> the sender immediately.
>
> This email message has been delivered safely and archived online by
> Mimecast.
> For more information please visit http://www.mimecast.co.uk
>
> ------------------------------------------------------------------------
>
>
> _______________________________________________
> Spacewalk-list mailing list
> Spacewalk-list at redhat.com
> https://www.redhat.com/mailman/listinfo/spacewalk-list
--
*Kobus Bensch*
Linux Administrator
kobus.bensch at lovefilm.com
No.9 | 6 Portal Way | London | W3 6RU |
T: +44 (0)20 8896 8014 | F: +44 (0)20 8896 8111
<http://www.lovefilm.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/spacewalk-list/attachments/20110318/a2a39de9/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 1641 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/spacewalk-list/attachments/20110318/a2a39de9/attachment.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lfi.gif
Type: image/gif
Size: 1641 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/spacewalk-list/attachments/20110318/a2a39de9/attachment-0001.gif>
More information about the Spacewalk-list
mailing list