bootstrap-vz/bootstrapvz/providers/gce/tasks/host.py
Tomasz Rybak b327823261 Add Google Cloud Engine (GCE) provider:
* force kpartx to use synchronous mode, removing sleep(10)
 * get image configuration, use it during tarball creation and registration
 * add (non-working, path problems) image registration
 * add cleaning of image from Google keys and repositories
 * add NTP server address in manifest
 * add preference for backport kernels in manifest
 * disable IPv6
 * correctly set host name
2014-05-03 14:25:54 +02:00

28 lines
885 B
Python

from bootstrapvz.base import Task
from bootstrapvz.common import phases
from bootstrapvz.common.tasks import network
from bootstrapvz.common.tools import log_check_call
import os.path
class DisableIPv6(Task):
description = "Disabling IPv6 support"
phase = phases.system_modification
predecessors = [network.ConfigureNetworkIF]
@classmethod
def run(cls, info):
network_configuration_path = os.path.join(info.root, 'etc/sysctl.d/70-disable-ipv6.conf')
with open(network_configuration_path, 'w') as config_file:
print >>config_file, "net.ipv6.conf.all.disable_ipv6 = 1"
class SetHostname(Task):
description = "Setting hostname"
phase = phases.system_modification
@classmethod
def run(cls, info):
log_check_call(['chroot', info.root, 'ln', '-s',
'/usr/share/google/set-hostname',
'/etc/dhcp/dhclient-exit-hooks.d/set-hostname'])