Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BZ #1710546 - decode ALL results we get from rpm #310

Merged
merged 1 commit into from
May 17, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,10 @@ def check_package_version(package_name, package_version):
transaction_set = rpm.TransactionSet()
db_result = transaction_set.dbMatch('name', package_name)
for package in db_result:
if rpm.labelCompare(('0', package['version'].decode('ascii'), '1'), required_version) < 0:
err = "%s %s is too old" % (package['name'], package['version'])
p_name = package['name'].decode('ascii')
p_version = package['version'].decode('ascii')
if rpm.labelCompare(('0', p_version, '1'), required_version) < 0:
err = "%s %s is too old" % (p_name, p_version)
else:
err = None

Expand Down Expand Up @@ -325,8 +327,10 @@ def get_puppet_version():
for name in ['puppet', 'puppet-agent']:
db_results = transaction_set.dbMatch('name', name)
for result in db_results:
puppet_major_version = int(result['version'].split('.')[0])
if result['name'] == 'puppet-agent' and puppet_major_version == 1:
package_name = result['name'].decode('ascii')
package_version = result['version'].decode('ascii')
puppet_major_version = int(package_version.split('.')[0])
if package_name == 'puppet-agent' and puppet_major_version == 1:
puppet_major_version = 4
return puppet_major_version

Expand Down Expand Up @@ -1054,8 +1058,9 @@ def check_rpm_installed():
transaction_set = rpm.TransactionSet()
db_results = transaction_set.dbMatch()
for package in db_results:
if package['name'] in rpm_sat:
print_error("%s RPM found. bootstrap.py should not be used on a Katello/Spacewalk/Satellite host." % (package['name']))
package_name = package['name'].decode('ascii')
if package_name in rpm_sat:
print_error("%s RPM found. bootstrap.py should not be used on a Katello/Spacewalk/Satellite host." % (package_name))
sys.exit(1)


Expand Down