Skip to content

Instantly share code, notes, and snippets.

@r0x0d
Created January 4, 2024 14:12
Show Gist options
  • Save r0x0d/a4263c2c79aba16e3332681f77b47875 to your computer and use it in GitHub Desktop.
Save r0x0d/a4263c2c79aba16e3332681f77b47875 to your computer and use it in GitHub Desktop.
import yum
from convert2rhel.pkgmanager.handlers.yum.callback import PackageDownloadCallback, TransactionDisplayCallback
base = yum.YumBase()
base.conf.yumvar["releasever"] = "7Server"
base.repos.disableRepo("*")
base.repos.enableRepo("rhel-7-server-rpms")
base.repos.setProgressBar(PackageDownloadCallback())
can_update = base.update(pattern="httpd")
print(can_update)
# In test mode to not override the system
base.conf.tsflags.append("test")
# Process transaction and see what happens
base.processTransaction(rpmDisplay=TransactionDisplayCallback())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment