2013-07-01 23:54:18 +02:00
|
|
|
from base import Task
|
|
|
|
from common import phases
|
|
|
|
import os.path
|
|
|
|
|
|
|
|
|
|
|
|
class RemoveDNSInfo(Task):
|
|
|
|
description = 'Removing resolv.conf'
|
|
|
|
phase = phases.system_modification
|
|
|
|
|
2014-01-05 15:57:11 +01:00
|
|
|
@classmethod
|
|
|
|
def run(cls, info):
|
2013-07-01 23:54:18 +02:00
|
|
|
from os import remove
|
|
|
|
remove(os.path.join(info.root, 'etc/resolv.conf'))
|
|
|
|
|
|
|
|
|
2013-09-22 15:41:43 +02:00
|
|
|
class RemoveHostname(Task):
|
|
|
|
description = 'Removing the hostname file'
|
|
|
|
phase = phases.system_modification
|
|
|
|
|
2014-01-05 15:57:11 +01:00
|
|
|
@classmethod
|
|
|
|
def run(cls, info):
|
2013-09-22 15:41:43 +02:00
|
|
|
from os import remove
|
|
|
|
remove(os.path.join(info.root, 'etc/hostname'))
|
|
|
|
|
|
|
|
|
2013-07-01 23:54:18 +02:00
|
|
|
class ConfigureNetworkIF(Task):
|
|
|
|
description = 'Configuring network interfaces'
|
|
|
|
phase = phases.system_modification
|
|
|
|
|
2014-01-05 15:57:11 +01:00
|
|
|
@classmethod
|
|
|
|
def run(cls, info):
|
2013-07-01 23:54:18 +02:00
|
|
|
interfaces_path = os.path.join(info.root, 'etc/network/interfaces')
|
2013-07-07 17:06:44 +02:00
|
|
|
if_config = {'squeeze': ('auto lo\n'
|
|
|
|
'iface lo inet loopback\n'
|
|
|
|
'auto eth0\n'
|
|
|
|
'iface eth0 inet dhcp\n'),
|
|
|
|
'wheezy': 'auto eth0\n'
|
|
|
|
'iface eth0 inet dhcp\n'}
|
2013-07-01 23:54:18 +02:00
|
|
|
with open(interfaces_path, 'a') as interfaces:
|
|
|
|
interfaces.write(if_config.get(info.manifest.system['release']))
|