Public bug reported:

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": "[>=,$free_ram_mb,1024]"

>>> 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

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]'

** Affects: nova
     Importance: Medium
     Assignee: Matt Riedemann (mriedem)
         Status: In Progress


** Tags: api-ref docs scheduler

-- 
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):
  In Progress

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

-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to     : yahoo-eng-team@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to