Skip to content

Commit

Permalink
add alicloud builder
Browse files Browse the repository at this point in the history
  • Loading branch information
mayn committed Aug 20, 2017
1 parent 70369e5 commit 67f4211
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@


### FEATURES:
* builder/Alicloud: add support for packer's alicloud ecs builder
* builder/AmazonInstance: add support for packer's amazon instance builder
* builder/Azure: add support for packer's azure builder
* builder/CloudStack: add support for packer's cloudstack builder
Expand Down
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ Currently supported Packer resources

Builders:

- alicloud-ecs
- amazon-ebs
- amazon-instance
- azure-arm
Expand Down
48 changes: 48 additions & 0 deletions src/packerlicious/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,54 @@ def __init__(self, title=None, **kwargs):
super(PackerBuilder, self).__init__(title, **kwargs)


class Alicloud(PackerBuilder):
"""
Alicloud Image Builder
https://www.packer.io/docs/builders/alicloud-ecs.html
"""
resource_type = "alicloud-ecs"

props = {
'access_key': (basestring, True),
'instance_type': (basestring, True),
'image_name': (basestring, True),
'region': (basestring, True),
'secret_key': (basestring, True),
'source_image': (basestring, True),
'skip_region_validation': (validator.boolean, False),
'image_description': (basestring, False),
'image_version': (basestring, False),
'image_share_account': ([basestring], False),
'image_copy_regions': ([basestring], False),
'image_copy_names': ([basestring], False),
'image_force_delete': (validator.boolean, False),
'image_force_delete_snapshots': (validator.boolean, False),
'disk_name': (basestring, False),
'disk_category': (basestring, False),
'disk_size': (int, False),
'disk_snapshot_id': (basestring, False),
'disk_description': (basestring, False),
'disk_delete_with_instance': (basestring, False),
'disk_device': (basestring, False),
'zone_id': (basestring, False),
'io_optimized': (basestring, False),
'force_stop_instance': (validator.boolean, False),
'security_group_id': (basestring, False),
'security_group_name': (basestring, False),
'user_data': (basestring, False),
'user_data_file': (basestring, False),
'vpc_id': (basestring, False),
'vpc_name': (basestring, False),
'vpc_cidr_block': (basestring, False),
'vswitch_id': (basestring, False),
'instance_name': (basestring, False),
'internet_charge_type': (basestring, False),
'internet_max_bandwidth_out': (basestring, False),
'temporary_key_pair_name': (basestring, False),
}



class AmazonSourceAmiFilter(PackerProperty):
"""
https://www.packer.io/docs/builders/amazon-ebs.html#source_ami_filter
Expand Down
13 changes: 13 additions & 0 deletions tests/packerlicious/test_builder_alicloud.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import pytest

import packerlicious.builder as builder


class TestAzureBuilder(object):

def test_required_fields_missing(self):
b = builder.Alicloud()

with pytest.raises(ValueError) as excinfo:
b.to_dict()
assert 'required' in str(excinfo.value)

0 comments on commit 67f4211

Please sign in to comment.