| Server IP : 210.245.233.93 / Your IP : 216.73.216.226 Web Server : Apache/2.2.15 (CentOS) System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64 User : apache ( 48) PHP Version : 5.3.3 Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/system-config-network/netconfpkg/conf/ |
Upload File : |
import os
from .ConfShellVar import ConfShellVar # pylint: disable-msg=W0403
class ConfESNetwork(ConfShellVar):
# explicitly for /etc/sysconfig/network: HOSTNAME is magical value
# that writes /etc/HOSTNAME as well
def __init__ (self):
ConfShellVar.__init__(self, '/etc/sysconfig/network')
self.writeHostname = 0
def __setitem__(self, varname, value):
ConfShellVar.__setitem__(self, varname, value)
if varname == 'HOSTNAME':
self.writeHostname = 1
def write(self):
ConfShellVar.write(self)
if self.writeHostname:
mfile = open('/etc/HOSTNAME', 'w', -1)
mfile.write(self.vars['HOSTNAME'] + '\n')
mfile.close()
os.chmod('/etc/HOSTNAME', 0644)
def keys(self):
# There doesn't appear to be a need to return keys in order
# here because we normally always have the same entries in this
# file, and order isn't particularly important.
return self.vars.keys()
def has_key(self, key):
return self.vars.has_key(key)