mirror of
https://github.com/kubevirt/kubevirt.core.git
synced 2026-03-26 19:03:16 +00:00
feat(modules): Add hidden_fields argument
Add the hidden_fields argument to kubevirt_vm and kubevirt_{vm,vmi}_info
which allows to hide and ignore certain fields in the returned definition
of a VM or VMI. By default this argument is set to ignore changes to the
kubemacpool.io/transaction-timestamp annotation and managed fields, which
may change at any time and cause the modules to return a changed status
although nothing has changed other than their values.
Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
This commit is contained in:
@@ -43,6 +43,7 @@ def execute_info_module(module, kind, wait_condition):
|
||||
wait=module.params["wait"],
|
||||
wait_sleep=module.params["wait_sleep"],
|
||||
wait_timeout=module.params["wait_timeout"],
|
||||
hidden_fields=module.params["hidden_fields"],
|
||||
condition=wait_condition,
|
||||
)
|
||||
module.exit_json(changed=False, **facts)
|
||||
|
||||
@@ -158,6 +158,15 @@ options:
|
||||
- If set to O(force=yes), and O(state=present) is set, an existing object will be replaced.
|
||||
type: bool
|
||||
default: no
|
||||
hidden_fields:
|
||||
description:
|
||||
- Hide fields matching this option in the result.
|
||||
- An example might be O(hidden_fields=[metadata.managedFields])
|
||||
or O(hidden_fields=[metadata.annotations[kubemacpool.io/transaction-timestamp]]).
|
||||
type: list
|
||||
elements: str
|
||||
default: ['metadata.annotations[kubemacpool.io/transaction-timestamp]', metadata.managedFields]
|
||||
version_added: 2.2.0
|
||||
|
||||
requirements:
|
||||
- "python >= 3.9"
|
||||
@@ -402,6 +411,14 @@ def arg_spec() -> Dict:
|
||||
},
|
||||
},
|
||||
},
|
||||
"hidden_fields": {
|
||||
"type": "list",
|
||||
"elements": "str",
|
||||
"default": [
|
||||
"metadata.annotations[kubemacpool.io/transaction-timestamp]",
|
||||
"metadata.managedFields",
|
||||
],
|
||||
},
|
||||
}
|
||||
spec.update(deepcopy(AUTH_ARG_SPEC))
|
||||
spec.update(deepcopy(COMMON_ARG_SPEC))
|
||||
|
||||
@@ -74,6 +74,15 @@ options:
|
||||
- Ignored if O(wait) is not set.
|
||||
default: 120
|
||||
type: int
|
||||
hidden_fields:
|
||||
description:
|
||||
- Hide fields matching this option in the result.
|
||||
- An example might be O(hidden_fields=[metadata.managedFields])
|
||||
or O(hidden_fields=[metadata.annotations[kubemacpool.io/transaction-timestamp]]).
|
||||
type: list
|
||||
elements: str
|
||||
default: ['metadata.annotations[kubemacpool.io/transaction-timestamp]', metadata.managedFields]
|
||||
version_added: 2.2.0
|
||||
|
||||
requirements:
|
||||
- "python >= 3.9"
|
||||
@@ -174,6 +183,14 @@ def arg_spec():
|
||||
"""
|
||||
spec = {
|
||||
"running": {"type": "bool"},
|
||||
"hidden_fields": {
|
||||
"type": "list",
|
||||
"elements": "str",
|
||||
"default": [
|
||||
"metadata.annotations[kubemacpool.io/transaction-timestamp]",
|
||||
"metadata.managedFields",
|
||||
],
|
||||
},
|
||||
}
|
||||
spec.update(deepcopy(INFO_ARG_SPEC))
|
||||
spec.update(deepcopy(AUTH_ARG_SPEC))
|
||||
|
||||
@@ -66,6 +66,15 @@ options:
|
||||
- Ignored if O(wait) is not set.
|
||||
default: 120
|
||||
type: int
|
||||
hidden_fields:
|
||||
description:
|
||||
- Hide fields matching this option in the result.
|
||||
- An example might be O(hidden_fields=[metadata.managedFields])
|
||||
or O(hidden_fields=[metadata.annotations[kubemacpool.io/transaction-timestamp]]).
|
||||
type: list
|
||||
elements: str
|
||||
default: ['metadata.annotations[kubemacpool.io/transaction-timestamp]', metadata.managedFields]
|
||||
version_added: 2.2.0
|
||||
|
||||
requirements:
|
||||
- "python >= 3.9"
|
||||
@@ -157,7 +166,16 @@ def arg_spec():
|
||||
"""
|
||||
arg_spec defines the argument spec of this module.
|
||||
"""
|
||||
spec = {}
|
||||
spec = {
|
||||
"hidden_fields": {
|
||||
"type": "list",
|
||||
"elements": "str",
|
||||
"default": [
|
||||
"metadata.annotations[kubemacpool.io/transaction-timestamp]",
|
||||
"metadata.managedFields",
|
||||
],
|
||||
},
|
||||
}
|
||||
spec.update(deepcopy(INFO_ARG_SPEC))
|
||||
spec.update(deepcopy(AUTH_ARG_SPEC))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user