From 300b9c226a0de2b419e8a22af048d414284ac721 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduardo=20Gonz=C3=A1lez?= Date: Thu, 31 Jan 2019 19:59:14 +0000 Subject: [PATCH] Adding ArmImage community builder (#164) --- src/packerlicious/community/builder.py | 29 +++++++++++++++++++ .../community/test_builder_arm.py | 13 +++++++++ 2 files changed, 42 insertions(+) create mode 100644 src/packerlicious/community/builder.py create mode 100644 tests/packerlicious/community/test_builder_arm.py diff --git a/src/packerlicious/community/builder.py b/src/packerlicious/community/builder.py new file mode 100644 index 0000000..fd8dded --- /dev/null +++ b/src/packerlicious/community/builder.py @@ -0,0 +1,29 @@ +""" +Copyright 2018 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. +""" + +from ..builder import PackerBuilder + + +class ArmImage(PackerBuilder): + """ + ARM Builder + https://github.com/solo-io/packer-builder-arm-image + """ + resource_type = "arm-image" + + props = { + 'iso_url': (str, True), + 'iso_checksum_type': (str, True), + 'iso_checksum': (str, True), + 'last_partition_extra_size': (int, False) + } diff --git a/tests/packerlicious/community/test_builder_arm.py b/tests/packerlicious/community/test_builder_arm.py new file mode 100644 index 0000000..9b53648 --- /dev/null +++ b/tests/packerlicious/community/test_builder_arm.py @@ -0,0 +1,13 @@ +import pytest + +import packerlicious.community.builder as builder + + +class TestArmImageBuilder(object): + + def test_required_fields_missing(self): + b = builder.ArmImage() + + with pytest.raises(ValueError) as excinfo: + b.to_dict() + assert 'required' in str(excinfo.value)