From 9da7bee180c64699fa6f0b28a29af5c8ab26be43 Mon Sep 17 00:00:00 2001 From: Mikhail Gordeev Date: Sat, 7 Sep 2019 01:18:04 +0300 Subject: [PATCH] Add copy_external_images --- cloud-build.py | 15 +++++++++++++++ example-config.yaml | 2 ++ 2 files changed, 17 insertions(+) diff --git a/cloud-build.py b/cloud-build.py index 4279be0..814d202 100755 --- a/cloud-build.py +++ b/cloud-build.py @@ -100,6 +100,10 @@ class CB: self.bad_arches = cfg.get('bad_arches', []) + self.external_images = cfg.get('external_images') + if self.external_images: + self.external_images = Path(self.external_images).expanduser() + self._packages = cfg.get('packages', {}) self._services = cfg.get('services', {}) self._scripts = cfg.get('scripts', {}) @@ -498,6 +502,17 @@ Dir::Etc::preferencesparts "/var/empty"; self.remove_old_tarballs() + def copy_external_images(self): + if self.external_images: + for branch in os.listdir(self.external_images): + if branch not in self.branches: + self.error(f'Unknown branch {branch} in external_images') + + with self.pushd(self.external_images / branch): + for image in os.listdir(): + self.copy_image(image, + self.images_dir / branch / image) + def sign(self): sum_file = self.checksum_command.upper() for branch in self.branches(): diff --git a/example-config.yaml b/example-config.yaml index 3ba6437..fae6c89 100644 --- a/example-config.yaml +++ b/example-config.yaml @@ -6,6 +6,8 @@ log_level: info bad_arches: - armh +external_images: ~/external_images + images: opennebula: target: vm/opennebula-systemd