Remove image section in manifest

All provider specific settings have been moved to the
provider section. The image name itself is now located
at the top level and called "name". It is required for all providers.
This commit is contained in:
Anders Ingemann 2015-12-13 14:54:06 +01:00
parent 2923f25767
commit c880a6849a
42 changed files with 131 additions and 126 deletions

View file

@ -2,8 +2,10 @@
$schema: http://json-schema.org/draft-04/schema#
title: Generic manifest
type: object
required: [provider, bootstrapper, system, volume]
required: [name, provider, bootstrapper, system, volume]
properties:
name:
type: string
provider:
type: object
properties:
@ -40,11 +42,6 @@ properties:
- scratchbox
required: [workspace]
additionalProperties: false
image:
type: object
properties:
name: {type: string}
required: [name]
system:
type: object
properties:

View file

@ -100,9 +100,9 @@ class Manifest(object):
don't have to access information with info.manifest.data['section']
but can do it with info.manifest.section.
"""
self.name = self.data['name']
self.provider = self.data['provider']
self.bootstrapper = self.data['bootstrapper']
self.image = self.data['image']
self.volume = self.data['volume']
self.system = self.data['system']
from bootstrapvz.common.releases import get_release

View file

@ -8,7 +8,7 @@ class MoveImage(Task):
@classmethod
def run(cls, info):
image_name = info.manifest.image['name'].format(**info.manifest_vars)
image_name = info.manifest.name.format(**info.manifest_vars)
filename = image_name + '.' + info.volume.extension
import os.path

View file

@ -13,7 +13,7 @@ class CheckBoxPath(Task):
@classmethod
def run(cls, info):
box_basename = info.manifest.image['name'].format(**info.manifest_vars)
box_basename = info.manifest.name.format(**info.manifest_vars)
box_name = box_basename + '.box'
box_path = os.path.join(info.manifest.bootstrapper['workspace'], box_name)
if os.path.exists(box_path):

View file

@ -107,8 +107,24 @@ Example:
Image
~~~~~
- ``image.description``: Description of the AMI.
- ``description``: Description of the AMI.
``manifest vars``
- ``bucket``: When bootstrapping an S3 backed image, this
will be the bucket where the image is uploaded to.
``required for S3 backing``
- ``region``: Region in which the AMI should be registered.
``required for S3 backing``
Example:
.. code:: yaml
---
provider:
name: ec2
description: Debian {system.release} {system.architecture}
bucket: debian-amis
region: us-west-1
Dependencies

View file

@ -3,14 +3,6 @@ $schema: http://json-schema.org/draft-04/schema#
title: EC2 manifest for instance store AMIs
type: object
properties:
image:
type: object
properties:
bucket: {type: string}
region: {$ref: '#/definitions/aws-region'}
required:
- bucket
- region
provider:
type: object
properties:
@ -22,7 +14,11 @@ properties:
user-id:
type: string
pattern: (^arn:aws:iam::\d*:user/\w.*$)|(^\d{4}-\d{4}-\d{4}$)
required: [image]
bucket: {type: string}
region: {$ref: '#/definitions/aws-region'}
required:
- bucket
- region
definitions:
aws-region:
enum:

View file

@ -3,13 +3,10 @@ $schema: http://json-schema.org/draft-04/schema#
title: EC2 manifest
type: object
properties:
image:
type: object
properties:
description: {type: string}
provider:
type: object
properties:
description: {type: string}
credentials:
type: object
properties:

View file

@ -18,8 +18,8 @@ class AMIName(Task):
@classmethod
def run(cls, info):
ami_name = info.manifest.image['name'].format(**info.manifest_vars)
ami_description = info.manifest.image['description'].format(**info.manifest_vars)
ami_name = info.manifest.name.format(**info.manifest_vars)
ami_description = info.manifest.provider['description'].format(**info.manifest_vars)
images = info._ec2['connection'].get_all_images(owners=['self'])
for image in images:
@ -64,9 +64,9 @@ class UploadImage(Task):
s3_url = 'https://s3.cn-north-1.amazonaws.com.cn'
else:
s3_url = 'https://s3-{region}.amazonaws.com/'.format(region=info._ec2['region'])
info._ec2['manifest_location'] = info.manifest.image['bucket'] + '/' + info._ec2['ami_name'] + '.manifest.xml'
info._ec2['manifest_location'] = info.manifest.provider['bucket'] + '/' + info._ec2['ami_name'] + '.manifest.xml'
log_check_call(['euca-upload-bundle',
'--bucket', info.manifest.image['bucket'],
'--bucket', info.manifest.provider['bucket'],
'--manifest', manifest_file,
'--access-key', info.credentials['access-key'],
'--secret-key', info.credentials['secret-key'],

View file

@ -35,4 +35,4 @@ class SetRegion(Task):
@classmethod
def run(cls, info):
info._ec2['region'] = info.manifest.image['region']
info._ec2['region'] = info.manifest.provider['region']

View file

@ -11,4 +11,21 @@ be used by Google Compute Engine to project provided in manifest by
Manifest settings
-----------------
- ``image.description``: Description of the image.
Provider
~~~~~~~~
- ``description``: Description of the image.
- ``gcs_destination``: Image destination in GSE.
- ``gce_project``: GCE project in which to register the image.
Example:
.. code:: yaml
---
provider:
name: gce
description: Debian {system.release} {system.architecture}
gcs_destination: gs://my-bucket
gce_project: my-project

View file

@ -60,9 +60,9 @@ def resolve_tasks(taskset, manifest):
taskset.update([tasks.initd.AddGrowRootDisable,
kernel.UpdateInitramfs])
if 'gcs_destination' in manifest.image:
if 'gcs_destination' in manifest.provider:
taskset.add(tasks.image.UploadImage)
if 'gce_project' in manifest.image:
if 'gce_project' in manifest.provider:
taskset.add(tasks.image.RegisterImage)

View file

@ -3,7 +3,7 @@ $schema: http://json-schema.org/draft-04/schema#
title: GCE manifest
type: object
properties:
image:
provider:
type: object
properties:
description: {type: string}

View file

@ -13,7 +13,7 @@ class CreateTarball(Task):
@classmethod
def run(cls, info):
import datetime
image_name = info.manifest.image['name'].format(**info.manifest_vars)
image_name = info.manifest.name.format(**info.manifest_vars)
filename = image_name + '.' + info.volume.extension
today = datetime.datetime.today()
name_suffix = today.strftime('%Y%m%d')
@ -42,7 +42,7 @@ class UploadImage(Task):
@classmethod
def run(cls, info):
log_check_call(['gsutil', 'cp', info._gce['tarball_path'],
info.manifest.image['gcs_destination'] + info._gce['tarball_name']])
info.manifest.provider['gcs_destination'] + info._gce['tarball_name']])
class RegisterImage(Task):
@ -53,9 +53,9 @@ class RegisterImage(Task):
@classmethod
def run(cls, info):
image_description = info._gce['lsb_description']
if 'description' in info.manifest.image:
image_description = info.manifest.image['description']
log_check_call(['gcutil', '--project=' + info.manifest.image['gce_project'],
if 'description' in info.manifest.provider:
image_description = info.manifest.provider['description']
log_check_call(['gcutil', '--project=' + info.manifest.provider['gce_project'],
'addimage', info._gce['image_name'],
info.manifest.image['gcs_destination'] + info._gce['tarball_name'],
info.manifest.provider['gcs_destination'] + info._gce['tarball_name'],
'--description=' + image_description])

View file

@ -26,6 +26,26 @@ Sections
The manifest is split into 7 sections.
Name
~~~~~
Single string property that specifies the name of the image.
- ``name``: The name of the resulting image.
When bootstrapping cloud images, this would be the name visible in
the interface when booting up new instances.
When bootstrapping for VirtualBox or kvm, it's the filename of the
image.
``required``
``manifest vars``
Example:
.. code:: yaml
---
name: debian-{system.release}-{system.architecture}-{%Y}-{%m}-{%d}-ebs
Provider
~~~~~~~~
@ -76,25 +96,10 @@ are 4 possible settings:
It specifies the path to the VirtualBox Guest Additions ISO, which, when specified,
will be mounted and used to install the VirtualBox Guest Additions.
``optional``
- ``variant``:
Image
~~~~~
The image section configures anything pertaining directly to the image
that will be created.
- ``name``: The name of the resulting image.
When bootstrapping cloud images, this would be the name visible in
the interface when booting up new instances.
When bootstrapping for VirtualBox or kvm, it's the filename of the
image.
``required``
``manifest vars``
- ``bucket``: When bootstrapping an S3 backed image for AWS, this
will be the bucket where the image is uploaded to.
``required for S3 backing``
- ``region``: Region in which the AMI should be registered.
``required for S3 backing``
System
~~~~~~

View file

@ -1,4 +1,5 @@
---
name: debian-{system.release}-{system.architecture}-{%y}{%m}{%d}
provider:
name: azure
waagent:
@ -6,8 +7,6 @@ provider:
bootstrapper:
mirror: http://httpredir.debian.org/debian/
workspace: /target
image:
name: debian-{system.release}-{system.architecture}-{%y}{%m}{%d}
system:
release: jessie
architecture: amd64

View file

@ -1,4 +1,5 @@
---
name: debian-{system.release}-{system.architecture}-{%y}{%m}{%d}
provider:
name: azure
waagent:
@ -6,8 +7,6 @@ provider:
bootstrapper:
mirror: http://httpredir.debian.org/debian/
workspace: /target
image:
name: debian-{system.release}-{system.architecture}-{%y}{%m}{%d}
system:
release: wheezy
architecture: amd64

View file

@ -1,4 +1,5 @@
---
name: debian-{system.release}-{system.architecture}-{%y}{%m}{%d}
provider:
name: docker
repository: bootstrap-vz
@ -6,9 +7,6 @@ provider:
bootstrapper:
workspace: /target
variant: minbase
image:
name: debian-{system.release}-{system.architecture}-{%y}{%m}{%d}
description: Debian {system.release} {system.architecture}
system:
release: jessie
architecture: amd64

View file

@ -1,15 +1,15 @@
---
name: debian-{system.release}-{system.architecture}-{provider.virtualization}-{%Y}-{%m}-{%d}-ebs
provider:
name: ec2
virtualization: pvm
# credentials:
# access-key: AFAKEACCESSKEYFORAWS
# secret-key: thes3cr3tkeyf0ryourawsaccount/FS4d8Qdva
description: Debian {system.release} {system.architecture}
bootstrapper:
workspace: /target
image:
name: debian-{system.release}-{system.architecture}-{provider.virtualization}-{%Y}-{%m}-{%d}-ebs
description: Debian {system.release} {system.architecture}
system:
release: testing
architecture: amd64

View file

@ -1,15 +1,14 @@
---
name: debian-{system.release}-{system.architecture}-{provider.virtualization}-{%Y}-{%m}-{%d}-ebs
provider:
name: ec2
virtualization: pvm
# credentials:
# access-key: AFAKEACCESSKEYFORAWS
# secret-key: thes3cr3tkeyf0ryourawsaccount/FS4d8Qdva
description: Debian {system.release} {system.architecture}
bootstrapper:
workspace: /target
image:
name: debian-{system.release}-{system.architecture}-{provider.virtualization}-{%Y}-{%m}-{%d}-ebs
description: Debian {system.release} {system.architecture}
system:
release: unstable
architecture: amd64

View file

@ -1,15 +1,14 @@
---
name: debian-{system.release}-{system.architecture}-{provider.virtualization}-{%Y}-{%m}-{%d}-ebs
provider:
name: ec2
virtualization: pvm
# credentials:
# access-key: AFAKEACCESSKEYFORAWS
# secret-key: thes3cr3tkeyf0ryourawsaccount/FS4d8Qdva
description: Debian {system.release} {system.architecture}
bootstrapper:
workspace: /target
image:
name: debian-{system.release}-{system.architecture}-{provider.virtualization}-{%Y}-{%m}-{%d}-ebs
description: Debian {system.release} {system.architecture}
system:
release: unstable
architecture: amd64

View file

@ -1,4 +1,5 @@
---
name: debian-{system.release}-{system.architecture}-{provider.virtualization}-{%y}{%m}{%d}
provider:
name: ec2
virtualization: pvm
@ -8,13 +9,11 @@ provider:
# certificate: /path/to/your/certificate.pem
# private-key: /path/to/your/private.key
# user-id: arn:aws:iam::123456789012:user/iamuser
bootstrapper:
workspace: /target
image:
name: debian-{system.release}-{system.architecture}-{provider.virtualization}-{%y}{%m}{%d}
description: Debian {system.release} {system.architecture} AMI
bucket: debian-amis
region: us-west-1
bootstrapper:
workspace: /target
system:
release: wheezy
architecture: amd64

View file

@ -1,4 +1,5 @@
---
name: debian-{system.release}-{system.architecture}-{%y}{%m}{%d}
provider:
name: kvm
virtio_modules:
@ -6,8 +7,6 @@ provider:
- virtio_blk
bootstrapper:
workspace: /target
image:
name: debian-{system.release}-{system.architecture}-{%y}{%m}{%d}
system:
release: wheezy
architecture: amd64

View file

@ -1,10 +1,9 @@
---
name: debian-{system.release}-{system.architecture}-{%y}{%m}{%d}
provider:
name: kvm
bootstrapper:
workspace: /target
image:
name: debian-{system.release}-{system.architecture}-{%y}{%m}{%d}
system:
release: wheezy
architecture: amd64

View file

@ -1,11 +1,10 @@
---
name: debian-{system.release}-{system.architecture}-{%y}{%m}{%d}
provider:
name: virtualbox
guest_additions: /usr/share/virtualbox/VBoxGuestAdditions.iso
bootstrapper:
workspace: /target
image:
name: debian-{system.release}-{system.architecture}-{%y}{%m}{%d}
system:
release: wheezy
architecture: amd64

View file

@ -1,11 +1,10 @@
---
name: debian-{system.release}-{system.architecture}-{%y}{%m}{%d}
provider:
name: virtualbox
guest_additions: /usr/share/virtualbox/VBoxGuestAdditions.iso
bootstrapper:
workspace: /target
image:
name: debian-{system.release}-{system.architecture}-{%y}{%m}{%d}
system:
release: wheezy
architecture: amd64

View file

@ -1,4 +1,5 @@
---
name: debian-{system.release}-{system.architecture}-{provider.virtualization}-{%Y}-{%m}-{%d}-ebs
provider:
name: ec2
virtualization: hvm
@ -6,11 +7,9 @@ provider:
# credentials:
# access-key: AFAKEACCESSKEYFORAWS
# secret-key: thes3cr3tkeyf0ryourawsaccount/FS4d8Qdva
description: Debian {system.release} {system.architecture}
bootstrapper:
workspace: /target
image:
name: debian-{system.release}-{system.architecture}-{provider.virtualization}-{%Y}-{%m}-{%d}-ebs
description: Debian {system.release} {system.architecture}
system:
release: jessie
architecture: amd64

View file

@ -1,15 +1,14 @@
---
name: debian-{system.release}-{system.architecture}-{provider.virtualization}-{%Y}-{%m}-{%d}-ebs
provider:
name: ec2
virtualization: pvm
# credentials:
# access-key: AFAKEACCESSKEYFORAWS
# secret-key: thes3cr3tkeyf0ryourawsaccount/FS4d8Qdva
description: Debian {system.release} {system.architecture}
bootstrapper:
workspace: /target
image:
name: debian-{system.release}-{system.architecture}-{provider.virtualization}-{%Y}-{%m}-{%d}-ebs
description: Debian {system.release} {system.architecture}
system:
release: squeeze
architecture: amd64

View file

@ -1,15 +1,14 @@
---
name: debian-{system.release}-{system.architecture}-{provider.virtualization}-{%Y}-{%m}-{%d}-ebs
provider:
name: ec2
virtualization: pvm
# credentials:
# access-key: AFAKEACCESSKEYFORAWS
# secret-key: thes3cr3tkeyf0ryourawsaccount/FS4d8Qdva
description: Debian {system.release} {system.architecture}
bootstrapper:
workspace: /target
image:
name: debian-{system.release}-{system.architecture}-{provider.virtualization}-{%Y}-{%m}-{%d}-ebs
description: Debian {system.release} {system.architecture}
system:
release: squeeze
architecture: i386

View file

@ -1,4 +1,5 @@
---
name: debian-{system.release}-{system.architecture}-{provider.virtualization}-{%Y}-{%m}-{%d}-ebs
provider:
name: ec2
virtualization: hvm
@ -6,11 +7,9 @@ provider:
# credentials:
# access-key: AFAKEACCESSKEYFORAWS
# secret-key: thes3cr3tkeyf0ryourawsaccount/FS4d8Qdva
description: Debian {system.release} {system.architecture}
bootstrapper:
workspace: /target
image:
name: debian-{system.release}-{system.architecture}-{provider.virtualization}-{%Y}-{%m}-{%d}-ebs
description: Debian {system.release} {system.architecture}
system:
release: wheezy
architecture: amd64

View file

@ -1,4 +1,5 @@
---
name: debian-{system.release}-{system.architecture}-{provider.virtualization}-{%Y}-{%m}-{%d}-ebs
provider:
name: ec2
virtualization: hvm
@ -6,11 +7,9 @@ provider:
# credentials:
# access-key: AFAKEACCESSKEYFORAWS
# secret-key: thes3cr3tkeyf0ryourawsaccount/FS4d8Qdva
description: Debian {system.release} {system.architecture}
bootstrapper:
workspace: /target
image:
name: debian-{system.release}-{system.architecture}-{provider.virtualization}-{%Y}-{%m}-{%d}-ebs
description: Debian {system.release} {system.architecture}
system:
release: wheezy
architecture: amd64

View file

@ -1,15 +1,14 @@
---
name: debian-{system.release}-{system.architecture}-{provider.virtualization}-{%Y}-{%m}-{%d}-ebs
provider:
name: ec2
virtualization: pvm
# credentials:
# access-key: AFAKEACCESSKEYFORAWS
# secret-key: thes3cr3tkeyf0ryourawsaccount/FS4d8Qdva
description: Debian {system.release} {system.architecture}
bootstrapper:
workspace: /target
image:
name: debian-{system.release}-{system.architecture}-{provider.virtualization}-{%Y}-{%m}-{%d}-ebs
description: Debian {system.release} {system.architecture}
system:
release: wheezy
architecture: amd64

View file

@ -1,15 +1,14 @@
---
name: debian-{system.release}-{system.architecture}-{provider.virtualization}-{%Y}-{%m}-{%d}-ebs
provider:
name: ec2
virtualization: pvm
# credentials:
# access-key: AFAKEACCESSKEYFORAWS
# secret-key: thes3cr3tkeyf0ryourawsaccount/FS4d8Qdva
description: Debian {system.release} {system.architecture}
bootstrapper:
workspace: /target
image:
name: debian-{system.release}-{system.architecture}-{provider.virtualization}-{%Y}-{%m}-{%d}-ebs
description: Debian {system.release} {system.architecture}
system:
release: wheezy
architecture: amd64

View file

@ -1,15 +1,14 @@
---
name: debian-{system.release}-{system.architecture}-{provider.virtualization}-{%Y}-{%m}-{%d}-ebs
provider:
name: ec2
virtualization: pvm
# credentials:
# access-key: AFAKEACCESSKEYFORAWS
# secret-key: thes3cr3tkeyf0ryourawsaccount/FS4d8Qdva
description: Debian {system.release} {system.architecture}
bootstrapper:
workspace: /target
image:
name: debian-{system.release}-{system.architecture}-{provider.virtualization}-{%Y}-{%m}-{%d}-ebs
description: Debian {system.release} {system.architecture}
system:
release: wheezy
architecture: i386

View file

@ -1,4 +1,5 @@
---
name: debian-{system.release}-{system.architecture}-{provider.virtualization}-{%Y}-{%m}-{%d}
provider:
name: ec2
virtualization: pvm
@ -8,13 +9,11 @@ provider:
# certificate: /path/to/your/certificate.pem
# private-key: /path/to/your/private.key
# user-id: arn:aws:iam::123456789012:user/iamuser
bootstrapper:
workspace: /target
image:
name: debian-{system.release}-{system.architecture}-{provider.virtualization}-{%Y}-{%m}-{%d}
description: Debian {system.release} {system.architecture} AMI
bucket: debian-amis-cn-north-1
region: cn-north-1
bootstrapper:
workspace: /target
system:
release: wheezy
architecture: amd64

View file

@ -1,11 +1,10 @@
---
name: disk
provider:
name: gce
description: Debian {system.release} {system.architecture}
bootstrapper:
workspace: /target
image:
name: disk
description: Debian {system.release} {system.architecture}
system:
release: jessie
architecture: amd64

View file

@ -1,11 +1,10 @@
---
name: disk
provider:
name: gce
description: Debian {system.release} {system.architecture}
bootstrapper:
workspace: /target
image:
name: disk
description: Debian {system.release} {system.architecture}
system:
release: jessie
architecture: amd64

View file

@ -1,11 +1,10 @@
---
name: disk
provider:
name: gce
description: Debian {system.release} {system.architecture}
bootstrapper:
workspace: /target
image:
name: disk
description: Debian {system.release} {system.architecture}
system:
release: wheezy
architecture: amd64

View file

@ -1,11 +1,10 @@
---
name: disk
provider:
name: gce
description: Debian {system.release} {system.architecture}
bootstrapper:
workspace: /target
image:
name: disk
description: Debian {system.release} {system.architecture}
system:
release: wheezy
architecture: amd64

View file

@ -5,6 +5,7 @@ partials = {'ebs_hvm': '''
provider:
name: ec2
virtualization: hvm
description: Debian {system.release} {system.architecture}
volume: {backing: ebs}
''',
'extlinux': 'system: {bootloader: extlinux}',

View file

@ -5,6 +5,7 @@ partials = {'ebs_pvm': '''
provider:
name: ec2
virtualization: pvm
description: Debian {system.release} {system.architecture}
system: {bootloader: pvgrub}
volume: {backing: ebs}
'''

View file

@ -7,7 +7,8 @@ partials = {'s3_pvm': '''
provider:
name: ec2
virtualization: pvm
image: {bucket: ''' + s3_bucket_name + '''}
description: Debian {system.release} {system.architecture}
bucket: ''' + s3_bucket_name + '''
system: {bootloader: pvgrub}
volume: {backing: s3}
'''

View file

@ -1,11 +1,9 @@
---
name: deb-{system.release}-{system.architecture}-{system.bootloader}-{volume.partitions.type}-{%y}{%m}{%d}
provider: {}
bootstrapper:
workspace: /target
tarball: true
image:
name: deb-{system.release}-{system.architecture}-{system.bootloader}-{volume.partitions.type}-{%y}{%m}{%d}
description: Debian {system.release} {system.architecture}
system:
charmap: UTF-8
locale: en_US