Renamed /flavor to /flavors

When you do GET /v1
it returns the list of supported APIs with their links.
ie.
 "flavors" : [
    {
       "href" : "http://127.0.0.1:8181/v1/flavors/",
       "rel" : "self"
    },
    {
       "rel" : "bookmark",
       "href" : "http://127.0.0.1:8181/flavors/"
    }
but actually,
flavor apis are implemented at /flavor than /flavors.
Now /flavor has been renamed to /flavors.

This closes bug #1642801
Change-Id: I28297234561b06c22b6b083452368e3ba5c74e98
This commit is contained in:
praveenraj 2016-12-02 14:34:06 +05:30
parent 2e31ed68c7
commit e790b6e58d
10 changed files with 15 additions and 15 deletions

View File

@ -4,7 +4,7 @@
Flavors Flavors
============ ============
List, Searching of Flavors through the ``/v1/flavor`` List, Searching of Flavors through the ``/v1/flavors``
List Flavor List Flavor
@ -35,7 +35,7 @@ Response
Generate Flavor Generate Flavor
=============== ===============
.. rest_method:: POST /v1/flavor .. rest_method:: POST /v1/flavors
Normal response codes: 200 Normal response codes: 200
@ -64,7 +64,7 @@ Response
List Flavor criteria List Flavor criteria
===================== =====================
.. rest_method:: GET /v1/flavor/criteria .. rest_method:: GET /v1/flavors/criteria
Get all supported flavor generation criteria along with their description. Get all supported flavor generation criteria along with their description.

View File

@ -18,7 +18,7 @@ from flask_restful import Api
from valence.api import app as flaskapp from valence.api import app as flaskapp
from valence.api.root import PODMProxy from valence.api.root import PODMProxy
from valence.api.root import Root from valence.api.root import Root
from valence.api.v1.flavor import Flavors as v1Flavors from valence.api.v1.flavors import Flavors as v1Flavors
from valence.api.v1.nodes import Nodes as v1Nodes from valence.api.v1.nodes import Nodes as v1Nodes
from valence.api.v1.nodes import NodesList as v1NodesList from valence.api.v1.nodes import NodesList as v1NodesList
from valence.api.v1.nodes import NodesStorage as v1NodesStorage from valence.api.v1.nodes import NodesStorage as v1NodesStorage
@ -53,7 +53,7 @@ api.add_resource(v1SystemsList, '/v1/systems', endpoint='systems')
api.add_resource(v1Systems, '/v1/systems/<string:systemid>', endpoint='system') api.add_resource(v1Systems, '/v1/systems/<string:systemid>', endpoint='system')
# Flavor(s) operations # Flavor(s) operations
api.add_resource(v1Flavors, '/v1/flavor', endpoint='flavor') api.add_resource(v1Flavors, '/v1/flavors', endpoint='flavors')
# Storage(s) operations # Storage(s) operations

View File

@ -17,7 +17,7 @@ import logging
from flask import request from flask import request
from flask_restful import Resource from flask_restful import Resource
from valence.flavor import flavor from valence.flavors import flavors
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -25,9 +25,9 @@ LOG = logging.getLogger(__name__)
class Flavors(Resource): class Flavors(Resource):
def get(self): def get(self):
LOG.debug("GET /flavor") LOG.debug("GET /flavors")
return flavor.get_available_criteria() return flavors.get_available_criteria()
def post(self): def post(self):
LOG.debug("POST /flavor") LOG.debug("POST /flavors")
return flavor.create_flavors(request.get_json()) return flavors.create_flavors(request.get_json())

View File

@ -29,7 +29,7 @@ def get_available_criteria():
and not f.startswith('__') and f.endswith('.py')] and not f.startswith('__') and f.endswith('.py')]
resp = [] resp = []
for filename in pluginfiles: for filename in pluginfiles:
module = import_module("valence.flavor.plugins." + filename) module = import_module("valence.flavors.plugins." + filename)
myclass = getattr(module, filename + 'Generator') myclass = getattr(module, filename + 'Generator')
inst = myclass([]) inst = myclass([])
resp.append({'name': filename, 'description': inst.description()}) resp.append({'name': filename, 'description': inst.description()})
@ -48,7 +48,7 @@ def create_flavors(data):
for criteria_name in criteria.split(","): for criteria_name in criteria.split(","):
if criteria_name: if criteria_name:
LOG.info("Calling generator : %s ." % criteria_name) LOG.info("Calling generator : %s ." % criteria_name)
module = __import__("valence.flavor.plugins." + criteria_name, module = __import__("valence.flavors.plugins." + criteria_name,
fromlist=["*"]) fromlist=["*"])
classobj = getattr(module, criteria_name + "Generator") classobj = getattr(module, criteria_name + "Generator")
inst = classobj(lst_systems) inst = classobj(lst_systems)

View File

@ -14,7 +14,7 @@
import logging import logging
import re import re
from valence.flavor.generatorbase import generatorbase from valence.flavors.generatorbase import generatorbase
LOG = logging.getLogger() LOG = logging.getLogger()

View File

@ -13,7 +13,7 @@
# under the License. # under the License.
import logging import logging
from valence.flavor.generatorbase import generatorbase from valence.flavors.generatorbase import generatorbase
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -13,7 +13,7 @@
# under the License. # under the License.
import logging import logging
from valence.flavor.generatorbase import generatorbase from valence.flavors.generatorbase import generatorbase
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)