1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
===============================
oslopolicy-convert-json-to-yaml
===============================
.. program:: oslopolicy-convert-json-to-yaml
Synopsis
--------
::
oslopolicy-convert-json-to-yaml [-h] [--config-dir DIR] [--config-file PATH]
[--namespace NAMESPACE]
[--policy-file POLICY_FILE]
[--output-file OUTPUT_FILE]
Description
-----------
The ``oslopolicy-convert-json-to-yaml`` tool can be used to convert the JSON
format policy file to YAML format. It takes JSON formatted policy file as input
and convert it to a YAML formatted policy file similar to
``oslopolicy-sample-generator`` tool except keeping the overridden rule
as 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 already
present in the file.
* Keep any extra rules or already exist deprecated rules uncommented
but 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 to
`multiple issues <https://specs.openstack.org/openstack/oslo-specs/specs/victoria/policy-json-to-yaml.html#problem-description>`_ .
One of the key issue came up while nova switched to the new policy with new
defaults and scope feature from keystone.
Refer `this bug <https://bugs.launchpad.net/nova/+bug/1875418>`_ for details.
In future release, oslo policy will remove the JSON formatted policy
file support and to have a smooth migration to YAML formatted policy file
you can use this tool to convert your existing JSON formatted file to YAML
file.
Options
-------
.. include:: common/default-opts.rst
.. include:: common/generator-opts.rst
.. include:: common/convert-opts.rst
Examples
--------
To convert a JSON policy file for a namespace called ``keystone``:
.. code-block:: bash
oslopolicy-convert-json-to-yaml --namespace keystone \
--policy-file keystone-policy.json
To convert a JSON policy file to yaml format directly to a file:
.. code-block:: bash
oslopolicy-convert-json-to-yaml --namespace keystone \
--policy-file keystone-policy.json \
--output-file keystone-policy.yaml
Use the following to generate help text for additional options and arguments
supported by ``oslopolicy-convert-json-to-yaml``:
.. code-block:: bash
oslopolicy-convert-json-to-yaml --help
See Also
--------
:program:`oslopolicy-sample-generator`, :program:`oslopolicy-policy-generator`, :program:`oslopolicy-upgrade`
|