Skip to content

Latest commit

 

History

History
101 lines (73 loc) · 3.2 KB

README.md

File metadata and controls

101 lines (73 loc) · 3.2 KB

codecov

Convert2RHEL Inights Tasks

Scripts related to convert2rhel to be run via rhc-worker-script on Red Hat Insights.

Scripts themselves shouldn't have any additional requirements = they are relying on python standard library.

Structure of repository is following:

├── requirements  # DEV requirements - tests & lint
│   └── ...
├── schemas # All expected json outputs in the scripts stdouts
|   |   ...
│   └── preconversion_assessment_schema_1.1.json
├── convert2rhel_insights_tasks # All available scripts
│   └── main.py
└── tests
    |   ...

Schemas

Currently there is given format of the scripts stdout that is expected to be parsed by the Red Hat Insights Task UI. This stdout is JSON structure wrapped between agreed on separators. Schemas of the JSONs for each script can be found in schemas folder.

  • separators (common to all scripts):
    • ### JSON START ###
    • ### JSON END ###

Scripts

Convert2RHEL Insights Tasks

Script itself and tests are written for python 2.7. Goal of script is to print to stdout in specified format, the script itself is executed by rhc-worker-script and stdout is collected and send back to Insights Tasks UI.

Local Development & Contributing

Requirements

  • virtualenv - to run tests locally
  • pre-commit - to run checks before each commit, see hook in .pre-commit-config.yml
  • make - to use handy commands

Run tests and lint

make install # install pre-commit hooks and python virtualenv
make tests # run pytest

Syncing scripts

We have a script to sync the changes from convert2rhel_insights_tasks/main.py to the appropriate yaml files (pre-analysis and conversion) in both advisor-backend and rhc-worker-script.

To make it work, you need to first install the ruamel.yaml library through your package manager, for example, if using Fedora or RHEL:

dnf install python3-ruamel-yaml

We sync the files to rhc-worker-script mostly on development or testing with the following command:

make sync

While for the advisor-backend, we mainly want to sync after we do a new release. So for that, only call this command if checked out to a tag after the release.

make sync-advisor

Convert2RHEL Playbook

A specialized Convert2RHEL playbook can be found under the playbooks directory. The playbook will take of the following functions:

  1. Setup Convert2RHEL (Download certificates, repositories and etc...)
  2. Set a couple of environment variables for the Convert2RHEl execution (Based on the content_vars defined in the playbook)
  3. Run convert2rhel with default commands
  4. A function to run any post-execution commands needed by the conversion (Currently empty.)