Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disk device options #14

Merged
merged 4 commits into from
Aug 18, 2020
Merged

Conversation

Glutexo
Copy link
Collaborator

@Glutexo Glutexo commented Aug 12, 2020

Added a constraint for /disk_devices/options. In Marshmallow we require all keys to be non-empty strings, including those of the nested objects. The new constraint does exactly this.

Examples of invalid payloads:

  "disk_devices": [
    {
      "type": "ext3",
      "label": "home drive",
      "device": "/dev/sdb1",
      "options": {
        "ro": true,
        "uid": "0",
        "": "thou shall not pass"
      },
      "mount_point": "/home"
    }
  ],
  "disk_devices": [
    {
      "type": "ext3",
      "label": "home drive",
      "device": "/dev/sdb1",
      "options": {
        "ro": true,
        "uid": "0",
        "nested": {
            "this": "is fine",
            "": "is not"
        }
      },
      "mount_point": "/home"
    }
  ],

Used propertyNames to describe non-empty kes for
/disk_devices/options. This is compatible with Draft >=6 only.
/disk_devices/options is an arbitrary object that does not allow empty
string keys. This constraint applies to all nested objects. Created a NestedObject entity that recursively defines this constraint.
@Glutexo
Copy link
Collaborator Author

Glutexo commented Aug 17, 2020

Conquered the linter. There really was a missing description. Fixed.

@jharting jharting merged commit f60f9fb into RedHatInsights:master Aug 18, 2020
@Glutexo Glutexo deleted the disk_device_options branch August 19, 2020 11:57
@Glutexo
Copy link
Collaborator Author

Glutexo commented Aug 19, 2020

In the end, the recursion introduced in this pull request caused a problem. prance is unfortunately unable to dereference the system profile schema if it contains recursion like this. The reason is that first the internal references in a referenced file are converted to file references and are no longer considered internal.

@Glutexo
Copy link
Collaborator Author

Glutexo commented Aug 19, 2020

It actually makes perfect sense. It is not possible to keep the local references, because the references schemas are no longer locally available. It would be possible to insert them somewhere locally and then convert the local reference path. Prance however does not do this.

Created an issue for prance to ask the author what does he think about this. RonnyPfannschmidt/prance#77 We can’t however expect this to be resolved by the library. My suggestion is to ditch prance and dereference manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants