def schedule_virt_host_pkg_install(server_id, action_id, dry_run=0): """ ShadowAction that schedules a package installation action for the rhn-virtualization-host and osad packages. """ log_debug(3) virt_host_package_name = "mgr-virtualization-host" messaging_package_name = "mgr-osad" tools_channel = SubscribedChannel(server_id, "rhn-tools") found_tools_channel = tools_channel.is_subscribed_to_channel() if not found_tools_channel: raise InvalidAction("System not subscribed to the Tools channel.") rhn_v12n_package = ChannelPackage(server_id, virt_host_package_name) if not rhn_v12n_package.exists(): raise InvalidAction( "Could not find the mgr-virtualization-host package.") messaging_package = ChannelPackage(server_id, messaging_package_name) if not messaging_package.exists(): raise InvalidAction("Could not find the mgr-osad package.") try: rhn_v12n_install_scheduler = PackageInstallScheduler( server_id, action_id, rhn_v12n_package) messaging_package = PackageInstallScheduler(server_id, action_id, messaging_package) if (not dry_run): rhn_v12n_install_scheduler.schedule_package_install() messaging_package.schedule_package_install() else: log_debug(4, "dry run requested") except NoActionInfo: nai = sys.exc_info()[1] raise_with_tb(InvalidAction(str(nai)), sys.exc_info()[2]) except PackageNotFound: pnf = sys.exc_info()[1] raise_with_tb(InvalidAction(str(pnf)), sys.exc_info()[2]) except Exception: e = sys.exc_info()[1] raise_with_tb(InvalidAction(str(e)), sys.exc_info()[2]) log_debug( 3, "Completed scheduling install of mgr-virtualization-host and mgr-osad!" ) raise ShadowAction( "Scheduled installation of Virtualization Host packages.")
def schedule_virt_guest_pkg_install(server_id, action_id, dry_run=0): """ ShadowAction that schedules a package installation action for the rhn-virtualization-guest package. """ log_debug(3) virt_host_package_name = "rhn-virtualization-guest" tools_channel = SubscribedChannel(server_id, "rhn-tools") found_tools_channel = tools_channel.is_subscribed_to_channel() if not found_tools_channel: raise InvalidAction("System not subscribed to the RHN Tools channel.") rhn_v12n_package = ChannelPackage(server_id, virt_host_package_name) if not rhn_v12n_package.exists(): raise InvalidAction( "Could not find the rhn-virtualization-guest package.") try: install_scheduler = PackageInstallScheduler(server_id, action_id, rhn_v12n_package) if (not dry_run): install_scheduler.schedule_package_install() else: log_debug(4, "dry run requested") except NoActionInfo, nai: raise InvalidAction(str(nai)), None, sys.exc_info()[2]
def schedule_virt_guest_pkg_install(server_id, action_id, dry_run=0): """ ShadowAction that schedules a package installation action for the rhn-virtualization-guest package. """ log_debug(3) virt_host_package_name = "rhn-virtualization-guest" tools_channel = SubscribedChannel(server_id, "rhn-tools") found_tools_channel = tools_channel.is_subscribed_to_channel() if not found_tools_channel: raise InvalidAction("System not subscribed to the RHN Tools channel.") rhn_v12n_package = ChannelPackage(server_id, virt_host_package_name) if not rhn_v12n_package.exists(): raise InvalidAction("Could not find the rhn-virtualization-guest package.") try: install_scheduler = PackageInstallScheduler(server_id, action_id, rhn_v12n_package) if (not dry_run): install_scheduler.schedule_package_install() else: log_debug(4, "dry run requested") except NoActionInfo, nai: raise InvalidAction(str(nai)), None, sys.exc_info()[2]
def schedule_virt_host_pkg_install(server_id, action_id, dry_run=0): """ ShadowAction that schedules a package installation action for the rhn-virtualization-host and osad packages. """ log_debug(3) virt_host_package_name = "rhn-virtualization-host" messaging_package_name = "osad" tools_channel = SubscribedChannel(server_id, "rhn-tools") found_tools_channel = tools_channel.is_subscribed_to_channel() if not found_tools_channel: raise InvalidAction("System not subscribed to the RHN Tools channel.") rhn_v12n_package = ChannelPackage(server_id, virt_host_package_name) if not rhn_v12n_package.exists(): raise InvalidAction("Could not find the rhn-virtualization-host package.") messaging_package = ChannelPackage(server_id, messaging_package_name) if not messaging_package.exists(): raise InvalidAction("Could not find the osad package.") try: rhn_v12n_install_scheduler = PackageInstallScheduler(server_id, action_id, rhn_v12n_package) messaging_package = PackageInstallScheduler(server_id, action_id, messaging_package) if (not dry_run): rhn_v12n_install_scheduler.schedule_package_install() messaging_package.schedule_package_install() else: log_debug(4, "dry run requested") except NoActionInfo: nai = sys.exc_info()[1] raise_with_tb(InvalidAction(str(nai)), sys.exc_info()[2]) except PackageNotFound: pnf = sys.exc_info()[1] raise_with_tb(InvalidAction(str(pnf)), sys.exc_info()[2]) except Exception: e = sys.exc_info()[1] raise_with_tb(InvalidAction(str(e)), sys.exc_info()[2]) log_debug(3, "Completed scheduling install of rhn-virtualization-host and osad!") raise ShadowAction("Scheduled installation of RHN Virtualization Host packages.")