Skip to content

Instantly share code, notes, and snippets.

@moio
Created April 3, 2018 14:29
Show Gist options
  • Save moio/6e4475a313d04aafdd4d0e1b269ed10c to your computer and use it in GitHub Desktop.
Save moio/6e4475a313d04aafdd4d0e1b269ed10c to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import sys
import xmlrpclib
if len(sys.argv) != 5:
print("Usage: change_channels.py <SUSE MANAGER HOSTNAME> <USERNAME> <PASSWORD> <NEW BASE CHANNEL>")
sys.exit(1)
_, hostname, username, password, channel = sys.argv
manager_url = "http://" + hostname + "/rpc/api"
client = xmlrpclib.Server(manager_url, verbose=0)
key = client.auth.login(username, password)
for system in client.system.listSystems(key):
client.system.setBaseChannel(key, system["id"], channel)
print("Done %s" % system["name"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment