mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 19:31:26 -07:00
allow plugins to override fragments
This commit is contained in:
parent
25019fe70c
commit
eb78da68dd
1 changed files with 6 additions and 6 deletions
|
@ -77,17 +77,17 @@ def add_fragments(doc, filename):
|
||||||
raise Exception("missing options in fragment (%s), possibly misformatted?: %s" % (fragment_name, filename))
|
raise Exception("missing options in fragment (%s), possibly misformatted?: %s" % (fragment_name, filename))
|
||||||
|
|
||||||
for key, value in fragment.items():
|
for key, value in fragment.items():
|
||||||
if key not in doc:
|
if key in doc:
|
||||||
doc[key] = value
|
# assumes both structures have same type
|
||||||
else:
|
|
||||||
if isinstance(doc[key], MutableMapping):
|
if isinstance(doc[key], MutableMapping):
|
||||||
doc[key].update(value)
|
value.update(doc[key])
|
||||||
elif isinstance(doc[key], MutableSet):
|
elif isinstance(doc[key], MutableSet):
|
||||||
doc[key].add(value)
|
value.add(doc[key])
|
||||||
elif isinstance(doc[key], MutableSequence):
|
elif isinstance(doc[key], MutableSequence):
|
||||||
doc[key] = sorted(frozenset(doc[key] + value))
|
value = sorted(frozenset(value + doc[key]))
|
||||||
else:
|
else:
|
||||||
raise Exception("Attempt to extend a documentation fragement (%s) of unknown type: %s" % (fragment_name, filename))
|
raise Exception("Attempt to extend a documentation fragement (%s) of unknown type: %s" % (fragment_name, filename))
|
||||||
|
doc[key] = value
|
||||||
|
|
||||||
|
|
||||||
def get_docstring(filename, verbose=False):
|
def get_docstring(filename, verbose=False):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue