On Wed, Apr 18, 2018 at 08:58:00AM +0200, Markus Armbruster wrote: > Eduardo Habkost <ehabk...@redhat.com> writes: > > > On Tue, Apr 17, 2018 at 02:01:53PM +0200, Markus Armbruster wrote: > >> Eduardo Habkost <ehabk...@redhat.com> writes: > [...] > >> > + command-line: '$QEMU -nodefaults -machine none' > >> > + monitor-commands: > >> > + - qmp: > >> > + - execute: qom-list-types > >> > + arguments: > >> > + implements: 'device' > >> > + abstract: true > >> > + - hmp: 'device_add help' > [...] > >> > +monitor-commands > >> > +~~~~~~~~~~~~~~~~ > >> > + > >> > +Mapping or list-of-mappings containing monitor commands to run. > > http://yaml.org/spec/1.2/spec.html talks about mappings and sequences. > Recommend to say "sequence" rather than "list".
Noted. > > I can't see how sequences come into play. Your example's > monitor-command is a mapping, not a sequence of mappings. Am I > confused? The example is supposed to be a sequence of mappings. > > >> > The > >> > key on each > >> > +item can be ``hmp`` or ``qmp``. The value on each entry can be a > >> > string, > >> > +mapping, or list. > >> > + > >> > +Default: None. > [...] > >> Can I do > >> > >> monitor-commands: > >> - qmp: > >> - execute: eins > >> - hmp: zwei > >> - qmp: > >> - execute: drei > >> > >> to execute eins, zwei, drei in this order? > > > > Yes, it can. See the test specification examples. > > I asked because the YAML spec I quoted above says mappings are unordered > and must be unique. My example violates "unique", and your "yes, it > can" violates "unordered". > > [...] The above is a sequence of one-key mappings. This is a (not very useful) mapping: >>> yaml.load(""" ... qmp: ... - execute: eins ... hmp: zwei ... """) {'qmp': [{'execute': 'eins'}], 'hmp': 'zwei'} This is a sequence of one-key mappings: >>> yaml.load(""" ... - qmp: ... - execute: eins ... - hmp: zwei ... - qmp: ... - execute: drei ... """) [{'qmp': [{'execute': 'eins'}]}, {'hmp': 'zwei'}, {'qmp': [{'execute': 'drei'}]}] >>> -- Eduardo