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

Up until now I didn't see the point of using spaces for indentation. However, the previous commit (a18bec3) was quite eye opening. Given that python is an indentation aware language, the amount of mistakes that went unnoticed because tabs and spaces were used at the same time (tabs for indentation and spaces for alignment) were unacceptable. E101,W191 have been re-enable in the tox flake8 checker and the documentation has been modified accordingly. The following files have been left as-is: * bootstrapvz/common/assets/extlinux/extlinux.conf * bootstrapvz/common/assets/init.d/expand-root * bootstrapvz/common/assets/init.d/generate-ssh-hostkeys * bootstrapvz/common/assets/init.d/squeeze/generate-ssh-hostkeys * bootstrapvz/plugins/docker_daemon/assets/init.d/docker * bootstrapvz/providers/ec2/assets/bin/growpart * bootstrapvz/providers/ec2/assets/grub.d/40_custom * bootstrapvz/providers/ec2/assets/init.d/ec2-get-credentials * bootstrapvz/providers/ec2/assets/init.d/ec2-run-user-data * docs/_static/taskoverview.coffee * docs/_static/taskoverview.less * tests/unit/subprocess.sh
27 lines
1.4 KiB
Python
27 lines
1.4 KiB
Python
|
|
|
|
class BuildServer(object):
|
|
|
|
def __init__(self, name, settings):
|
|
self.name = name
|
|
self.settings = settings
|
|
self.build_settings = settings.get('build_settings', {})
|
|
self.run_settings = settings.get('run_settings', {})
|
|
self.can_bootstrap = settings['can_bootstrap']
|
|
self.release = settings.get('release', None)
|
|
|
|
def apply_build_settings(self, manifest_data):
|
|
if manifest_data['provider']['name'] == 'virtualbox' and 'guest_additions' in manifest_data['provider']:
|
|
manifest_data['provider']['guest_additions'] = self.build_settings['guest_additions']
|
|
if 'apt_proxy' in self.build_settings:
|
|
manifest_data.get('plugins', {})['apt_proxy'] = self.build_settings['apt_proxy']
|
|
if 'ec2-credentials' in self.build_settings:
|
|
if 'credentials' not in manifest_data['provider']:
|
|
manifest_data['provider']['credentials'] = {}
|
|
for key in ['access-key', 'secret-key', 'certificate', 'private-key', 'user-id']:
|
|
if key in self.build_settings['ec2-credentials']:
|
|
manifest_data['provider']['credentials'][key] = self.build_settings['ec2-credentials'][key]
|
|
if 's3-region' in self.build_settings and manifest_data['volume']['backing'] == 's3':
|
|
if 'region' not in manifest_data['image']:
|
|
manifest_data['image']['region'] = self.build_settings['s3-region']
|
|
return manifest_data
|