New issue
Advanced search Search tips

Issue 827831 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

yaml validation is too verbose

Project Member Reported by sjg@chromium.org, Apr 1 2018

Issue description

I got the following error when adding something to the test.yaml file. For comparison the device tree validator says:

 * Validating master configuration binding
README.md:
/chromeos/models/sand: Unexpected subnode 'ui', valid list is (firmware, audio, arc, power, submodels, thermal, touch, whitelabels)


yaml version:


ERROR: testMainWithExample (cros_config_host.cros_config_schema_unittest.MainTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/mnt/host/source/src/platform2/chromeos-config/cros_config_host/cros_config_schema_unittest.py", line 218, in testMainWithExample
    output)
  File "/mnt/host/source/src/platform2/chromeos-config/cros_config_host/cros_config_schema.py", line 388, in Main
    ValidateConfigSchema(schema_stream.read(), json_transform)
  File "/mnt/host/source/src/platform2/chromeos-config/cros_config_host/cros_config_schema.py", line 343, in ValidateConfigSchema
    validate(json_config, schema_json)
  File "/usr/lib64/python2.7/site-packages/jsonschema/validators.py", line 432, in validate
    cls(schema, *args, **kwargs).validate(instance)
  File "/usr/lib64/python2.7/site-packages/jsonschema/validators.py", line 117, in validate
    raise error
ValidationError: Additional properties are not allowed (u'ui' was unexpected)

Failed validating u'additionalProperties' in schema[u'properties'][u'chromeos'][u'properties'][u'models'][u'items']:
    {u'additionalProperties': False,
     u'properties': {u'arc': {u'additionalProperties': False,
                              u'properties': {u'build-properties': {u'additionalProperties': False,
                                                                    u'properties': {u'device': {u'description': u"Device name to report in 'ro.product.device'. This\nis often '{product}_cheets' but it can be something else if\ndesired.\n",
                                                                                                u'type': u'string'},
                                                                                    u'marketing-name': {u'description': u"Name of this model as it is called in the\nmarket, reported in 'ro.product.model'. This often starts\nwith '{oem}'.\n",
                                                                                                        u'type': u'string'},
                                                                                    u'metrics-tag': {u'description': u"Tag to use to track metrics for this model.\nThe tag can be shared across many models if desired, but\nthis will result in larger granularity for metrics\nreporting.  Ideally the metrics system should support\ncollation of metrics with different tags into groups, but if\nthis is not supported, this tag can be used to achieve the\nsame end.  This is reported in 'ro.product.metrics.tag'.\n",
                                                                                                     u'type': u'string'},
                                                                                    u'oem': {u'description': u'Original Equipment Manufacturer for this model. This\ngenerally means the OEM name printed on the device.\n',
                                                                                             u'type': u'string'},
                                                                                    u'product': {u'description': u"Product name to report in 'ro.product.name'.\nThis may be the model name, or it can be something else, to allow\nseveral models to be grouped into one product.\n",
                                                                                                 u'type': u'string'}},
                                                                    u'type': u'object'},
                                              u'files': {u'items': {u'additionalProperties': False,
                                                                    u'properties': {u'destination': {u'description': u'Installation path for the file on the system image.',
                                                                                                     u'type': u'string'},
                                                                                    u'source': {u'description': u'Source of the file relative to the build system.',
                                                                                                u'type': u'string'}},
                                                                    u'type': u'object'},
                                                         u'type': u'array'}},
                              u'required': [u'build-properties'],
                              u'type': u'object'},
                     u'audio': {u'additionalProperties': False,
                                u'properties': {u'main': {u'additionalProperties': False,
                                                          u'properties': {u'cras-config-dir': {u'description': u'Subdirectory for model-specific configuration.',
                                                                                               u'type': u'string'},
                                                                          u'disable-profile': {u'description': u'Optional --disable_profile parameter for CRAS deamon.',
                                                                                               u'type': u'string'},
                                                                          u'files': {u'items': {u'additionalProperties': False,
                                                                                                u'properties': {u'destination': {u'description': u'Installation path for the file on the system image.',
                                                                                                                                 u'type': u'string'},
                                                                                                                u'source': {u'description': u'Source of the file relative to the build system.',
                                                                                                                            u'type': u'string'}},
                                                                                                u'type': u'object'},
                                                                                     u'type': u'array'},
                                                                          u'ucm-suffix': {u'description': u'Optional UCM suffix used to determine model specific config.',
                                                                                          u'type': u'string'}},
                                                          u'required': [u'cras-config-dir'],
                                                          u'type': u'object'}},
                                u'required': [u'main'],
                                u'type': u'object'},
                     u'brand-code': {u'description': u'Brand code of the model (also called RLZ code).',
                                     u'pattern': u'^[A-Z]{4}$',
                                     u'type': u'string'},
                     u'firmware': {u'additionalProperties': False,
                                   u'properties': {u'bcs-overlay': {u'description': u'BCS overlay path used to determine BCS file path for binary firmware downloads.',
                                                                    u'type': u'string'},
                                                   u'build-targets': {u'additionalProperties': False,
                                                                      u'properties': {u'coreboot': {u'description': u'Build target that will be considered dirty when building/testing locally.',
                                                                                                    u'type': u'string'},
                                                                                      u'cr50': {u'description': u'Build target that will be considered dirty when building/testing locally.',
                                                                                                u'type': u'string'},
                                                                                      u'depthcharge': {u'description': u'Build target that will be considered dirty when building/testing locally.',
                                                                                                       u'type': u'string'},
                                                                                      u'ec': {u'description': u'Build target that will be considered dirty when building/testing locally.',
                                                                                              u'type': u'string'},
                                                                                      u'libpayload': {u'description': u'Build target that will be considered dirty when building/testing locally.',
                                                                                                      u'type': u'string'}},
                                                                      u'type': u'object'},
                                                   u'ec-image': {u'description': u'Name of the file located in BCS under the respective bcs-overlay.',
                                                                 u'type': u'string'},
                                                   u'key-id': {u'description': u'Key ID from the signer key set that is used to sign the given firmware image.',
                                                               u'pattern': u'^[A-Z|_|0-9]*$',
                                                               u'type': u'string'},
                                                   u'main-image': {u'description': u'Name of the file located in BCS under the respective bcs-overlay.',
                                                                   u'type': u'string'},
                                                   u'main-rw-image': {u'description': u'Name of the file located in BCS under the respective bcs-overlay.',
                                                                      u'type': u'string'},
                                                   u'no-firmware': {u'description': u'If present this indicates that this model has no firmware at present.\nThis means that it will be omitted from the firmware updater\n(chromeos-firmware- ebuild) and it will not be included in the signer\ninstructions file sent to the signer.\nThis option is often useful when a model is first added,\nsince it may not have firmware at that point.\n',
                                                                    u'pattern': u'^[A-Z|_|0-9]*$',
                                                                    u'type': u'boolean'},
                                                   u'pd-image': {u'description': u'Name of the file located in BCS under the respective bcs-overlay.',
                                                                 u'type': u'string'}},
                                   u'type': u'object'},
                     u'firmware-signing': {u'additionalProperties': False,
                                           u'properties': {u'key-id': {u'description': u'Key ID from the signer key set that is used to sign the given firmware image.',
                                                                       u'pattern': u'^[A-Z|_|0-9]*$',
                                                                       u'type': u'string'},
                                                           u'sig-id-in-customization-id': {u'description': u'Indicates that this model cannot be decoded by the mapping table.\nInstead the model is stored in the VPD (Vital Product Data) region in the\ncustomization_id property. This allows us to determine the\nmodel to use in the factory during the finalization stage. Note\nthat if the VPD is wiped then the model will be lost. This may\nmean that the device will revert back to a generic model, or\nmay not work. It is not possible in general to test whether the\nmodel in the VPD is correct at run-time. We simply assume that\nit is. The advantage of using this property is that no hardware\nchanges are needed to change one model into another. For example\nwe can create 20 different whitelabel boards, all with the same\nhardware, just by changing the customization_id that is written\ninto SPI flash.\n',
                                                                                           u'type': u'boolean'}},
                                           u'type': u'object'},
                     u'identity': {u'additionalProperties': False,
                                   u'properties': {u'customization-id': {u'description': u'Customization ID set in the VPD during manufacturing.',
                                                                         u'pattern': u'^[A-Z|_]*$',
                                                                         u'type': u'string'},
                                                   u'platform-name': {u'description': u"Indicates the platform name for this platform. This is reported by 'mosys platform name'. It is typically the family name with the first letter capitalized.",
                                                                      u'type': u'string'},
                                                   u'sku-id': {u'description': u'SKU/Board strapping pins configured during board manufacturing.',
                                                               u'type': u'integer'},
                                                   u'smbios-name-match': {u'description': u'Firmware name built into the firmware and reflected back out in the SMBIOS tables.',
                                                                          u'type': u'string'}},
                                   u'type': u'object'},
                     u'name': {u'description': u'Unique name for the given model.',
                               u'pattern': u'^[_a-zA-Z0-9]{3,}',
                               u'type': u'string'},
                     u'powerd-prefs': {u'description': u'Powerd config that should be used.',
                                       u'type': u'string'},
                     u'test-label': {u'description': u'Test alias (model) label that will be applied in Autotest and reported for test results.',
                                     u'type': u'string'},
                     u'thermal': {u'additionalProperties': False,
                                  u'properties': {u'files': {u'items': {u'additionalProperties': False,
                                                                        u'properties': {u'destination': {u'description': u'Installation path for the file on the system image.',
                                                                                                         u'type': u'string'},
                                                                                        u'source': {u'description': u'Source of the file relative to the build system.',
                                                                                                    u'type': u'string'}},
                                                                        u'type': u'object'},
                                                             u'type': u'array'}},
                                  u'required': [u'files'],
                                  u'type': u'object'},
                     u'touch': {u'additionalProperties': False,
                                u'properties': {u'files': {u'items': {u'additionalProperties': False,
                                                                      u'properties': {u'destination': {u'description': u'Installation path for the file on the system image.',
                                                                                                       u'type': u'string'},
                                                                                      u'source': {u'description': u'Source of the file relative to the build system ${FILESDIR}',
                                                                                                  u'type': u'string'},
                                                                                      u'symlink': {u'description': u'Symlink file that will be installed pointing to the destination.',
                                                                                                   u'type': u'string'}},
                                                                      u'type': u'object'},
                                                           u'type': u'array'},
                                                u'present': {u'description': u'Whether touch is present or needs to be probed for.',
                                                             u'enum': [u'yes',
                                                                       u'no',
                                                                       u'probe'],
                                                             u'type': u'string'},
                                                u'probe-regex': {u'description': u'If probe is set, the regex used to look for touch.',
                                                                 u'type': u'string'}},
                                u'type': u'object'},
                     u'wallpaper': {u'description': u'Base filename of the default wallpaper to show on this device.\n',
                                    u'type': u'string'}},
     u'required': [u'firmware', u'name'],
     u'type': u'object'}

On instance[u'chromeos'][u'models'][0]:
    {u'arc': {u'build-properties': {u'device': u'reef_cheets',
                                    u'marketing-name': u'Acer Chromebook Spin 11 (R751T)'},
              u'files': [{u'destination': u'/etc/hardware_features.xml',
                          u'source': u'hardware_features.xml'}]},
     u'audio': {u'main': {u'cras-config-dir': u'reef/ELECTRO',
                          u'files': [{u'destination': u'/etc/cras/reef/ELECTRO/bxtda7219max',
                                      u'source': u'cras-config/reef/ELECTRO/bxtda7219max'},
                                     {u'destination': u'/etc/cras/reef/ELECTRO/dsp.ini',
                                      u'source': u'cras-config/reef/ELECTRO/dsp.ini'},
                                     {u'destination': u'/usr/share/alsa/ucm/bxtda7219max.reef.ELECTRO/HiFi.conf',
                                      u'source': u'ucm-config/bxtda7219max.reef.ELECTRO/HiFi.conf'},
                                     {u'destination': u'/usr/share/alsa/ucm/bxtda7219max.reef.ELECTRO/bxtda7219max.reef.ELECTRO.conf',
                                      u'source': u'ucm-config/bxtda7219max.reef.ELECTRO/bxtda7219max.reef.ELECTRO.conf'},
                                     {u'destination': u'/lib/firmware/5a98-reef-reef-8-tplg.bin',
                                      u'source': u'topology/5a98-reef-reef-8-tplg.bin'}],
                          u'ucm-suffix': u'reef.ELECTRO'}},
     u'brand-code': u'ACBB',
     u'firmware': {u'bcs-overlay': u'overlay-reef-private',
                   u'build-targets': {u'coreboot': u'reef',
                                      u'cr50': u'cr50',
                                      u'depthcharge': u'reef',
                                      u'ec': u'reef',
                                      u'libpayload': u'reef'},
                   u'ec-image': u'bcs://Reef_EC.9042.87.1.tbz2',
                   u'main-image': u'bcs://Reef.9042.87.1.tbz2',
                   u'main-rw-image': u'bcs://Reef.9042.110.0.tbz2'},
     u'firmware-signing': {u'key-id': u'PARMA'},
     u'identity': {u'platform-name': u'Reef',
                   u'sku-id': 8,
                   u'smbios-name-match': u'Reef'},
     u'name': u'electro',
     u'powerd-prefs': u'reef',
     u'test-label': u'reef',
     u'touch': {u'files': [{u'destination': u'/opt/google/touch/firmware/wacom/wacom_1636.hex',
                            u'source': u'wacom/wacom_1636.hex',
                            u'symlink': u'/lib/firmware/wacom_firmware_ELECTRO.hex'},
                           {u'destination': u'/opt/google/touch/firmware/elan/154.0_2.0.bin',
                            u'source': u'elan/154.0_2.0.bin',
                            u'symlink': u'/lib/firmware/elan_i2c_154.0.bin'},
                           {u'destination': u'/opt/google/touch/firmware/1cd2_5603.bin',
                            u'source': u'1cd2_5603.bin',
                            u'symlink': u'/lib/firmware/elants_i2c_1cd2.bin'}],
                u'present': u'probe',
                u'probe-regex': u'[Tt]ouchscreen|WCOMNTN2'},
     u'ui': {u'power-button': {u'edge': u'left', u'position': u'0.3'}}}

----------------------------------------------------------------------
Ran 91 tests in 7.935s

FAILED (errors=1)


 

Comment 1 by sjg@chromium.org, Apr 25 2018

Another case here, not as bad but painful to read:

 * Adding source YAML file /build/grunt/usr/share/chromeos-config/yaml/private-files.yaml
Traceback (most recent call last):
  File "/usr/lib/python-exec/python2.7/cros_config_schema", line 9, in <module>
    load_entry_point('cros-config-host==1', 'console_scripts', 'cros_config_schema')()
  File "/usr/lib64/python2.7/site-packages/cros_config_host/cros_config_schema.py", line 580, in main
    args.generated_c_output)
  File "/usr/lib64/python2.7/site-packages/cros_config_host/cros_config_schema.py", line 530, in Main
    full_json_transform = TransformConfig(config_stream.read())
  File "/usr/lib64/python2.7/site-packages/cros_config_host/cros_config_schema.py", line 275, in TransformConfig
    _ApplyTemplateVars(template_vars, template_vars)
  File "/usr/lib64/python2.7/site-packages/cros_config_host/cros_config_schema.py", line 211, in _ApplyTemplateVars
    template_vars)
  File "/usr/lib64/python2.7/site-packages/cros_config_host/cros_config_schema.py", line 164, in _GetVarTemplateValue
    (template_var, val, template_input, template_vars))
cros_config_host.cros_config_schema.ValidationError: Referenced template variable '$key-id' doesn't exist string '{{$key-id}}'.
Input: {u'cras-config-dir': u'grunt', u'brand-code': u'TEST', u'ec': u'grunt', u'libpayload': u'grunt', u'platform-name': u'Grunt', u'$brand-code': u'TEST', u'first-api-level': u'25', u'coreboot': u'grunt', u'key-id': u'{{$key-id}}', u'depthcharge': u'grunt', u'product': u'grunt', u'$marketing-name': u'grunt', u'bcs-overlay': u'overlay-grunt-private', u'$ucm_root': u'/usr/share/alsa/ucm', u'device': u'grunt_cheets', u'$device-name': u'grunt', u'$card': u'acpd7219m98357', u'name': u'{{$device-name}}', u'ec-image': u'bcs://Grunt_EC.10528.0.0.tbz2', u'signature-id': u'{{name}}', u'$cras_root': u'/etc/cras', u'main-image': u'bcs://Grunt.10528.0.0.tbz2', u'ucm-suffix': u'{{$device-name}}', u'marketing-name': u'{{$marketing-name}}', u'smbios-name-match': u'Grunt'}
Variables:{u'cras-config-dir': u'grunt', u'brand-code': u'TEST', u'ec': u'grunt', u'libpayload': u'grunt', u'platform-name': u'Grunt', u'$brand-code': u'TEST', u'first-api-level': u'25', u'coreboot': u'grunt', u'key-id': u'{{$key-id}}', u'depthcharge': u'grunt', u'product': u'grunt', u'$marketing-name': u'grunt', u'bcs-overlay': u'overlay-grunt-private', u'$ucm_root': u'/usr/share/alsa/ucm', u'device': u'grunt_cheets', u'$device-name': u'grunt', u'$card': u'acpd7219m98357', u'name': u'{{$device-name}}', u'ec-image': u'bcs://Grunt_EC.10528.0.0.tbz2', u'signature-id': u'{{name}}', u'$cras_root': u'/etc/cras', u'main-image': u'bcs://Grunt.10528.0.0.tbz2', u'ucm-suffix': u'{{$device-name}}', u'marketing-name': u'{{$marketing-name}}', u'smbios-name-match': u'Grunt'}
Warning: Validation failed


Status: Assigned (was: Untriaged)
This bug has an owner, thus, it's been triaged. Changing status to "assigned".

Sign in to add a comment