Merge pull request #100 from 0xFelix/kubernetes-core-4

fix: Ensure compatibility with kubernetes.core >=3.10,<4.1.0
This commit is contained in:
kubevirt-bot
2024-05-29 11:24:40 +02:00
committed by GitHub
4 changed files with 11 additions and 10 deletions

View File

@@ -45,7 +45,7 @@ ansible-galaxy collection install kubevirt-kubevirt.core-*.tar.gz
<!--start collection_dependencies --> <!--start collection_dependencies -->
#### Ansible collections #### Ansible collections
* [kubernetes.core](https://galaxy.ansible.com/ui/repo/published/kubernetes/core)>=3.0.1 * [kubernetes.core](https://galaxy.ansible.com/ui/repo/published/kubernetes/core)>=3.1.0,<4.1.0
To install all the dependencies: To install all the dependencies:
```bash ```bash

View File

@@ -6,7 +6,7 @@ readme: README.md
authors: authors:
- KubeVirt Project (kubevirt.io) - KubeVirt Project (kubevirt.io)
dependencies: dependencies:
kubernetes.core: '>=3.0.1' kubernetes.core: '>=3.1.0,<4.1.0'
description: Lean Ansible bindings for KubeVirt description: Lean Ansible bindings for KubeVirt
license_file: LICENSE license_file: LICENSE
tags: tags:

View File

@@ -182,22 +182,23 @@ from typing import (
# Handle import errors of python kubernetes client. # Handle import errors of python kubernetes client.
# HAS_K8S_MODULE_HELPER imported below will print a warning to the user if the client is missing. # Set HAS_K8S_MODULE_HELPER and k8s_import exception accordingly to
# potentially print a warning to the user if the client is missing.
try: try:
from kubernetes.dynamic.exceptions import DynamicApiError from kubernetes.dynamic.exceptions import DynamicApiError
except ImportError:
HAS_K8S_MODULE_HELPER = True
k8s_import_exception = None
except ImportError as e:
class DynamicApiError(Exception): class DynamicApiError(Exception):
pass pass
HAS_K8S_MODULE_HELPER = False
k8s_import_exception = e
from ansible.plugins.inventory import BaseInventoryPlugin, Constructable, Cacheable from ansible.plugins.inventory import BaseInventoryPlugin, Constructable, Cacheable
from ansible_collections.kubernetes.core.plugins.module_utils.common import (
HAS_K8S_MODULE_HELPER,
k8s_import_exception,
)
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.client import ( from ansible_collections.kubernetes.core.plugins.module_utils.k8s.client import (
get_api_client, get_api_client,

View File

@@ -1,4 +1,4 @@
--- ---
collections: collections:
- name: kubernetes.core - name: kubernetes.core
version: '>=3.0.1' version: '>=3.1.0,<4.1.0'