Skip to main content

Module ansible_import

Module ansible_import 

Source
Expand description

Ansible-collection import (Tier-1 CLI-veneer detection).

Ansible collections ship as .tar.gz archives per the Galaxy artifact spec. For a large class of vendor collections, every “module” is a thin action plugin that just shells out to an external CLI - the YAML is a friendly veneer over a binary the controller already has on PATH.

For these collections we don’t need the ansible-playbook runtime to convert their playbooks: we can inspect the action-plugin source at import time, extract the CLI command string, and emit a corresponding flow node (zowe-adapter cli-tool when the binary is zowe, shell run-command otherwise).

This module does the extract-and-detect half:

  1. Open a collection .tar.gz, validate (entry count, total size, no path traversal), and read the on-tape entries we care about (MANIFEST.json, plugins/action/*.py).
  2. Run a small regex pass over each action-plugin’s source looking for the two patterns that cover the realistic Tier-1 surface:
    • zowe_command = "<cmd>" (zowe-CLI-veneer collections)
    • command_to_run = "<cmd>" (generic CLI veneer)
  3. Return a CollectionPreview the frontend’s resolver pipeline can seed itself with. Unknown modules surface as cli_command: None so the resolver pipeline still falls through to the builtin table / fallback for them.

Structs§

CliCommand
CollectionPreview
ModulePreview

Enums§

ImportError

Functions§

import_collection
Top-level entry point. Reads + validates the tarball, scans every plugins/modules/*.py to enumerate the collection’s surface, then runs the CLI detector against each module’s matching action plugin (if any).