add preprocessors function

This commit is contained in:
Emmanuel Garette 2021-05-26 20:19:08 +02:00
parent 2ea04e708d
commit 1def6e4e4c
1 changed files with 10 additions and 2 deletions

View File

@ -121,7 +121,6 @@ class Image:
def list_images(self): def list_images(self):
print(self.builds)
for build in self.builds: for build in self.builds:
dependencies = [self.applications[build]['path']] dependencies = [self.applications[build]['path']]
self.calc_depends(dependencies, build) self.calc_depends(dependencies, build)
@ -285,7 +284,16 @@ class Image:
recipe[key] = value recipe[key] = value
with open(packer_filename, 'w') as recipe_fd: with open(packer_filename, 'w') as recipe_fd:
jdump(recipe, recipe_fd, indent=2) jdump(recipe, recipe_fd, indent=2)
print(['packer', 'build', packer_filename]) preprocessors = join(tmp_directory, 'preprocessors')
if isfile(preprocessors):
proc = Popen([preprocessors],
#stdout=PIPE,
#stderr=PIPE,
cwd=tmp_directory,
)
proc.wait()
if proc.returncode:
raise Exception(_(f'error when executing {preprocessors}'))
proc = Popen(['packer', 'build', packer_filename], proc = Popen(['packer', 'build', packer_filename],
#stdout=PIPE, #stdout=PIPE,
#stderr=PIPE, #stderr=PIPE,