@@ -578,6 +578,7 @@ async def write_collection_namespace_index(namespace: str, collections: t.Iterab
578
578
579
579
async def write_plugin_type_index (plugin_type : str ,
580
580
per_collection_plugins : t .Mapping [str , t .Mapping [str , str ]],
581
+ collection_metadata : t .Mapping [str , AnsibleCollectionMetadata ],
581
582
template : Template ,
582
583
dest_filename : str ,
583
584
for_official_docsite : bool = False ) -> None :
@@ -587,16 +588,28 @@ async def write_plugin_type_index(plugin_type: str,
587
588
:arg plugin_type: The plugin type to write the index for.
588
589
:arg per_collection_plugins: Mapping of collection_name to Mapping of plugin_name to
589
590
short_description.
591
+ :arg collection_metadata: Dictionary mapping collection names to collection metadata objects.
590
592
:arg template: A template to render the plugin index.
591
593
:arg dest_filename: The destination filename.
592
594
:kwarg for_official_docsite: Default False. Set to True to use wording specific for the
593
595
official docsite on docs.ansible.com.
594
596
"""
597
+ public_per_collection_plugins = {}
598
+ for collection_name , plugins in per_collection_plugins .items ():
599
+ public_plugins = {}
600
+ collection_meta = collection_metadata [collection_name ]
601
+ private_plugins = collection_meta .private_plugins .get (plugin_type ) or []
602
+ for plugin_name , plugin_data in plugins .items ():
603
+ if plugin_name not in private_plugins :
604
+ public_plugins [plugin_name ] = plugin_data
605
+ if public_plugins :
606
+ public_per_collection_plugins [collection_name ] = public_plugins
607
+
595
608
index_contents = _render_template (
596
609
template ,
597
610
dest_filename ,
598
611
plugin_type = plugin_type ,
599
- per_collection_plugins = per_collection_plugins ,
612
+ per_collection_plugins = public_per_collection_plugins ,
600
613
for_official_docsite = for_official_docsite ,
601
614
)
602
615
@@ -666,11 +679,22 @@ async def write_plugin_lists(collection_name: str,
666
679
'Cannot parse required_ansible specifier set for {collection_name}' ,
667
680
collection_name = collection_name ,
668
681
)
682
+
683
+ public_plugin_maps : t .Dict [str , t .Mapping [str , str ]] = {}
684
+ for plugin_type , plugin_data in plugin_maps .items ():
685
+ private_plugins = collection_meta .private_plugins .get (plugin_type ) or []
686
+ public_plugin_data = {}
687
+ for plugin_name , plugin_info in plugin_data .items ():
688
+ if plugin_name not in private_plugins :
689
+ public_plugin_data [plugin_name ] = plugin_info
690
+ if public_plugin_data :
691
+ public_plugin_maps [plugin_type ] = public_plugin_data
692
+
669
693
index_contents = _render_template (
670
694
template ,
671
695
dest_dir ,
672
696
collection_name = collection_name ,
673
- plugin_maps = plugin_maps ,
697
+ plugin_maps = public_plugin_maps ,
674
698
collection_version = collection_meta .version ,
675
699
requires_ansible = requires_ansible ,
676
700
link_data = link_data ,
@@ -782,6 +806,7 @@ async def output_collection_namespace_indexes(collection_namespaces: t.Mapping[s
782
806
783
807
784
808
async def output_plugin_indexes (plugin_info : PluginCollectionInfoT ,
809
+ collection_metadata : t .Mapping [str , AnsibleCollectionMetadata ],
785
810
dest_dir : str ,
786
811
collection_url : CollectionNameTransformer ,
787
812
collection_install : CollectionNameTransformer ,
@@ -791,6 +816,7 @@ async def output_plugin_indexes(plugin_info: PluginCollectionInfoT,
791
816
792
817
:arg plugin_info: Mapping of plugin_type to Mapping of collection_name to Mapping of
793
818
plugin_name to short_description.
819
+ :arg collection_metadata: Dictionary mapping collection names to collection metadata objects.
794
820
:arg dest_dir: The directory to place the documentation in.
795
821
:kwarg for_official_docsite: Default False. Set to True to use wording specific for the
796
822
official docsite on docs.ansible.com.
@@ -819,8 +845,8 @@ async def output_plugin_indexes(plugin_info: PluginCollectionInfoT,
819
845
filename = os .path .join (collection_toplevel , f'index_{ plugin_type } .rst' )
820
846
writers .append (await pool .spawn (
821
847
write_plugin_type_index (
822
- plugin_type , per_collection_data , plugin_list_tmpl , filename ,
823
- for_official_docsite = for_official_docsite )))
848
+ plugin_type , per_collection_data , collection_metadata , plugin_list_tmpl ,
849
+ filename , for_official_docsite = for_official_docsite )))
824
850
825
851
await asyncio .gather (* writers )
826
852
0 commit comments