summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGomathiselviS <gomathiselvi@gmail.com>2022-04-20 23:56:19 -0400
committerGitHub <noreply@github.com>2022-04-21 03:56:19 +0000
commit3677b7834a8cb735db9b7004563e74bc1ca74961 (patch)
tree4c5017646e608c3d751c487606571d4cc3ae9b71
parent507955aeda83492dab7f2d5f9b695f7bd4043e35 (diff)
downloadvyos.vyos-3677b7834a8cb735db9b7004563e74bc1ca74961.tar.gz
vyos.vyos-3677b7834a8cb735db9b7004563e74bc1ca74961.zip
change default subset to min (#252)
vyos_facts: change default subset to min Signed-off-by: GomathiselviS gomathiselvi@gmail.com SUMMARY Fixes #231 ISSUE TYPE Bugfix Pull Request COMPONENT NAME ADDITIONAL INFORMATION Reviewed-by: Nathaniel Case <this.is@nathanielca.se>
-rw-r--r--changelogs/fragments/vyos_facts_update.yaml3
-rw-r--r--docs/vyos.vyos.vyos_facts_module.rst4
-rw-r--r--plugins/module_utils/network/vyos/argspec/facts/facts.py4
-rw-r--r--plugins/modules/vyos_facts.py4
-rw-r--r--tests/integration/targets/vyos_facts/tests/cli/basic_facts.yaml17
5 files changed, 25 insertions, 7 deletions
diff --git a/changelogs/fragments/vyos_facts_update.yaml b/changelogs/fragments/vyos_facts_update.yaml
new file mode 100644
index 00000000..8667aa01
--- /dev/null
+++ b/changelogs/fragments/vyos_facts_update.yaml
@@ -0,0 +1,3 @@
+---
+major_changes:
+ - "`vyos_facts` - change default gather_subset to `min` from `!config` (https://github.com/ansible-collections/vyos.vyos/issues/231)."
diff --git a/docs/vyos.vyos.vyos_facts_module.rst b/docs/vyos.vyos.vyos_facts_module.rst
index 83606d06..7e7d7624 100644
--- a/docs/vyos.vyos.vyos_facts_module.rst
+++ b/docs/vyos.vyos.vyos_facts_module.rst
@@ -79,10 +79,10 @@ Parameters
</div>
</td>
<td>
- <b>Default:</b><br/><div style="color: blue">"!config"</div>
+ <b>Default:</b><br/><div style="color: blue">"min"</div>
</td>
<td>
- <div>When supplied, this argument will restrict the facts collected to a given subset. Possible values for this argument include all, default, config, and neighbors. Can specify a list of values to include a larger subset. Values can also be used with an initial <code>!</code> to specify that a specific subset should not be collected.</div>
+ <div>When supplied, this argument will restrict the facts collected to a given subset. Possible values for this argument include <code>all</code>, <code>default</code>, <code>config</code>, <code>neighbors</code> and <code>min</code>. Can specify a list of values to include a larger subset. Values can also be used with an initial <code>!</code> to specify that a specific subset should not be collected.</div>
</td>
</tr>
<tr>
diff --git a/plugins/module_utils/network/vyos/argspec/facts/facts.py b/plugins/module_utils/network/vyos/argspec/facts/facts.py
index efd98e36..45a4cb49 100644
--- a/plugins/module_utils/network/vyos/argspec/facts/facts.py
+++ b/plugins/module_utils/network/vyos/argspec/facts/facts.py
@@ -16,9 +16,7 @@ class FactsArgs(object): # pylint: disable=R0903
pass
argument_spec = {
- "gather_subset": dict(
- default=["!config"], type="list", elements="str"
- ),
+ "gather_subset": dict(default=["min"], type="list", elements="str"),
"gather_network_resources": dict(type="list", elements="str"),
"available_network_resources": {"type": "bool", "default": False},
}
diff --git a/plugins/modules/vyos_facts.py b/plugins/modules/vyos_facts.py
index ef19ec09..951dbe9b 100644
--- a/plugins/modules/vyos_facts.py
+++ b/plugins/modules/vyos_facts.py
@@ -33,11 +33,11 @@ options:
gather_subset:
description:
- When supplied, this argument will restrict the facts collected to a given subset. Possible
- values for this argument include all, default, config, and neighbors. Can specify
+ values for this argument include C(all), C(default), C(config), C(neighbors) and C(min). Can specify
a list of values to include a larger subset. Values can also be used with an
initial C(!) to specify that a specific subset should not be collected.
required: false
- default: '!config'
+ default: 'min'
type: list
elements: str
gather_network_resources:
diff --git a/tests/integration/targets/vyos_facts/tests/cli/basic_facts.yaml b/tests/integration/targets/vyos_facts/tests/cli/basic_facts.yaml
index ede7ca2d..a7c3a11d 100644
--- a/tests/integration/targets/vyos_facts/tests/cli/basic_facts.yaml
+++ b/tests/integration/targets/vyos_facts/tests/cli/basic_facts.yaml
@@ -53,3 +53,20 @@
- result.changed == false
- "{{ result['ansible_facts']['available_network_resources'] | symmetric_difference(result['ansible_facts']['ansible_net_gather_network_resources']) |length\
\ == 0 }}"
+
+- name: test getting default facts
+ register: result
+ vyos.vyos.vyos_facts:
+
+- assert:
+ that:
+ - result.changed == false
+ - "'default' in result.ansible_facts.ansible_net_gather_subset"
+ - "'config' not in result.ansible_facts.ansible_net_gather_subset"
+ - result.ansible_facts.ansible_net_hostname is defined
+ - result.ansible_facts.ansible_net_model is defined
+ - result.ansible_facts.ansible_net_python_version is defined
+ - result.ansible_facts.ansible_net_serialnum is defined
+ - result.ansible_facts.ansible_net_system is defined
+ - result.ansible_facts.ansible_net_version is defined
+ - result.ansible_facts.ansible_network_resources == {}