jsondump recipe: use GenericBaseRecipe.

parent e18d01ba
from slapos.recipe.librecipe import GenericBaseRecipe
import json
import os
class Recipe(object):
def __init__(self, buildout, name, options):
class Recipe(GenericBaseRecipe):
def install(self):
parameter_dict = {
key: value
for key, value in options.items()
for key, value in self.options.items()
if key not in ['json-output', 'recipe']
}
self._json_output = options['json-output']
with os.fdopen(os.open(self._json_output, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o600), 'w') as fout:
with os.fdopen(os.open(self.options['json-output'], os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o600), 'w') as fout:
fout.write(json.dumps(parameter_dict, indent=2, sort_keys=True))
fout.close()
def install(self):
return [self._json_output]
return [self.options['json-output']]
update = install
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