oslopolicy-sample-generator [-h] [--config-dir DIR]
                            [--config-file PATH] [--format FORMAT]
                            [--namespace NAMESPACE]
                            [--output-file OUTPUT_FILE]


The oslopolicy-sample-generator command can be used to generate a sample policy file based on the default policies in a given namespace. This tool requires a namespace to query for policies and supports output in JSON or YAML.


-h, --help

Show help message and exit.

--config-dir DIR

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

This option must be set from the command-line.

--config-file PATH

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

--format FORMAT

Desired format for the output. Allowed values: json, yaml

--namespace NAMESPACE

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

--output-file OUTPUT_FILE

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

--exclude-deprecated True

Option allowing the rendered output to be generated without deprecated policy information.


To generate sample policies for a namespace called keystone:

oslopolicy-sample-generator --namespace keystone

To generate sample policies in JSON use:

oslopolicy-sample-generator --namespace keystone --format json

To generate a sample policy file and output directly to a file:

oslopolicy-sample-generator --namespace keystone \
  --format yaml \
  --output-file keystone-policy.yaml

Use the following to generate help text for additional options and arguments supported by oslopolicy-sample-generator:

oslopolicy-sample-generator --help

See Also

oslopolicy-policy-generator, oslopolicy-list-redundant, oslopolicy-checker