Thanks for the idea. As I don't like spreading scripts on clients with login/password, I'll try to do the same from the server (searching for systems without the custom key set, and setting it if empty)
Thanks 2012/12/19 Jason M. Nielsen <[email protected]> > Submit a custom system info variable back to the host profile and use that > in the config file. I have a bash script that runs during a build that > generates the values for variables then submits them back with a python > script. > > ie: > > #!/bin/bash > /root/bin/submit_custom_**system_info.py hostname_short `hostname -s` > ... > > > #!/usr/bin/python > import xmlrpclib > import getpass > import sys > from socket import gethostname > > SATELLITE_URL = > "https://spacewalk.myriad.com/**rpc/api<https://spacewalk.myriad.com/rpc/api> > " > SATELLITE_LOGIN = "submitvar" > SATELLITE_PASSWORD = "SubV@R1t" > client = xmlrpclib.Server(SATELLITE_**URL, verbose=0) > key = client.auth.login(SATELLITE_**LOGIN, SATELLITE_PASSWORD) > > fin = open('/etc/sysconfig/rhn/**systemid') > file = list() > for line in fin: > file.append(line) > > system_id = int(file[file.index('<name>**system_id</name>\n')+1][18:28]**) > > field_name = sys.argv[1] > field_value = sys.argv[2] > print "%s: %s: %s\n" % (system_id,field_name,field_**value) > client.system.setCustomValues(**key,system_id,{field_name: field_value}) > > client.auth.logout(key) > > > On 12/19/2012 12:38 AM, Pierre Casenove wrote: > >> Hello, >> I can't as I want to use the macro in some configuration files, where you >> can't put scripts in them >> >> Pierre >> >> >> 2012/12/19 Jørgen Hysvær Langgåt <[email protected]> >> >> On Tue, Dec 18, 2012 at 5:10 PM, Pierre Casenove <[email protected] >>> >wrote: >>> >>> Hello list, >>>> The RHN predefined macro rhn.system.hostname allows you to get the FQDN >>>> of a client. >>>> In order to manage the /etc/hosts file on some hosts, I would like to >>>> get >>>> the FQDN and the short name. >>>> How could I perform this? >>>> >>>> >>>> How about "cut -d. -f 1" from the FQDN? >>> >>> Regards, >>> Jørgen >>> >>> >>> >>> ______________________________**_________________ >>> Spacewalk-list mailing list >>> [email protected] >>> https://www.redhat.com/**mailman/listinfo/spacewalk-**list<https://www.redhat.com/mailman/listinfo/spacewalk-list> >>> >>> >> >> >> ______________________________**_________________ >> Spacewalk-list mailing list >> [email protected] >> https://www.redhat.com/**mailman/listinfo/spacewalk-**list<https://www.redhat.com/mailman/listinfo/spacewalk-list> >> >> > > ______________________________**_________________ > Spacewalk-list mailing list > [email protected] > https://www.redhat.com/**mailman/listinfo/spacewalk-**list<https://www.redhat.com/mailman/listinfo/spacewalk-list> >
_______________________________________________ Spacewalk-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/spacewalk-list
