Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
def disable_proxy(kick_token):
path = '/etc/sysconfig/rhn/up2date'
mode = 0600
tempfd, temp_path = mkstemp()
new_file = open(temp_path, 'w')
old_file = open(path)
except (IOError, OSError) as err:
klog(kick_token, 'Problem disabling proxy for RHN <%s>.' % str(err))
return False
for line in old_file.readlines():
if 'enableProxy=1' in line:
line = line.replace('1', '0')
if 'httpProxy=' in line:
if line.split('=')[1]:
line = line.replace(line.split('=')[1], '')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment