mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 07:26:29 +00:00

In practice they are just typed functions with attributes, having a reference to an object is just confusing. So: Task.run() is now a classmethod
18 lines
584 B
Python
18 lines
584 B
Python
from base import Task
|
|
from common import phases
|
|
|
|
|
|
class WriteMetadata(Task):
|
|
description = 'Writing bootstrap metadata to file'
|
|
phase = phases.cleaning
|
|
|
|
@classmethod
|
|
def run(cls, info):
|
|
metadata_path = info.manifest.plugins['build_metadata']['path']
|
|
with open(metadata_path, 'w') as metadata:
|
|
metadata.write(('AMI_ID={ami_id}\n'
|
|
'AMI_NAME={ami_name}'
|
|
'SNAPSHOT_ID={snapshot_id}'
|
|
.format(ami_id=info.image,
|
|
ami_name=info.ami_name,
|
|
snapshot_id=info.snapshot.id)))
|