Skip to content

Commit

Permalink
upgrade: Restore leapp environment variables on --resume
Browse files Browse the repository at this point in the history
This patch will restore leapp environment variables from the IPUConfig
message. This will allow to easier and more naturally access environment
from actors during the upgrade even after reboot etc.

Signed-off-by: Vinzenz Feenstra <vfeenstr@redhat.com>
  • Loading branch information
vinzenz committed Sep 21, 2021
1 parent 624566a commit 8d4a1e2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion commands/upgrade/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def upgrade(args):
os.environ['LEAPP_VERBOSE'] = '1'
else:
os.environ['LEAPP_VERBOSE'] = '0'

util.restore_leapp_env_vars(context)
skip_phases_until = util.get_last_phase(context)
else:
e = Execution(context=context, kind='upgrade', configuration=configuration)
Expand Down
9 changes: 8 additions & 1 deletion commands/upgrade/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,18 @@
from leapp.config import get_config
from leapp.exceptions import CommandError
from leapp.repository.scan import find_and_scan_repositories
from leapp.utils.audit import get_connection, get_checkpoints
from leapp.utils.audit import get_connection, get_checkpoints, get_messages
from leapp.utils.output import report_unsupported
from leapp.utils.report import fetch_upgrade_report_messages, generate_report_file


def restore_leapp_env_vars(context):
messages = get_messages(('IPUConfig',), context)
leapp_env_vars = json.loads((messages or [{}])[0].get('message', {}).get('data', '{}')).get('leapp_env_vars', {})
for entry in leapp_env_vars:
os.environ[entry['name']] = entry['value']


def archive_logfiles():
""" Archive log files from a previous run of Leapp """
cfg = get_config()
Expand Down

0 comments on commit 8d4a1e2

Please sign in to comment.