Skip to content

Commit

Permalink
Enforce locale when running the IPU workflow.
Browse files Browse the repository at this point in the history
Some actors that are executed during the IPU workflow rely on parsing
outputs of executed commands. When the underlying system is configured
with a different locale the actors typically fail since they are looking
for specific strings in the outputs which tend to be localized.

This commit enforces locale to en_US.utf-8 via setting the LANG
environment variable, and therefore removes the need for users that
typically use different locale to set it before running leapp.
  • Loading branch information
MichalHe authored and Rezney committed Oct 14, 2021
1 parent 3a452d0 commit 33a669d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions commands/preupgrade/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ def preupgrade(args):
workflow.load_answers(answerfile_path, userchoices_path)
until_phase = 'ReportsPhase'
logger.info('Executing workflow until phase: %s', until_phase)

# Set the locale, so that the actors parsing command outputs that might be localized will not fail
os.environ['LC_ALL'] = 'en_US.UTF-8'
os.environ['LANG'] = 'en_US.UTF-8'
workflow.run(context=context, until_phase=until_phase, skip_dialogs=True)

logger.info("Answerfile will be created at %s", answerfile_path)
Expand Down
4 changes: 4 additions & 0 deletions commands/upgrade/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ def upgrade(args):
with beautify_actor_exception():
logger.info("Using answerfile at %s", answerfile_path)
workflow.load_answers(answerfile_path, userchoices_path)

# Set the locale, so that the actors parsing command outputs that might be localized will not fail
os.environ['LC_ALL'] = 'en_US.UTF-8'
os.environ['LANG'] = 'en_US.UTF-8'
workflow.run(context=context, skip_phases_until=skip_phases_until, skip_dialogs=True,
only_with_tags=only_with_tags)

Expand Down

0 comments on commit 33a669d

Please sign in to comment.