[Spacewalk-list] Update hosts names in SP

William H. ten Bensel WHTENBEN at up.com
Wed May 4 13:29:09 UTC 2016


I am making the assumption that you are referring to the spacewalk profile 
id, let say abc123 and the hostname is now xyz123:


On server/device /etc/sysconfig/rhn/systemid will have the abc123:

<name>profile_name</name>
<value><string>abc123</string></value>


Now you want to rename the spacewalk profile:

        # spacecmd -s spacewalk.domain 
        spacemcd >> system_rename abc123 xyz123

Re-register/reactivate: (2 ways of doing this)

1. Via UI and Server.
        GO to the server in spacewalk -> reactivation -> Generate key.
        ON the server:
         rhnreg_ks --force --serverUrl=https://spacewalk.domain/XMLRPC 
--sslCACert=/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT 
--activationkey=key-from-gui
        Validate:
        /etc/sysconfig/rhn/systemid ---> 

2.   Write a perl/python/java script which runs on the server/device (or 
you can schedule a script run to re-register with the activation key) that 
does something like the following (Sorry: not the full code)

        system_id = "/etc/sysconfig/rhn/systemid"
        rhn_cert = "/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT"
        keys = sys.argv[1:]

        if os.path.exists(rhn_cert):
                for line in open(rhn_cert):
                        if "OU=xxxxx=" in line:
                                http_server=line.split("OU=xxxx=")[-1]
                                http_server=str(http_server.rstrip())
                                http_xml="http://" + http_server + 
"/XMLRPC"
                                http_server="http://" + http_server + 
"/rpc/api"
                if not http_server:
                        http_server="http://xxxxxx/rpc/api"

        if os.path.exists(system_id):
                if os.path.exists(system_id):
                        client = xmlrpclib.Server(http_server)
 
keys.append(client.system.obtain_reactivation_key(open(system_id).read()))


        command = "rhnreg_ks --force --activationkey=" + string.join(keys, 
",")
        os.system(command)


- Thanks and good luck




From:   Konstantin Raskoshnyi <konrasko at gmail.com>
To:     spacewalk-list at redhat.com
Date:   05/04/2016 01:46 AM
Subject:        [Spacewalk-list] Update hosts names in SP
Sent by:        spacewalk-list-bounces at redhat.com



This email originated from outside of the company. Please use discretion 
if opening attachments or clicking on links. 
If I run rhn-profile-sync on hosts then if I click on  a host in SP I see 
the actual hostname.

But does spacewalk has a mechanism to update the host name in SP and set 
in equal to actual hostname?
THanksThis email originated from outside of the company.  Please use 
discretion if opening attachments or clicking on links.

_______________________________________________
Spacewalk-list mailing list
Spacewalk-list at redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-list


**

This email and any attachments may contain information that is confidential and/or privileged for the sole use of the intended recipient.  Any use, review, disclosure, copying, distribution or reliance by others, and any forwarding of this email or its contents, without the express permission of the sender is strictly prohibited by law.  If you are not the intended recipient, please contact the sender immediately, delete the e-mail and destroy all copies.
**
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/spacewalk-list/attachments/20160504/8a204fe8/attachment.htm>


More information about the Spacewalk-list mailing list