File tree 6 files changed +45
-4
lines changed
test/integration/targets/collections
6 files changed +45
-4
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ credentials.yml
64
64
results.xml
65
65
coverage.xml
66
66
/test /units /cover-html
67
+ /test /integration /inventory
67
68
/test /integration /targets /* /backup /
68
69
/test /cache /*
69
70
# Development
Original file line number Diff line number Diff line change
1
+ bugfixes :
2
+ - fix issue in which symlinked collection cannot be listed, though the docs/plugins can be loaded if referenced directly.
Original file line number Diff line number Diff line change @@ -550,9 +550,9 @@ def get_collection_name_from_path(path):
550
550
:param n_path: native-string path to evaluate for collection containment
551
551
:return: collection name or None
552
552
"""
553
- n_collection_paths = [to_native (os .path .realpath (to_bytes (p ))) for p in AnsibleCollectionLoader ().n_collection_paths ]
553
+ n_collection_paths = [to_native (os .path .abspath (to_bytes (p ))) for p in AnsibleCollectionLoader ().n_collection_paths ]
554
554
555
- b_path = os .path .realpath (to_bytes (path ))
555
+ b_path = os .path .abspath (to_bytes (path ))
556
556
n_path = to_native (b_path )
557
557
558
558
for coll_path in n_collection_paths :
@@ -575,7 +575,7 @@ def get_collection_name_from_path(path):
575
575
return None
576
576
577
577
# ensure we're using the canonical real path, with the bogus __synthetic__ stripped off
578
- b_loaded_collection_path = os .path .dirname (os .path .realpath (to_bytes (loaded_collection_path )))
578
+ b_loaded_collection_path = os .path .dirname (os .path .abspath (to_bytes (loaded_collection_path )))
579
579
580
580
# if the collection path prefix matches the path prefix we were passed, it's the same collection that's loaded
581
581
if os .path .commonprefix ([b_path , b_loaded_collection_path ]) == b_loaded_collection_path :
Original file line number Diff line number Diff line change @@ -9,14 +9,19 @@ export ANSIBLE_HOST_PATTERN_MISMATCH=error
9
9
10
10
11
11
# FUTURE: just use INVENTORY_PATH as-is once ansible-test sets the right dir
12
- ipath=../../$( basename " ${INVENTORY_PATH} " )
12
+ ipath=../../$( basename " ${INVENTORY_PATH:- .. / .. / inventory } " )
13
13
export INVENTORY_PATH=" $ipath "
14
14
15
15
# test callback
16
16
ANSIBLE_CALLBACK_WHITELIST=testns.testcoll.usercallback ansible localhost -m ping | grep " usercallback says ok"
17
17
18
18
# test documentation
19
19
ansible-doc testns.testcoll.testmodule -vvv | grep -- " - normal_doc_frag"
20
+ # same with symlink
21
+ ln -s " ${PWD} /testcoll2" ./collection_root_sys/ansible_collections/testns/testcoll2
22
+ ansible-doc testns.testcoll2.testmodule2 -vvv | grep " Test module"
23
+ # now test we can list with symlink
24
+ ansible-doc -l -vvv| grep " testns.testcoll2.testmodule2"
20
25
21
26
# test adhoc default collection resolution (use unqualified collection module with playbook dir under its collection)
22
27
echo " testing adhoc default collection support with explicit playbook dir"
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/python
2
+ from __future__ import (absolute_import , division , print_function )
3
+ __metaclass__ = type
4
+
5
+ ANSIBLE_METADATA = {'metadata_version' : '1.1' ,
6
+ 'status' : ['stableinterface' ],
7
+ 'supported_by' : 'core' }
8
+
9
+ DOCUMENTATION = '''
10
+ ---
11
+ module: testmodule2
12
+ short_description: Test module
13
+ description:
14
+ - Test module
15
+ author:
16
+ - Ansible Core Team
17
+ '''
18
+
19
+ EXAMPLES = '''
20
+ '''
21
+
22
+ RETURN = '''
23
+ '''
24
+
25
+ import json
26
+
27
+
28
+ def main ():
29
+ print (json .dumps (dict (changed = False , source = 'sys' )))
30
+
31
+
32
+ if __name__ == '__main__' :
33
+ main ()
You can’t perform that action at this time.
0 commit comments