[Spacewalk-list] Config Management Macros

Jason M. Nielsen jnielsen at myriad.com
Thu Dec 8 16:53:39 UTC 2011


I create custom system info variables and then create values for these 
server side during a build or run a script to update. Crude but here is 
something:

####This sets the variable for the host its run on:
#!/usr/bin/python
import xmlrpclib
import getpass
import sys
from socket import gethostname
SATELLITE_URL = "https://spacewalk/rpc/api"
SATELLITE_LOGIN = "userthatcanonlysetconfigs"
SATELLITE_PASSWORD = "password"
client = xmlrpclib.Server(SATELLITE_URL, verbose=0)
key = client.auth.login(SATELLITE_LOGIN, SATELLITE_PASSWORD)
hostname = gethostname()
field_name = sys.argv[1]
field_value = sys.argv[2]
print "%s: %s\n" % (field_name,field_value)
system_id = client.system.getId(key,hostname)
client.system.setCustomValues(key,system_id[0]['id'],{field_name: 
field_value})
client.auth.logout(key)


####This is the bash script that fires it off:
/root/bin/submit_custom_system_info.py gateway `ip route | grep 
'^default' | cut -d ' ' -f 3`
/root/bin/submit_custom_system_info.py nameserver0 `grep nameserver 
/etc/resolv.conf | head -n 1 | cut -d ' ' -f 2`


###Example config file for resolv.conf:
search foo.com
nameserver {|rhn.system.custom_info(nameserver0) = '10.1.1.254'|}


On 12/08/2011 08:24 AM, Grindley, Karl - 0663 - MITLL wrote:
> Greetings,
>
> I've been trying to understand the macros for the configuration
> management section on SpaceWalk. The document lists a few macros
> available for use.
>
> -Is that the complete list of the macros? Are there more?
> -If so, is there a way to pull/find a list of other macros not listed?
> -Is there a way to have a script executed on the target host to
> determine the value of a macro?
>
> Thanks,
> Karl




More information about the Spacewalk-list mailing list