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