schema_args: Do not generate option for read-only properties

The schema_args decorator generates command line options based on the
properties defined in a schema. This commit makes sure read-only
properties are skipped during this process, since trying to modify their
value would result in a Glance error.

Closes-Bug: #1561828
Change-Id: I7ccc628a23c9ebdaeedcb9e6d43559f497ce9555
This commit is contained in:
Cyril Roelandt
2022-09-20 18:05:33 +02:00
parent 9e8fcdb92e
commit 74fa436657
3 changed files with 15 additions and 19 deletions
+2
View File
@@ -123,6 +123,8 @@ def schema_args(schema_getter, omit=None):
for name, property in properties.items():
if name in omit:
continue
if property.get('readOnly', False):
continue
param = '--' + name.replace('_', '-')
kwargs = {}