oslopolicy-convert-json-to-yaml

Warning

Theoslopolicy-convert-json-to-yaml tool is deprecated, and will beremoved in a future release, because json format of policy files is nolonger supported.

Synopsis

oslopolicy-convert-json-to-yaml[-h][--config-dirDIR][--config-filePATH][--namespaceNAMESPACE][--policy-filePOLICY_FILE][--output-fileOUTPUT_FILE]

Description

Theoslopolicy-convert-json-to-yaml tool can be used to convert the JSONformat policy file to YAML format. It takes JSON formatted policy file as inputand convert it to a YAML formatted policy file similar tooslopolicy-sample-generator tool except keeping the overridden ruleas uncommented. It does the following:

  • Comment out any rules that match the default from policy-in-code.

  • Keep rules uncommented if rule is overridden.

  • Does not auto add the deprecated rules in the file unless it not alreadypresent in the file.

  • Keep any extra rules or already exist deprecated rules uncommentedbut at the end of the file with a warning text.

When to use:

Oslo policy still support the policy file in JSON format, but that lead tomultiple issues .One of the key issue came up while nova switched to the new policy with newdefaults and scope feature from keystone.Referthis bug for details.

In future release, oslo policy will remove the JSON formatted policyfile support and to have a smooth migration to YAML formatted policy fileyou can use this tool to convert your existing JSON formatted file to YAMLfile.

Options

-h,--help

Show help message and exit.

--config-dirDIR

Path to a config directory to pull*.conf files from. This file set issorted, so as to provide a predictable parse order if individual optionsare overridden. The set is parsed after the file(s) specified via previous--config-file, arguments hence overridden options in the directorytake precedence.

This option must be set from the command-line.

--config-filePATH

Path to a config file to use. Multiple config files can be specified, withvalues in later files taking precedence. Defaults to None. This option mustbe set from the command-line.

--output-fileOUTPUT_FILE

Path of the file to write to. Defaults to stdout.

--exclude-deprecatedTrue

Option allowing the rendered output to be generatedwithout deprecatedpolicy information.

--namespaceNAMESPACE

Option namespace(s) under “oslo.policy.policies” in which to query foroptions.

--policy-filePOLICY_FILE

Path to the policy file which need to be converted toyaml format.

Examples

To convert a JSON policy file for a namespace calledkeystone:

oslopolicy-convert-json-to-yaml--namespacekeystone\--policy-filekeystone-policy.json

To convert a JSON policy file to yaml format directly to a file:

oslopolicy-convert-json-to-yaml--namespacekeystone\--policy-filekeystone-policy.json\--output-filekeystone-policy.yaml

Use the following to generate help text for additional options and argumentssupported byoslopolicy-convert-json-to-yaml:

oslopolicy-convert-json-to-yaml--help

See Also

oslopolicy-sample-generator,oslopolicy-policy-generator,oslopolicy-upgrade