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
return
# Check if the target exists in the sources list, raise a PackageError if not
check_target = target
if check_target is None:
check_target = self.default_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)
# Check if the target exists (unless it's the default target) in the sources list
# raise a PackageError if does not
if target not in (None, self.default_target) and not self.source_lists.target_exists(target):
msg = ('The target release {target} was not found in the sources list').format(target=target)
raise PackageError(msg)
# Note that we maintain the target value even if it is none.

View file

@ -87,6 +87,11 @@ class WriteSources(Task):
@classmethod
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():
if name == 'main':
list_path = os.path.join(info.root, 'etc/apt/sources.list')

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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