diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a9099b..bc8d6fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ ## (UNRELEASED) +## 1.3.0 (February 7, 2019) + +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) diff --git a/README.rst b/README.rst index 17c2b71..8e78131 100644 --- a/README.rst +++ b/README.rst @@ -116,6 +116,7 @@ Builders: - profitbricks - qemu - scaleway +- tencentcloud-cvm - triton - virtualbox-iso - virtualbox-ovf diff --git a/src/packerlicious/builder.py b/src/packerlicious/builder.py index e18b889..ff0d1dd 100644 --- a/src/packerlicious/builder.py +++ b/src/packerlicious/builder.py @@ -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), @@ -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) @@ -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), @@ -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) @@ -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), @@ -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), @@ -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), } @@ -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), @@ -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), @@ -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 diff --git a/src/packerlicious/community/post_processor.py b/src/packerlicious/community/post_processor.py new file mode 100644 index 0000000..c352e95 --- /dev/null +++ b/src/packerlicious/community/post_processor.py @@ -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 diff --git a/src/packerlicious/post_processor.py b/src/packerlicious/post_processor.py index d083160..b8866dc 100644 --- a/src/packerlicious/post_processor.py +++ b/src/packerlicious/post_processor.py @@ -193,6 +193,7 @@ class DockerImport(PackerPostProcessor): props = { 'repository': (str, True), 'tag': (str, False), + 'changes': ([str], False), } @@ -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), @@ -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), diff --git a/src/packerlicious/provisioner.py b/src/packerlicious/provisioner.py index 4ba22a5..92c0913 100644 --- a/src/packerlicious/provisioner.py +++ b/src/packerlicious/provisioner.py @@ -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), @@ -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), @@ -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), @@ -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), @@ -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), } diff --git a/src/packerlicious/version.py b/src/packerlicious/version.py index c68196d..67bc602 100644 --- a/src/packerlicious/version.py +++ b/src/packerlicious/version.py @@ -1 +1 @@ -__version__ = "1.2.0" +__version__ = "1.3.0" diff --git a/tests/packerlicious/test_builder_tencentcloud.py b/tests/packerlicious/test_builder_tencentcloud.py new file mode 100644 index 0000000..c6eb456 --- /dev/null +++ b/tests/packerlicious/test_builder_tencentcloud.py @@ -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)