Skip to content

Instantly share code, notes, and snippets.

@abohne
Created December 27, 2016 19:22
Show Gist options
  • Save abohne/638dc0ddafbee6166ef0409c87fdd215 to your computer and use it in GitHub Desktop.
Save abohne/638dc0ddafbee6166ef0409c87fdd215 to your computer and use it in GitHub Desktop.
#!/bin/env python
import xml.etree.ElementTree as ET
tree = ET.parse("/etc/sysconfig/rhn/systemid")
doc = tree.getroot()
for member in tree.findall('param/value/struct/member'):
if member.find('name').text == 'system_id':
systemid = member.find('value').find('string').text
if systemid.startswith('ID-'):
systemid = systemid[3:]
print "satellite_systemid=" + systemid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment