Merge "Pass all args to resource and allow dumping as a yaml"

This commit is contained in:
Jenkins 2016-02-29 16:58:50 +00:00 committed by Gerrit Code Review
commit 24d6c3b901
2 changed files with 10 additions and 1 deletions

View File

@ -174,7 +174,9 @@ class TempFileHandler(BaseHandler):
args['resource_dir'] = resource.db_obj.base_path
args['templates_dir'] = 'templates/'
args['scripts_dir'] = 'scripts/'
args.update(resource.args)
resource_args = resource.args
args['resource_args'] = resource_args
args.update(resource_args)
return args

View File

@ -39,6 +39,12 @@ def to_pretty_json(data):
return json.dumps(data, indent=4)
def to_nice_yaml(data):
data = yaml.safe_dump(data, indent=4, allow_unicode=True,
default_flow_style=False)
return data
def communicate(command, data):
popen = subprocess.Popen(
command,
@ -63,6 +69,7 @@ def execute(command, shell=False, env=None):
jinja_env_with_filters = Environment()
jinja_env_with_filters.filters['to_json'] = to_json
jinja_env_with_filters.filters['to_pretty_json'] = to_pretty_json
jinja_env_with_filters.filters['to_nice_yaml'] = to_nice_yaml
def create_dir(dir_path):