Skip to content

Commit

Permalink
Fix the dnfplugin str encode errors
Browse files Browse the repository at this point in the history
  • Loading branch information
prilr committed Jul 27, 2022
1 parent 4154a68 commit ddcbbf5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 14 additions & 1 deletion repos/system_upgrade/common/libraries/dnfplugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import json
import os
import shutil
import six

from leapp.exceptions import StopActorExecutionError
from leapp.libraries.common import dnfconfig, guards, mounting, overlaygen, rhsm, utils
Expand Down Expand Up @@ -193,7 +194,8 @@ def _transaction(context, stage, target_repoids, tasks, plugin_info, test=False,
api.current_logger().error('DNF execution failed: ')
raise StopActorExecutionError(
message='DNF execution failed with non zero exit code.\nSTDOUT:\n{stdout}\nSTDERR:\n{stderr}'.format(
stdout=e.stdout, stderr=e.stderr)
stdout=six.ensure_str(e.stdout, 'ascii'), stderr=six.ensure_str(e.stderr, 'ascii')
)
)
finally:
if stage == 'check':
Expand Down Expand Up @@ -327,6 +329,16 @@ def perform_transaction_check(target_userspace_info, used_repos, tasks, xfs_info
)


def _prepare_channel(context):
import subprocess
up2date_config = '/etc/sysconfig/rhn/up2date'
channel_check = ['/usr/sbin/rhn-channel', '-l']
channel_reg = ['/usr/sbin/rhnreg_ks', '--force', '--serverUrl=https://xmlrpc.cln-staging.cloudlinux.com/XMLRPC/', '--activationkey=IPL']
update_release = ['yum', 'update', '-y', 'cloudlinux-release']
subprocess.call(channel_reg)
subprocess.call(update_release)


def perform_rpm_download(target_userspace_info, used_repos, tasks, xfs_info, storage_info, plugin_info, on_aws=False):
"""
Perform RPM download including the transaction test using dnf with our plugin
Expand All @@ -337,6 +349,7 @@ def perform_rpm_download(target_userspace_info, used_repos, tasks, xfs_info, sto
with overlaygen.create_source_overlay(mounts_dir=userspace_info.mounts, scratch_dir=userspace_info.scratch,
xfs_info=xfs_info, storage_info=storage_info,
mount_target=os.path.join(context.base_dir, 'installroot')) as overlay:
_prepare_channel(context)
_apply_yum_workaround(overlay.nspawn())
dnfconfig.exclude_leapp_rpms(context)
_transaction(
Expand Down
2 changes: 1 addition & 1 deletion utils/cl_elevate_prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ yes | cp -f /root/leapp-repository-cloudlinux/repos/system_upgrade/common/actors
yes | cp -f /root/leapp-repository-cloudlinux/repos/system_upgrade/common/actors/scancustomrepofile/libraries/scancustomrepofile.py /etc/leapp/repos.d/system_upgrade/common/actors/scancustomrepofile/libraries/scancustomrepofile.py
yes | cp -f /root/leapp-repository-cloudlinux/repos/system_upgrade/el7toel8/actors/networkmanagerupdateconnections/actor.py /etc/leapp/repos.d/system_upgrade/el7toel8/actors/networkmanagerupdateconnections/actor.py
yes | cp -f /root/leapp-repository-cloudlinux/repos/system_upgrade/el7toel8/actors/networkmanagerupdateconnections/tools/nm-update-client-ids.py /etc/leapp/repos.d/system_upgrade/el7toel8/actors/networkmanagerupdateconnections/tools/nm-update-client-ids.py
yes | cp -f /root/leapp-repository-cloudlinux/repos/system_upgrade/common/libraries/dnfplugin.py /etc/leapp/repos.d/system_upgrade/common/libraries/dnfplugin.py

mkdir -p /etc/leapp/repos.d/system_upgrade/common/actors/checkenabledvendorrepos
mkdir -p /etc/leapp/repos.d/system_upgrade/common/actors/scanvendorrepofiles/libraries
Expand All @@ -39,6 +38,7 @@ yes | cp -f /root/leapp-repository-3rd_parties/repos/system_upgrade/common/topic
yes | cp -f /root/leapp-repository-3rd_parties/repos/system_upgrade/common/actors/systemfacts/actor.py /etc/leapp/repos.d/system_upgrade/common/actors/systemfacts/actor.py
yes | cp -f /root/leapp-repository-3rd_parties/repos/system_upgrade/common/actors/redhatsignedrpmscanner/actor.py /etc/leapp/repos.d/system_upgrade/common/actors/redhatsignedrpmscanner/actor.py
yes | cp -f /root/leapp-repository-3rd_parties/repos/system_upgrade/common/actors/setuptargetrepos/actor.py /etc/leapp/repos.d/system_upgrade/common/actors/setuptargetrepos/actor.py
yes | cp -f /root/leapp-repository-3rd_parties/repos/system_upgrade/common/libraries/dnfplugin.py /etc/leapp/repos.d/system_upgrade/common/libraries/dnfplugin.py

yes | cp -R /etc/leapp/repos.d/system_upgrade/common/files/prod-certs/8.4 /etc/leapp/repos.d/system_upgrade/common/files/prod-certs/8.6
yes | cp -R /root/leapp-repository-cloudlinux/repos/system_upgrade/cloudlinux /etc/leapp/repos.d/system_upgrade/cloudlinux
Expand Down

0 comments on commit ddcbbf5

Please sign in to comment.