Created
December 27, 2016 19:22
-
-
Save abohne/638dc0ddafbee6166ef0409c87fdd215 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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