← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1821764] Re: docs: JsonFilter query hint examples do not use valid json strings

 

Reviewed:  https://review.openstack.org/647778
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=45cecbb427a82568ea25b4d6dbb2ab32518a9a9f
Submitter: Zuul
Branch:    master

commit 45cecbb427a82568ea25b4d6dbb2ab32518a9a9f
Author: Matt Riedemann <mriedem.os@xxxxxxxxx>
Date:   Tue Mar 26 11:37:27 2019 -0400

    Fix JsonFilter query hint examples in docs
    
    The API reference and part of the scheduler filter docs for
    the JsonFilter query hint are using invalid json strings
    in the examples.
    
    This fixes both invalid locations using the same json string
    used in the openstack server create command example in the
    scheduler admin docs.
    
    Change-Id: Iaab8608c7ffa6fbbea40a838dd02d8096f632f7a
    Closes-Bug: #1821764


** Changed in: nova
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1821764

Title:
  docs: JsonFilter query hint examples do not use valid json strings

Status in OpenStack Compute (nova):
  Fix Released

Bug description:
  This is wrong in a few places.

  1. The server create API reference:

  https://developer.openstack.org/api-ref/compute/?expanded=create-
  server-detail#create-server

  "query": "[&gt;=,$free_ram_mb,1024]"

  >>> json.loads("[&gt;=,$free_ram_mb,1024]")
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/usr/lib/python2.7/json/__init__.py", line 339, in loads
      return _default_decoder.decode(s)
    File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
      obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
      raise ValueError("No JSON object could be decoded")
  ValueError: No JSON object could be decoded

  2. The scheduler filter docs:

  https://docs.openstack.org/nova/latest/admin/configuration/schedulers.html#jsonfilter

  The command line example is OK, but the API request is wrong:

  >>> json.loads("[>=,$free_ram_mb,1024]")
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/usr/lib/python2.7/json/__init__.py", line 339, in loads
      return _default_decoder.decode(s)
    File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
      obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
      raise ValueError("No JSON object could be decoded")
  ValueError: No JSON object could be decoded

  
  The docs should probably just be consistent and use the same example that works from the openstack server create command example:

  '[">=","$free_ram_mb",1024]'

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1821764/+subscriptions


References