Skip to content

Commit

Permalink
Merge a3bf977 into eac840f
Browse files Browse the repository at this point in the history
  • Loading branch information
mayn committed Feb 7, 2019
2 parents eac840f + a3bf977 commit 6ea7b32
Show file tree
Hide file tree
Showing 7 changed files with 124 additions and 28 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@

## (UNRELEASED)
hashicorp/packer 1.3.4 feature sync

* mirror attributes released in packer v1.3.4
* builder/TencentCloudCvm: add support for packer tencentcloud-cvm

## 1.2.0 (February 2, 2019)

Expand Down
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ Builders:
- profitbricks
- qemu
- scaleway
- tencentcloud-cvm
- triton
- virtualbox-iso
- virtualbox-ovf
Expand Down
104 changes: 76 additions & 28 deletions src/packerlicious/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,7 @@ class Azure(PackerBuilder):
'custom_data_file': (str, False),
'custom_managed_image_name': (str, False),
'custom_managed_image_resource_group_name': (str, False),
'disk_caching_type': (str, False),
'disk_additional_size': ([int], False),
'image_version': (str, False),
'image_url': (str, False),
Expand Down Expand Up @@ -998,6 +999,30 @@ def validate(self):
validator.exactly_one(self.__class__.__name__, self.properties, conds)


class HetznerCloud(PackerBuilder):
"""
Hetzner Cloud Builder
https://www.packer.io/docs/builders/hetzner-cloud.html
"""
resource_type = "hcloud"

props = {
'token': (str, True),
'image': (str, True),
'location': (str, True),
'server_type': (str, True),
'endpoint': (str, False),
'server_name': (str, False),
'snapshot_name': (str, False),
'snapshot_labels': (dict, False),
'poll_interval': (str, False),
'user_data': (str, False),
'user_data_file': (str, False),
'ssh_keys': ([str], False),
'rescue': (validator.string_list_item(["linux64", "linux32", "freebsd64"]), False),
}


class HypervIso(PackerBuilder):
"""
Hyper-V Builder (from an ISO)
Expand All @@ -1011,6 +1036,7 @@ class HypervIso(PackerBuilder):
'iso_url': (str, True),
'boot_command': ([str], False),
'boot_wait': (str, False),
'configuration_version': (str, False),
'cpu': (int, False),
'differencing_disk': (validator.boolean, False),
'disk_additional_size': ([int], False),
Expand Down Expand Up @@ -1045,36 +1071,13 @@ class HypervIso(PackerBuilder):
'switch_vlan_id': (str, False),
'temp_path': (str, False),
'use_fixed_vhd_format': (validator.boolean, False),
'use_legacy_network_adapter': (validator.boolean, False),
'vhd_temp_path': (str, False),
'vlan_id': (str, False),
'vm_name': (str, False),
}


class HetznerCloud(PackerBuilder):
"""
Hetzner Cloud Builder
https://www.packer.io/docs/builders/hetzner-cloud.html
"""
resource_type = "hcloud"

props = {
'token': (str, True),
'image': (str, True),
'location': (str, True),
'server_type': (str, True),
'endpoint': (str, False),
'server_name': (str, False),
'snapshot_name': (str, False),
'snapshot_labels': (dict, False),
'poll_interval': (str, False),
'user_data': (str, False),
'user_data_file': (str, False),
'ssh_keys': ([str], False),
'rescue': (validator.string_list_item(["linux64", "linux32", "freebsd64"]), False),
}


class HypervVmcx(PackerBuilder):
"""
Hyper-V Builder (from a vmcx)
Expand All @@ -1089,6 +1092,8 @@ class HypervVmcx(PackerBuilder):
'clone_all_snapshots': (validator.boolean, False),
'boot_command': ([str], False),
'boot_wait': (str, False),
'copy_in_compare': (validator.boolean, False),
'configuration_version': (str, False),
'cpu': (int, False),
'enable_dynamic_memory': (validator.boolean, False),
'enable_mac_spoofing': (validator.boolean, False),
Expand Down Expand Up @@ -1268,14 +1273,15 @@ class OpenStack(PackerBuilder):
'floating_ip': (str, False),
'floating_ip_network': (str, False),
'floating_ip_pool': (str, False),
'image_disk_format': (str, False),
'image_members': ([str], False),
'image_tags': ([str], False),
'image_visibility': (str, False),
'insecure': (validator.boolean, False),
'instance_metadata': (dict, False),
'instance_name': (str, False),
'key': (str, False),
'metadata': (dict, False),
'image_disk_format': (str, False),
'instance_name': (str, False),
'instance_metadata': (dict, False),
'networks': ([str], False),
'ports': ([str], False),
'rackconnect_wait': (validator.boolean, False),
Expand All @@ -1292,9 +1298,10 @@ class OpenStack(PackerBuilder):
'use_floating_ip': (validator.boolean, False),
'user_data': (str, False),
'user_data_file': (str, False),
'volume_availability_zone': (str, False),
'volume_name': (str, False),
'volume_size': (str, False),
'volume_type': (str, False),
'volume_availability_zone': (str, False),

}

Expand Down Expand Up @@ -1494,6 +1501,7 @@ class Qemu(PackerBuilder):
'accelerator': (str, False),
'boot_command': ([str], False),
'boot_wait': (str, False),
'cpus': (int, False),
'disk_cache': (str, False),
'disk_compression': (validator.boolean, False),
'disk_discard': (str, False),
Expand All @@ -1512,6 +1520,7 @@ class Qemu(PackerBuilder):
'iso_target_extension': (str, False),
'iso_urls': ([str], False),
'machine_type': (str, False),
'memory': (int, False),
'net_device': (str, False),
'output_directory': (str, False),
'qemu_binary': (str, False),
Expand Down Expand Up @@ -1551,6 +1560,45 @@ class Scaleway(PackerBuilder):
}


class TencentCloudCvm(PackerBuilder):
"""
Tencent Cloud Builder
https://www.packer.io/docs/builders/tencentcloud-cvm.html
"""
resource_type = "tencentcloud-cvm"
props = {
'instance_type': (str, True),
'image_name': (str, True),
'secret_id': (str, False),
'secret_key': (str, False),
'region': (str, True),
'zone': (str, True),
'source_image_id': (str, True),
'force_poweroff': (validator.boolean, False),
'image_description': (str, False),
'reboot': (validator.boolean, False),
'image_copy_regions': ([str], False),
'image_share_accounts': ([str], False),
'skip_region_validation': (validator.boolean, False),
'associate_public_ip_address': (validator.boolean, False),
'instance_name': (str, False),
'disk_type': (str, False),
'disk_size': (int, False),
'vpc_id': (str, False),
'vpc_name': (str, False),
'cidr_block': (validator.boolean, False),
'subnet_id': (validator.boolean, False),
'subnet_name': (str, False),
'subnect_cidr_block': (validator.boolean, False),
'internet_max_bandwidth_out': (int, False),
'security_group_id': (str, False),
'security_group_name': (str, False),
'user_data': (str, False),
'user_data_file': (str, False),
'host_name': (str, False),
}


class TritonSourceMachineImageFilter(PackerProperty):
"""
https://www.packer.io/docs/builders/triton.html#source_machine_image_filter
Expand Down
17 changes: 17 additions & 0 deletions src/packerlicious/community/post_processor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""
Copyright 2019 Matthew Aynalem
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""

# placeholder, for future support of community post_processors
5 changes: 5 additions & 0 deletions src/packerlicious/post_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ class DockerImport(PackerPostProcessor):
props = {
'repository': (str, True),
'tag': (str, False),
'changes': ([str], False),
}


Expand Down Expand Up @@ -256,6 +257,9 @@ class GoogleComputeImport(PackerPostProcessor):
'project_id': (str, True),
'gcs_object_name': (str, False),
'image_description': (str, False),
'image_guest_os_features': (validator.string_list_item(["MULTI_IP_SUBNET", "SECURE_BOOT",
"UEFI_COMPATIBLE", "VIRTIO_SCSI_MULTIQUEUE",
"WINDOWS"]), False),
'image_family': (str, False),
'image_labels': (dict, False),
'keep_input_artifact': (validator.boolean, False),
Expand Down Expand Up @@ -310,6 +314,7 @@ class ShellLocal(PackerPostProcessor):
'script': (str, False),
'scripts': ([str], False),
'environment_vars': ([str], False),
'env_var_format': (str, False),
'execute_command': ([str], False),
'inline_shebang': (str, False),
'only_on': ([str], False),
Expand Down
9 changes: 9 additions & 0 deletions src/packerlicious/provisioner.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ class ChefClient(PackerProvisioner):
props = {
'chef_environment': (str, False),
'config_template': (str, False),
'elevated_user': (str, False),
'elevated_password': (str, False),
'encrypted_data_bag_secret_path': (str, False),
'execute_command': (str, False),
'guest_os_type': (validator.string_list_item([UNIX, WINDOWS]), False),
Expand Down Expand Up @@ -284,6 +286,8 @@ class PuppetMasterless(PackerProvisioner):

props = {
'manifest_file': (str, True),
'elevated_user': (str, False),
'elevated_password': (str, False),
'execute_command': (str, False),
'extra_arguments': ([str], False),
'guest_os_type': (validator.string_list_item([UNIX, WINDOWS]), False),
Expand All @@ -309,6 +313,8 @@ class PuppetServer(PackerProvisioner):
props = {
'client_cert_path': (str, False),
'client_private_key_path': (str, False),
'elevated_user': (str, False),
'elevated_password': (str, False),
'execute_command': (str, False),
'facter': (dict, False),
'guest_os_type': (validator.string_list_item([UNIX, WINDOWS]), False),
Expand Down Expand Up @@ -418,6 +424,7 @@ class ShellLocal(PackerProvisioner):
'inline': ([str], False),
'script': (str, False),
'scripts': ([str], False),
'env_var_format': (str, False),
'environment_vars': ([str], False),
'execute_command': ([str], False),
'inline_shebang': (str, False),
Expand Down Expand Up @@ -477,4 +484,6 @@ class WindowsRestart(PackerProvisioner):
'restart_command': (str, False),
'restart_check_command': (str, False),
'restart_timeout': (str, False),
'check_registry': (validator.boolean, False),
'registry_keys': ([str], False),
}
13 changes: 13 additions & 0 deletions tests/packerlicious/test_builder_tencentcloud.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import pytest

import packerlicious.builder as builder


class TestTencentCloudCvmBuilder(object):

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

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

0 comments on commit 6ea7b32

Please sign in to comment.