Merge lp://qastaging/~dooferlad/linaro-image-tools/yaml-checker into lp://qastaging/linaro-image-tools/11.11
Proposed by
James Tunnicliffe
Status: | Merged |
---|---|
Merged at revision: | 544 |
Proposed branch: | lp://qastaging/~dooferlad/linaro-image-tools/yaml-checker |
Merge into: | lp://qastaging/linaro-image-tools/11.11 |
Diff against target: | 0 lines |
To merge this branch: | bzr merge lp://qastaging/~dooferlad/linaro-image-tools/yaml-checker |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Milo Casagrande (community) | Approve | ||
Review via email: mp+117298@code.qastaging.launchpad.net |
Description of the change
Adds checking to make sure that V3 metadata files contain only keys that we expect, where we expect them.
To post a comment you must log in.
Hello James,
thanks for working on this!
On Mon, Jul 30, 2012 at 7:04 PM, James Tunnicliffe keys(self) :
<email address hidden> wrote:
> +
> + def _validate_
> + """Check the dictionary created by the YAML parser for unknown keys"""
> +
> + if not self._is_v3:
> + # We don't check V1 or V2 configurations in this way
> + return
> +
Actually this is nothing wrong, but I'm used to think in terms of
positive check, so I would have treated only the "if _is_v3". But
that's personal thinkging. :-)
> + # Create a layout that represents where keys are allowed. keys_layout = { FIELD: None, INSTALLED_ FIELD: None, OPTIONS_ FIELD: None, LAYOUT_ FIELD: None, S_FIELD: None, INTERFACES_ FIELD: None, SIZE_FIELD: None, SIZE_FIELD: None, MIN_SIZE_ FIELD: None, BL1_LEN_ FIELD: None, BL1_LEN_ FIELD: None, ENV_LEN_ FIELD: None, BL2_LEN_ FIELD: None, STARTUP_ FILES_CONFIG_ FIELD: None, OPTIONS_ FIELD: None, BOOT_PART_ FIELD: None,
> + # If a key has a value None, this indicates there is either a value or
> + # list of values that can be associated with it.
> + # If a key contains a dictionary, this means that the key can
> + # contain a dictionary.
> + # The string "root" indicates that the key can contain the root
> + # structure. This is used for the boards section, where each
> + # board can contain the full or partial layout, overwriting the global
> + # settings.
> + self._validate_
> + FORMAT_FIELD: None,
> + NAME_FIELD: None,
> + ARCHITECTURES_
> + ORIGIN_FIELD: None,
> + MAINTAINER_FIELD: None,
> + SUPPORT_FIELD: None,
> + ASSUME_
> + INCLUDE_DEBS_FIELD: None,
> + DTB_FILE_FIELD: None,
> + DTB_ADDR_FIELD: None,
> + SERIAL_TTY_FIELD: None,
> + EXTRA_SERIAL_
> + MMC_ID_FIELD: None,
> + PACKAGES_FIELD: None,
> + PARTITION_
> + KERNEL_FILE_FIELD: None,
> + KERNEL_ADDR_FIELD: None,
> + INITRD_FILE_FIELD: None,
> + INITRD_ADDR_FIELD: None,
> + LOAD_ADDR_FIELD: None,
> + BOOT_SCRIPT_FIELD: None,
> + LOADER_START_FIELD: None,
> + WIRED_INTERFACE
> + WIRELESS_
> + BOOT_MIN_
> + ROOT_MIN_
> + LOADER_
> + SAMSUNG_
> + SAMSUNG_
> + SAMSUNG_
> + SAMSUNG_
> + SNOWBALL_
> + SOURCES_FIELD: None,
> + BOOTLOADERS_FIELD: {
> + "*": {
> + PACKAGE_FIELD: None,
> + FILE_FIELD: None,
> + IN_BOOT_PART_FIELD: None,
> + DD_FIELD: None,
> + EXTRA_BOOT_
> + SPL_PACKAGE_FIELD: None,
> + SPL_FILE_FIELD: None,
> + SPL_IN_
> + SPL_DD_FIELD: None,
> + ENV_DD_FIELD: None,
> + }
> + },
> + BOARDS_FIELD: "root",
> + }
> +
I was thinking if it might be worth to move this structure inside the
h...