mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 15:36:27 +00:00

- GCE provider wasn't including the GCE SetHostname task, without which https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=604883 was preventing the hostname from getting set after reboot. - During the GCE build, one of the GCE cleaning tasks was trying to run an apt-get update after the build-time resolv.conf file was removed. Fix this ordering by moving the network.Remove* tasks to the system_cleaning phase as they should have been all along, and adding an appropriate ordering rule for the GCE cleaning task. - Add the fallback http.debian.net mirror after, not before, our mirror. - The puppet plugin's ApplyPuppetManifest task specified that it should run before the network.Remove* tasks within the system_modification phase. Now that those tasks have been moved to a later phase (system_cleaning), remove this dependency. I have no puppet manifest to test this change, but am including it in hopes of avoiding a breakage there. Hopefully someone who uses puppet can test this or at least confirm that it's correct. Change-Id: Ieca97f288f456bab119989f4cbc4c3993a755830
54 lines
1.6 KiB
Python
54 lines
1.6 KiB
Python
from bootstrapvz.base import Task
|
|
from .. import phases
|
|
import os
|
|
|
|
|
|
class RemoveDNSInfo(Task):
|
|
description = 'Removing resolv.conf'
|
|
phase = phases.system_cleaning
|
|
|
|
@classmethod
|
|
def run(cls, info):
|
|
if os.path.isfile(os.path.join(info.root, 'etc/resolv.conf')):
|
|
os.remove(os.path.join(info.root, 'etc/resolv.conf'))
|
|
|
|
|
|
class RemoveHostname(Task):
|
|
description = 'Removing the hostname file'
|
|
phase = phases.system_cleaning
|
|
|
|
@classmethod
|
|
def run(cls, info):
|
|
if os.path.isfile(os.path.join(info.root, 'etc/hostname')):
|
|
os.remove(os.path.join(info.root, 'etc/hostname'))
|
|
|
|
|
|
class SetHostname(Task):
|
|
description = 'Writing hostname into the hostname file'
|
|
phase = phases.system_modification
|
|
|
|
@classmethod
|
|
def run(cls, info):
|
|
hostname = info.manifest.system['hostname'].format(**info.manifest_vars)
|
|
hostname_file_path = os.path.join(info.root, 'etc/hostname')
|
|
with open(hostname_file_path, 'w') as hostname_file:
|
|
hostname_file.write(hostname)
|
|
|
|
hosts_path = os.path.join(info.root, 'etc/hosts')
|
|
from bootstrapvz.common.tools import sed_i
|
|
sed_i(hosts_path, '^127.0.0.1\tlocalhost$', '127.0.0.1\tlocalhost\n127.0.1.1\t' + hostname)
|
|
|
|
|
|
class ConfigureNetworkIF(Task):
|
|
description = 'Configuring network interfaces'
|
|
phase = phases.system_modification
|
|
|
|
@classmethod
|
|
def run(cls, info):
|
|
network_config_path = os.path.join(os.path.dirname(__file__), 'network-configuration.yml')
|
|
from ..tools import config_get
|
|
if_config = config_get(network_config_path, [info.release_codename])
|
|
|
|
interfaces_path = os.path.join(info.root, 'etc/network/interfaces')
|
|
with open(interfaces_path, 'a') as interfaces:
|
|
interfaces.write(if_config + '\n')
|