Skip to content

Fix/add config data printing#22

Open
matejmatuska wants to merge 3 commits into
oamg:mainfrom
matejmatuska:fix-config-data-printing
Open

Fix/add config data printing#22
matejmatuska wants to merge 3 commits into
oamg:mainfrom
matejmatuska:fix-config-data-printing

Conversation

@matejmatuska

@matejmatuska matejmatuska commented May 21, 2026

Copy link
Copy Markdown
Member

See the commit messages.

Example usage:

$ ./leapp-inspector --db leapp.db config-data
######################################################################
                          Actor Configs Data
######################################################################
{
    "livemode": {
        "additional_packages": [],
        "autostart_upgrade_after_reboot": true,
        "capture_strace_info_into": "",
        "dracut_network": "",
        "setup_network_manager": false,
        "setup_opensshd_using_auth_keys": "",
        "setup_passwordless_root": false,
        "squashfs_image_path": "/var/lib/leapp/live-upgrade.img",
        "url_to_load_squashfs_image_from": ""
    },
    "rhui": {
        "cloud_provider": "",
        "image_variant": "ordinary",
        "obsolete_gpg_keys": [
            "gpg-pubkey-2fa658e0-45700c69"
        ],
        "rhui_target_repositories_to_use": [],
        "source_clients": [],
        "target_clients": [],
        "upgrade_files": {},
        "use_config": true
    }
}

I think it would be cool to add option to print it in YAML so it can be directly used to re-create a config. But that might be a separate PR.

There were two conflicting format_config(), one is meant for formatting
a single config schema (Config) the other one was probably meant for
formatting the actual values passed in config files.

The values are not associated with actor in any way - they are not
present in metadata.metadata as config_schemas and other info about
actors is. Therefore I removed the attempt to print them.
@matejmatuska matejmatuska added bug Something isn't working enhancement New feature or request labels May 21, 2026
Comment thread scripts/leappinspector/leapp-inspector Outdated
The config data printing is currently not printed and never has been,
because it was incorrectly implemented, see commit 67f1af3.

Since the data is not associated with actors, but context, this patch
adds a new CLI subcommand for working with it. Currently the subcommand
doesn't have any option and just print the config dataa as a formatted
JSON. It can be expanded in the future. Example output:

$ ./leapp-inspector --db leapp.db config-data
######################################################################
                          Actor Configs Data
######################################################################
{
    "livemode": {
        "additional_packages": [],
        "autostart_upgrade_after_reboot": true,
        "capture_strace_info_into": "",
        "dracut_network": "",
        "setup_network_manager": false,
        "setup_opensshd_using_auth_keys": "",
        "setup_passwordless_root": false,
        "squashfs_image_path": "/var/lib/leapp/live-upgrade.img",
        "url_to_load_squashfs_image_from": ""
    },
    "rhui": {
        "cloud_provider": "",
        "image_variant": "ordinary",
        "obsolete_gpg_keys": [
            "gpg-pubkey-2fa658e0-45700c69"
        ],
        "rhui_target_repositories_to_use": [],
        "source_clients": [],
        "target_clients": [],
        "upgrade_files": {},
        "use_config": true
    }
}
@matejmatuska matejmatuska force-pushed the fix-config-data-printing branch from c59cf7e to 7da4dc4 Compare May 26, 2026 09:28
@matejmatuska

matejmatuska commented May 26, 2026

Copy link
Copy Markdown
Member Author

Added the subcommand to completion scripts and also added a new option to specify output format and allow output in yaml.

$ ./leapp-inspector --db leapp.db config-data --format yaml                                                                                                                  fix-config-data-printing  0
######################################################################
                          Actor Configs Data
######################################################################
rhui:
  target_clients: []
  upgrade_files: {}
  rhui_target_repositories_to_use: []
  cloud_provider: ''
  image_variant: ordinary
  source_clients: []
  use_config: true
  obsolete_gpg_keys:
  - gpg-pubkey-2fa658e0-45700c69
livemode:
  additional_packages: []
  autostart_upgrade_after_reboot: true
  capture_strace_info_into: ''
  dracut_network: ''
  setup_network_manager: false
  setup_opensshd_using_auth_keys: ''
  setup_passwordless_root: false
  squashfs_image_path: /var/lib/leapp/live-upgrade.img
  url_to_load_squashfs_image_from: ''

yes the empty line at the end si contained in the dumped yaml

@matejmatuska matejmatuska marked this pull request as ready for review May 26, 2026 09:29
@pirat89

pirat89 commented May 27, 2026

Copy link
Copy Markdown
Member

btw, this is how to simply generate config files actually :-D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants