Skip to content

Commit 7de3551

Browse files
Merge pull request #33 from ansible-network/bt_add_test
README update, and fixes necessary for stub module and facts to work Reviewed-by: https://github.com/ansible-zuul[bot]
2 parents cdb3c43 + d03df02 commit 7de3551

File tree

4 files changed

+17
-23
lines changed

4 files changed

+17
-23
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ ansible-playbook -e parent=~/github/rm_example/roles/my_role \
156156

157157
**Using the collection layout**
158158

159-
Note: As of 3/26/2019, the following PR needs to be used:
160159
```
161160
git clone [email protected]:ansible/ansible.git
162161
cd ansible
@@ -181,7 +180,7 @@ ln -s ~/github/rm_example ~/.ansible/collections/ansible_collections/cidrblock/m
181180
var: result
182181
- cidrblock.my_collection.myos_facts:
183182
- debug:
184-
var: net_configuration
183+
var: ansible_network_resources
185184
186185
```
187186

@@ -203,7 +202,7 @@ ln -s ~/github/rm_example ~/.ansible/collections/ansible_collections/cidrblock/m
203202
var: result
204203
- myos_facts:
205204
- debug:
206-
var: net_configuration
205+
var: ansible_network_resources
207206
```
208207

209208
### Resource Module Structure/Workflow

models/myos/interfaces/myos_interfaces.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,16 @@ DOCUMENTATION: |
5353
description:
5454
- The property_01
5555
type: str
56-
state:
57-
description:
58-
- The state the configuration should be left in
59-
type: str
60-
choices:
61-
- merged
62-
- replaced
63-
- overridden
64-
- deleted
65-
default: merged
56+
state:
57+
description:
58+
- The state the configuration should be left in
59+
type: str
60+
choices:
61+
- merged
62+
- replaced
63+
- overridden
64+
- deleted
65+
default: merged
6666
EXAMPLES:
6767
- deleted_example_01.txt
6868
- merged_example_01.txt

roles/resource_module/templates/module_directory/network_os/network_os_facts.py.j2

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,9 @@ def main():
9696
gather_subset = module.params['gather_subset']
9797
gather_network_resources = module.params['gather_network_resources']
9898
result = Facts().get_facts(module, connection, gather_subset, gather_network_resources)
99-
100-
try:
101-
ansible_facts, warning = result
102-
warnings.extend(warning)
103-
except (TypeError, KeyError):
104-
ansible_facts = result
99+
100+
ansible_facts, additional_warnings = result
101+
warnings.extend(additional_warnings)
105102

106103
module.exit_json(ansible_facts=ansible_facts, warnings=warnings)
107104

roles/resource_module/templates/module_utils/network_os/facts/facts.py.j2

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,8 @@ class Facts(FactsArgs, FactsBase): #pylint: disable=R0903
110110
key = 'ansible_net_%s' % key
111111
self.ansible_facts[key] = value
112112

113-
if warnings:
114-
return self.ansible_facts, warnings
115-
else:
116-
return self.ansible_facts
113+
return self.ansible_facts, warnings
114+
117115

118116

119117
@staticmethod

0 commit comments

Comments
 (0)