From eb78da68dd96e627de9d5d83972630e77689a104 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Thu, 30 Mar 2017 13:26:59 -0400 Subject: [PATCH] allow plugins to override fragments --- lib/ansible/utils/plugin_docs.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/ansible/utils/plugin_docs.py b/lib/ansible/utils/plugin_docs.py index dd38cfa953d..0c44514274e 100644 --- a/lib/ansible/utils/plugin_docs.py +++ b/lib/ansible/utils/plugin_docs.py @@ -77,17 +77,17 @@ def add_fragments(doc, filename): raise Exception("missing options in fragment (%s), possibly misformatted?: %s" % (fragment_name, filename)) for key, value in fragment.items(): - if key not in doc: - doc[key] = value - else: + if key in doc: + # assumes both structures have same type if isinstance(doc[key], MutableMapping): - doc[key].update(value) + value.update(doc[key]) elif isinstance(doc[key], MutableSet): - doc[key].add(value) + value.add(doc[key]) elif isinstance(doc[key], MutableSequence): - doc[key] = sorted(frozenset(doc[key] + value)) + value = sorted(frozenset(value + doc[key])) else: 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):