mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-22 09:50:37 +00:00
Factor DHCPCD installation out into separate task
This commit is contained in:
parent
a5e2a34ecc
commit
9a58277619
3 changed files with 21 additions and 16 deletions
|
@ -65,7 +65,6 @@ def resolve_tasks(taskset, manifest):
|
|||
|
||||
boot.BlackListModules,
|
||||
boot.DisableGetTTYs,
|
||||
tasks.network.EnableDHCPCDDNS,
|
||||
initd.AddExpandRoot,
|
||||
initd.RemoveHWClock,
|
||||
initd.InstallInitScripts,
|
||||
|
@ -73,6 +72,12 @@ def resolve_tasks(taskset, manifest):
|
|||
tasks.ami.RegisterAMI,
|
||||
])
|
||||
|
||||
from bootstrapvz.common.releases import wheezy
|
||||
if manifest.release <= wheezy:
|
||||
# The default DHCP client `isc-dhcp' doesn't work properly on wheezy and earlier
|
||||
taskset.add(tasks.network.InstallDHCPCD)
|
||||
taskset.add(tasks.network.EnableDHCPCDDNS)
|
||||
|
||||
if manifest.provider.get('install_init_scripts', True):
|
||||
taskset.add(tasks.initd.AddEC2InitScripts)
|
||||
|
||||
|
|
|
@ -4,19 +4,27 @@ from bootstrapvz.common.tasks import kernel
|
|||
import os.path
|
||||
|
||||
|
||||
class InstallDHCPCD(Task):
|
||||
description = 'Replacing isc-dhcp with dhcpcd'
|
||||
phase = phases.preparation
|
||||
|
||||
@classmethod
|
||||
def run(cls, info):
|
||||
# isc-dhcp-client before jessie doesn't work properly with ec2
|
||||
info.packages.add('dhcpcd')
|
||||
info.exclude_packages.add('isc-dhcp-client')
|
||||
info.exclude_packages.add('isc-dhcp-common')
|
||||
|
||||
|
||||
class EnableDHCPCDDNS(Task):
|
||||
description = 'Configuring the DHCP client to set the nameservers'
|
||||
phase = phases.system_modification
|
||||
|
||||
@classmethod
|
||||
def run(cls, info):
|
||||
# The dhcp client that ships with debian sets the DNS servers per default.
|
||||
# For dhcpcd in Wheezy and earlier we need to configure it to do that.
|
||||
from bootstrapvz.common.releases import wheezy
|
||||
if info.manifest.release <= wheezy:
|
||||
from bootstrapvz.common.tools import sed_i
|
||||
dhcpcd = os.path.join(info.root, 'etc/default/dhcpcd')
|
||||
sed_i(dhcpcd, '^#*SET_DNS=.*', 'SET_DNS=\'yes\'')
|
||||
from bootstrapvz.common.tools import sed_i
|
||||
dhcpcd = os.path.join(info.root, 'etc/default/dhcpcd')
|
||||
sed_i(dhcpcd, '^#*SET_DNS=.*', 'SET_DNS=\'yes\'')
|
||||
|
||||
|
||||
class AddBuildEssentialPackage(Task):
|
||||
|
|
|
@ -9,14 +9,6 @@ class DefaultPackages(Task):
|
|||
@classmethod
|
||||
def run(cls, info):
|
||||
info.packages.add('file') # Needed for the init scripts
|
||||
|
||||
# isc-dhcp-client before jessie doesn't work properly with ec2
|
||||
from bootstrapvz.common.releases import jessie
|
||||
if info.manifest.release < jessie:
|
||||
info.packages.add('dhcpcd')
|
||||
info.exclude_packages.add('isc-dhcp-client')
|
||||
info.exclude_packages.add('isc-dhcp-common')
|
||||
|
||||
import os.path
|
||||
kernel_packages_path = os.path.join(os.path.dirname(__file__), 'packages-kernels.yml')
|
||||
from bootstrapvz.common.tools import config_get
|
||||
|
|
Loading…
Add table
Reference in a new issue