Commit 97d5f9c3 authored by Antoine Catton's avatar Antoine Catton

Add kinda lock file for rootfs downloading

parent b7c1d8bb
......@@ -109,11 +109,13 @@ class Recipe(GenericSlapRecipe):
config.add_section('rootfs')
config.set('rootfs', 'directory', self.options['rootfs'])
config.set('rootfs', 'tmp', self.options['tmp-dir'])
config.set('rootfs', 'complete', self.options['archive-complete'])
config.add_section('config')
config.set('config', 'file', self.options['config-file'])
config.add_section('tar')
config.set('tar', 'binary', self.options['tar-binary'])
config.set('tar', 'path', self.options['tar-path'])
config.set('tar', 'archive', self.options['archive'])
config_filename = self.options['config']
with open(config_filename, 'w') as config_file:
......
......@@ -26,14 +26,17 @@
##############################################################################
import os
import subprocess
from slapos.recipe.librecipe import GenericBaseRecipe
from slapos.recipe.librecipe.execute import execute
def service(args):
if not os.path.exists(args['rootfs']) and \
not os.path.exists(args['output']):
execute([args['wget'], args['archive'], '-O', args['output']])
if not os.path.exists(args['confirm']):
subprocess.check_call([args['wget'], args['archive'],
'-O', args['output']])
open(args['confirm'], 'w').close()
class Recipe(GenericBaseRecipe):
......@@ -48,7 +51,7 @@ class Recipe(GenericBaseRecipe):
'wget': self.options['wget-binary'],
'archive': self.options['archive-url'],
'output': self.options['downloaded-archive'],
'rootfs': self.options['rootfs']
'confirm': self.options['downloaded-archive-complete']
}
)
)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment