diff --git a/openshift/README.md b/openshift/README.md index 5ba0a5b2..45abbafd 100644 --- a/openshift/README.md +++ b/openshift/README.md @@ -4,7 +4,7 @@ OpenShift provides builds, application lifecycle, image content management, and This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: - API version: latest -- Package version: 0.4.1 +- Package version: 0.4.2 - Build package: io.swagger.codegen.languages.PythonClientCodegen ## Requirements. diff --git a/openshift/__init__.py b/openshift/__init__.py index 75d5ce42..673c7c9e 100644 --- a/openshift/__init__.py +++ b/openshift/__init__.py @@ -18,5 +18,5 @@ # Do not edit these constants. They will be updated automatically # by scripts/update-client.sh. -__version__ = "0.4.1" +__version__ = "0.4.2" __k8s_client_version__ = "4.0.0" diff --git a/openshift/helper/base.py b/openshift/helper/base.py index 21cd8049..c7473f42 100644 --- a/openshift/helper/base.py +++ b/openshift/helper/base.py @@ -411,9 +411,10 @@ def properties_from_model_class(cls, model_class): return result def candidate_apis(self): + api_match = self.api_version.replace('/', '_').lower() return [ api for api in self.available_apis() - if self.api_version in self.attribute_to_snake(api) + if api_match in self.attribute_to_snake(api) or not VERSION_RX.match(api) ] @@ -433,7 +434,6 @@ def lookup_method(self, operation=None, namespace=None, method_name=None): method = None for api in self.candidate_apis(): api_class = self.api_class_from_name(api) - method = getattr(api_class(self.api_client), method_name, None) if method is not None: break @@ -487,8 +487,13 @@ def get_model(self, api_version, kind): :param kind: The name of object type (i.e. Service, Route, Container, etc.) :return: class """ + + # Handle API paths. In the case of 'batch/', remove it completely, otherwise, replace '/' with '_'. + api = re.sub(r'batch/', '', api_version, count=0, flags=re.IGNORECASE).replace('/', '_') + camel_kind = string_utils.snake_case_to_camel(kind) - camel_api_version = string_utils.snake_case_to_camel(api_version) + camel_api_version = string_utils.snake_case_to_camel(api) + # capitalize the first letter of the string without lower-casing the remainder name = (camel_kind[:1].capitalize() + camel_kind[1:]).replace("Api", "API") api = camel_api_version[:1].capitalize() + camel_api_version[1:] diff --git a/python-openshift.spec b/python-openshift.spec index 5eb79212..783d8ab4 100644 --- a/python-openshift.spec +++ b/python-openshift.spec @@ -3,7 +3,7 @@ %global library openshift Name: python-%{library} -Version: 0.4.1 +Version: 0.4.2 Release: 6%{?dist} Summary: Python client for the OpenShift API License: MIT diff --git a/scripts/constants.py b/scripts/constants.py index adc75caf..25059edf 100644 --- a/scripts/constants.py +++ b/scripts/constants.py @@ -23,7 +23,7 @@ # client version for packaging and releasing. It can # be different than SPEC_VERSION. -CLIENT_VERSION = "0.4.1" +CLIENT_VERSION = "0.4.2" KUBERNETES_CLIENT_VERSION = "4.0.0" # Name of the release package diff --git a/setup.py b/setup.py index addf9725..260ae8dd 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ # Do not edit these constants. They will be updated automatically # by scripts/update-client.sh. -CLIENT_VERSION = "0.4.1" +CLIENT_VERSION = "0.4.2" PACKAGE_NAME = "openshift" DEVELOPMENT_STATUS = "3 - Alpha"