|
|
@ -842,8 +842,9 @@ class DocCLI(CLI, RoleMixin):
|
|
|
|
if context.CLIARGS['show_snippet']:
|
|
|
|
if context.CLIARGS['show_snippet']:
|
|
|
|
if plugin_type not in SNIPPETS:
|
|
|
|
if plugin_type not in SNIPPETS:
|
|
|
|
raise AnsibleError("Snippets are only available for the following plugin types: %s" % ', '.join(SNIPPETS))
|
|
|
|
raise AnsibleError("Snippets are only available for the following plugin types: %s" % ', '.join(SNIPPETS))
|
|
|
|
if plugin_type == 'inventory' and plugin in ('yaml', 'toml'):
|
|
|
|
if plugin_type == 'inventory' and doc.get('options') and not doc['options'].get('plugin'):
|
|
|
|
# not usable as other inventory plugins
|
|
|
|
# these are 'configurable' but not intended for yaml type inventory sources, like ini or script
|
|
|
|
|
|
|
|
# so we cannot use as source for snippets
|
|
|
|
del doc['options']
|
|
|
|
del doc['options']
|
|
|
|
text = DocCLI.get_snippet_text(doc, plugin_type)
|
|
|
|
text = DocCLI.get_snippet_text(doc, plugin_type)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
@ -971,6 +972,8 @@ class DocCLI(CLI, RoleMixin):
|
|
|
|
_do_lookup_snippet(text, doc)
|
|
|
|
_do_lookup_snippet(text, doc)
|
|
|
|
elif 'options' in doc:
|
|
|
|
elif 'options' in doc:
|
|
|
|
_do_yaml_snippet(text, doc)
|
|
|
|
_do_yaml_snippet(text, doc)
|
|
|
|
|
|
|
|
elif ptype == 'inventory':
|
|
|
|
|
|
|
|
display.warning('Snippets are only available to inventory plugins with YAML type sources that can be used with the "auto" plugin.')
|
|
|
|
|
|
|
|
|
|
|
|
text.append('')
|
|
|
|
text.append('')
|
|
|
|
return "\n".join(text)
|
|
|
|
return "\n".join(text)
|
|
|
|