Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Commit

Permalink
Merge "Pass all args to resource and allow dumping as a yaml"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed Feb 29, 2016
2 parents 80ca0e1 + 290146d commit 24d6c3b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion solar/core/handlers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,9 @@ def _make_args(self, resource):
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


Expand Down
7 changes: 7 additions & 0 deletions solar/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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):
Expand Down

0 comments on commit 24d6c3b

Please sign in to comment.