4438b8fd55
This commit enables the check of new pylint/pep8 violations. PYLINT - All convention related checks, except: - missing-class-docstring - missing-function-docstring - missing-module-docstring - consider-using-f-string - invalid-name - import-outside-toplevel - too-many-lines - consider-iterating-dictionary - unnecessary-lambda-assignment PEP8: - E117: over-indented - E123: closing bracket does not match indentation of opening bracket's line - E125: continuation line with the same indent as the next logical line - E305: expected 2 blank lines after class or function definition - E402: module level import not at top of file - E501: line too long - H216: flag use of third party mock Test Plan: 1. Perform `tox` command - Pass in py39, pylint, pep8 Closes-bug: 2033294 Change-Id: I635df8e809905cff582bd9d5eb57b91133560cf9 Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
60 lines
1.8 KiB
Python
60 lines
1.8 KiB
Python
# Copyright (c) 2015 Huawei Tech. Co., Ltd.
|
|
# Copyright (c) 2017, 2019, 2021, 2024 Wind River Systems, Inc.
|
|
# All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
#
|
|
|
|
|
|
import pecan
|
|
|
|
from dcmanager.api.controllers.v1 import root as v1_root
|
|
|
|
|
|
class RootController(object):
|
|
|
|
@pecan.expose('json')
|
|
def _lookup(self, version, *remainder):
|
|
version = str(version)
|
|
minor_version = version[-1]
|
|
major_version = version[1]
|
|
remainder = remainder + (minor_version,)
|
|
if major_version == '1':
|
|
return v1_root.Controller(), remainder
|
|
|
|
@pecan.expose(generic=True, template='json')
|
|
def index(self):
|
|
return {
|
|
"versions": [
|
|
{
|
|
"status": "CURRENT",
|
|
"links": [
|
|
{
|
|
"rel": "self",
|
|
"href": pecan.request.application_url + "/v1.0/"
|
|
}
|
|
],
|
|
"id": "v1.0",
|
|
"updated": "2017-10-2"
|
|
}
|
|
]
|
|
}
|
|
|
|
@index.when(method='POST')
|
|
@index.when(method='PUT')
|
|
@index.when(method='DELETE')
|
|
@index.when(method='HEAD')
|
|
@index.when(method='PATCH')
|
|
def not_supported(self):
|
|
pecan.abort(405)
|