Fix #104: Don't verify default target when adding packages

This commit is contained in:
Anders Ingemann 2015-04-29 23:39:55 +02:00
parent f1ce582994
commit 1f6f23e680
23 changed files with 12 additions and 45 deletions

View file

@ -87,12 +87,10 @@ class PackageList(object):
# The package has already been added, skip the checks below # The package has already been added, skip the checks below
return return
# Check if the target exists in the sources list, raise a PackageError if not # Check if the target exists (unless it's the default target) in the sources list
check_target = target # raise a PackageError if does not
if check_target is None: if target not in (None, self.default_target) and not self.source_lists.target_exists(target):
check_target = self.default_target msg = ('The target release {target} was not found in the sources list').format(target=target)
if not self.source_lists.target_exists(check_target):
msg = ('The target release {target} was not found in the sources list').format(target=check_target)
raise PackageError(msg) raise PackageError(msg)
# Note that we maintain the target value even if it is none. # Note that we maintain the target value even if it is none.

View file

@ -87,6 +87,11 @@ class WriteSources(Task):
@classmethod @classmethod
def run(cls, info): def run(cls, info):
if not info.source_lists.target_exists(info.manifest.system['release']):
import logging
log = logging.getLogger(__name__)
log.warn('No default target has been specified in the sources list, '
'installing packages may fail')
for name, sources in info.source_lists.sources.iteritems(): for name, sources in info.source_lists.sources.iteritems():
if name == 'main': if name == 'main':
list_path = os.path.join(info.root, 'etc/apt/sources.list') list_path = os.path.join(info.root, 'etc/apt/sources.list')

View file

@ -1,7 +1,6 @@
from bootstrapvz.base import Task from bootstrapvz.base import Task
from .. import phases from .. import phases
from ..tools import log_check_call from ..tools import log_check_call
import apt
import filesystem import filesystem
import kernel import kernel
from bootstrapvz.base.fs import partitionmaps from bootstrapvz.base.fs import partitionmaps
@ -11,7 +10,6 @@ import os
class AddExtlinuxPackage(Task): class AddExtlinuxPackage(Task):
description = 'Adding extlinux package' description = 'Adding extlinux package'
phase = phases.preparation phase = phases.preparation
predecessors = [apt.AddDefaultSources]
@classmethod @classmethod
def run(cls, info): def run(cls, info):

View file

@ -1,7 +1,6 @@
from bootstrapvz.base import Task from bootstrapvz.base import Task
from .. import phases from .. import phases
from ..tools import log_check_call from ..tools import log_check_call
import apt
import bootstrap import bootstrap
import host import host
import volume import volume
@ -51,7 +50,6 @@ class TuneVolumeFS(Task):
class AddXFSProgs(Task): class AddXFSProgs(Task):
description = 'Adding `xfsprogs\' to the image packages' description = 'Adding `xfsprogs\' to the image packages'
phase = phases.preparation phase = phases.preparation
predecessors = [apt.AddDefaultSources]
@classmethod @classmethod
def run(cls, info): def run(cls, info):

View file

@ -1,7 +1,6 @@
from bootstrapvz.base import Task from bootstrapvz.base import Task
from .. import phases from .. import phases
from ..tools import log_check_call from ..tools import log_check_call
import apt
import filesystem import filesystem
import kernel import kernel
from bootstrapvz.base.fs import partitionmaps from bootstrapvz.base.fs import partitionmaps
@ -11,7 +10,6 @@ import os.path
class AddGrubPackage(Task): class AddGrubPackage(Task):
description = 'Adding grub package' description = 'Adding grub package'
phase = phases.preparation phase = phases.preparation
predecessors = [apt.AddDefaultSources]
@classmethod @classmethod
def run(cls, info): def run(cls, info):

View file

@ -7,7 +7,6 @@ from ..tools import log_check_call
class AddManifestPackages(Task): class AddManifestPackages(Task):
description = 'Adding packages from the manifest' description = 'Adding packages from the manifest'
phase = phases.preparation phase = phases.preparation
predecessors = [apt.AddDefaultSources]
@classmethod @classmethod
def run(cls, info): def run(cls, info):

View file

@ -3,14 +3,12 @@ from .. import phases
from ..tools import log_check_call from ..tools import log_check_call
import os.path import os.path
from . import assets from . import assets
import apt
import initd import initd
class AddOpenSSHPackage(Task): class AddOpenSSHPackage(Task):
description = 'Adding openssh package' description = 'Adding openssh package'
phase = phases.preparation phase = phases.preparation
predecessors = [apt.AddDefaultSources]
@classmethod @classmethod
def run(cls, info): def run(cls, info):

View file

@ -1,14 +1,12 @@
from bootstrapvz.base import Task from bootstrapvz.base import Task
from bootstrapvz.common import phases from bootstrapvz.common import phases
from bootstrapvz.common.tasks.initd import InstallInitScripts from bootstrapvz.common.tasks.initd import InstallInitScripts
from bootstrapvz.common.tasks import apt
import os import os
class AddSudoPackage(Task): class AddSudoPackage(Task):
description = 'Adding `sudo\' to the image packages' description = 'Adding `sudo\' to the image packages'
phase = phases.preparation phase = phases.preparation
predecessors = [apt.AddDefaultSources]
@classmethod @classmethod
def run(cls, info): def run(cls, info):

View file

@ -1,6 +1,5 @@
from bootstrapvz.base import Task from bootstrapvz.base import Task
from bootstrapvz.common import phases from bootstrapvz.common import phases
from bootstrapvz.common.tasks import apt
import os import os
@ -23,7 +22,6 @@ class CheckPlaybookPath(Task):
class AddPackages(Task): class AddPackages(Task):
description = 'Making sure python is installed' description = 'Making sure python is installed'
phase = phases.preparation phase = phases.preparation
predecessors = [apt.AddDefaultSources]
@classmethod @classmethod
def run(cls, info): def run(cls, info):

View file

@ -1,6 +1,5 @@
from bootstrapvz.base import Task from bootstrapvz.base import Task
from bootstrapvz.common import phases from bootstrapvz.common import phases
from bootstrapvz.common.tasks import apt
import os import os
@ -23,7 +22,6 @@ class CheckAssetsPath(Task):
class AddPackages(Task): class AddPackages(Task):
description = 'Add chef package' description = 'Add chef package'
phase = phases.preparation phase = phases.preparation
predecessors = [apt.AddDefaultSources]
@classmethod @classmethod
def run(cls, info): def run(cls, info):

View file

@ -10,7 +10,7 @@ import os.path
class AddCloudInitPackages(Task): class AddCloudInitPackages(Task):
description = 'Adding cloud-init package and sudo' description = 'Adding cloud-init package and sudo'
phase = phases.preparation phase = phases.preparation
predecessors = [apt.AddDefaultSources, apt.AddBackports] predecessors = [apt.AddBackports]
@classmethod @classmethod
def run(cls, info): def run(cls, info):

View file

@ -6,7 +6,7 @@ from bootstrapvz.common import phases
class AddONEContextPackage(Task): class AddONEContextPackage(Task):
description = 'Adding the OpenNebula context package' description = 'Adding the OpenNebula context package'
phase = phases.preparation phase = phases.preparation
predecessors = [apt.AddDefaultSources, apt.AddBackports] predecessors = [apt.AddBackports]
@classmethod @classmethod
def run(cls, info): def run(cls, info):

View file

@ -1,12 +1,10 @@
from bootstrapvz.base import Task from bootstrapvz.base import Task
from bootstrapvz.common import phases from bootstrapvz.common import phases
from bootstrapvz.common.tasks import apt
class AddPipPackage(Task): class AddPipPackage(Task):
description = 'Adding `pip\' and Co. to the image packages' description = 'Adding `pip\' and Co. to the image packages'
phase = phases.preparation phase = phases.preparation
predecessors = [apt.AddDefaultSources]
@classmethod @classmethod
def run(cls, info): def run(cls, info):

View file

@ -1,6 +1,5 @@
from bootstrapvz.base import Task from bootstrapvz.base import Task
from bootstrapvz.common import phases from bootstrapvz.common import phases
from bootstrapvz.common.tasks import apt
from bootstrapvz.common.tools import sed_i from bootstrapvz.common.tools import sed_i
import os import os
@ -40,7 +39,6 @@ class CheckManifestPath(Task):
class AddPackages(Task): class AddPackages(Task):
description = 'Add puppet package' description = 'Add puppet package'
phase = phases.preparation phase = phases.preparation
predecessors = [apt.AddDefaultSources]
@classmethod @classmethod
def run(cls, info): def run(cls, info):

View file

@ -1,7 +1,6 @@
from bootstrapvz.base import Task from bootstrapvz.base import Task
from bootstrapvz.common import phases from bootstrapvz.common import phases
from bootstrapvz.common.tasks import packages from bootstrapvz.common.tasks import packages
from bootstrapvz.common.tasks import apt
from bootstrapvz.common.tools import log_check_call from bootstrapvz.common.tools import log_check_call
from bootstrapvz.common.tools import sed_i from bootstrapvz.common.tools import sed_i
import os import os
@ -11,7 +10,6 @@ import urllib
class InstallSaltDependencies(Task): class InstallSaltDependencies(Task):
description = 'Add depended packages for salt-minion' description = 'Add depended packages for salt-minion'
phase = phases.preparation phase = phases.preparation
predecessors = [apt.AddDefaultSources]
@classmethod @classmethod
def run(cls, info): def run(cls, info):

View file

@ -1,12 +1,10 @@
from bootstrapvz.base import Task from bootstrapvz.base import Task
from bootstrapvz.common import phases from bootstrapvz.common import phases
from bootstrapvz.common.tasks import apt
class AddUnattendedUpgradesPackage(Task): class AddUnattendedUpgradesPackage(Task):
description = 'Adding `unattended-upgrades\' to the image packages' description = 'Adding `unattended-upgrades\' to the image packages'
phase = phases.preparation phase = phases.preparation
predecessors = [apt.AddDefaultSources]
@classmethod @classmethod
def run(cls, info): def run(cls, info):

View file

@ -1,7 +1,6 @@
from bootstrapvz.base import Task from bootstrapvz.base import Task
from bootstrapvz.common import phases from bootstrapvz.common import phases
from bootstrapvz.common.tasks import workspace from bootstrapvz.common.tasks import workspace
from bootstrapvz.common.tasks import apt
import os import os
import shutil import shutil
@ -39,7 +38,6 @@ class CreateVagrantBoxDir(Task):
class AddPackages(Task): class AddPackages(Task):
description = 'Add packages that vagrant depends on' description = 'Add packages that vagrant depends on'
phase = phases.preparation phase = phases.preparation
predecessors = [apt.AddDefaultSources]
@classmethod @classmethod
def run(cls, info): def run(cls, info):

View file

@ -1,13 +1,11 @@
from bootstrapvz.base import Task from bootstrapvz.base import Task
from bootstrapvz.common import phases from bootstrapvz.common import phases
from bootstrapvz.common.tasks import apt
from bootstrapvz.common.tasks.packages import InstallPackages from bootstrapvz.common.tasks.packages import InstallPackages
class DefaultPackages(Task): class DefaultPackages(Task):
description = 'Adding image packages required for Azure' description = 'Adding image packages required for Azure'
phase = phases.preparation phase = phases.preparation
predecessors = [apt.AddDefaultSources]
@classmethod @classmethod
def run(cls, info): def run(cls, info):

View file

@ -1,6 +1,5 @@
from bootstrapvz.base import Task from bootstrapvz.base import Task
from bootstrapvz.common import phases from bootstrapvz.common import phases
from bootstrapvz.common.tasks import apt
from bootstrapvz.common.tasks import kernel from bootstrapvz.common.tasks import kernel
import os.path import os.path
@ -23,7 +22,6 @@ class EnableDHCPCDDNS(Task):
class AddBuildEssentialPackage(Task): class AddBuildEssentialPackage(Task):
description = 'Adding build-essential package' description = 'Adding build-essential package'
phase = phases.preparation phase = phases.preparation
predecessors = [apt.AddDefaultSources]
@classmethod @classmethod
def run(cls, info): def run(cls, info):

View file

@ -1,12 +1,10 @@
from bootstrapvz.base import Task from bootstrapvz.base import Task
from bootstrapvz.common import phases from bootstrapvz.common import phases
from bootstrapvz.common.tasks import apt
class DefaultPackages(Task): class DefaultPackages(Task):
description = 'Adding image packages required for EC2' description = 'Adding image packages required for EC2'
phase = phases.preparation phase = phases.preparation
predecessors = [apt.AddDefaultSources]
@classmethod @classmethod
def run(cls, info): def run(cls, info):

View file

@ -8,7 +8,6 @@ import os
class DefaultPackages(Task): class DefaultPackages(Task):
description = 'Adding image packages required for GCE' description = 'Adding image packages required for GCE'
phase = phases.preparation phase = phases.preparation
predecessors = [apt.AddDefaultSources]
@classmethod @classmethod
def run(cls, info): def run(cls, info):
@ -32,7 +31,7 @@ class DefaultPackages(Task):
class ReleasePackages(Task): class ReleasePackages(Task):
description = 'Adding release-specific packages required for GCE' description = 'Adding release-specific packages required for GCE'
phase = phases.preparation phase = phases.preparation
predecessors = [apt.AddDefaultSources, apt.AddBackports, DefaultPackages] predecessors = [apt.AddBackports, DefaultPackages]
@classmethod @classmethod
def run(cls, info): def run(cls, info):

View file

@ -1,12 +1,10 @@
from bootstrapvz.base import Task from bootstrapvz.base import Task
from bootstrapvz.common import phases from bootstrapvz.common import phases
from bootstrapvz.common.tasks import apt
class DefaultPackages(Task): class DefaultPackages(Task):
description = 'Adding image packages required for kvm' description = 'Adding image packages required for kvm'
phase = phases.preparation phase = phases.preparation
predecessors = [apt.AddDefaultSources]
@classmethod @classmethod
def run(cls, info): def run(cls, info):

View file

@ -1,12 +1,10 @@
from bootstrapvz.base import Task from bootstrapvz.base import Task
from bootstrapvz.common import phases from bootstrapvz.common import phases
from bootstrapvz.common.tasks import apt
class DefaultPackages(Task): class DefaultPackages(Task):
description = 'Adding image packages required for virtualbox' description = 'Adding image packages required for virtualbox'
phase = phases.preparation phase = phases.preparation
predecessors = [apt.AddDefaultSources]
@classmethod @classmethod
def run(cls, info): def run(cls, info):