package_availability.py 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. # pylint: disable=missing-docstring
  2. from openshift_checks import OpenShiftCheck, get_var
  3. from openshift_checks.mixins import NotContainerizedMixin
  4. class PackageAvailability(NotContainerizedMixin, OpenShiftCheck):
  5. """Check that required RPM packages are available."""
  6. name = "package_availability"
  7. tags = ["preflight"]
  8. def run(self, tmp, task_vars):
  9. rpm_prefix = get_var(task_vars, "openshift", "common", "service_type")
  10. group_names = get_var(task_vars, "group_names", default=[])
  11. packages = set()
  12. if "masters" in group_names:
  13. packages.update(self.master_packages(rpm_prefix))
  14. if "nodes" in group_names:
  15. packages.update(self.node_packages(rpm_prefix))
  16. args = {"packages": sorted(set(packages))}
  17. return self.execute_module("check_yum_update", args, tmp, task_vars)
  18. @staticmethod
  19. def master_packages(rpm_prefix):
  20. return [
  21. "{rpm_prefix}".format(rpm_prefix=rpm_prefix),
  22. "{rpm_prefix}-clients".format(rpm_prefix=rpm_prefix),
  23. "{rpm_prefix}-master".format(rpm_prefix=rpm_prefix),
  24. "bash-completion",
  25. "cockpit-bridge",
  26. "cockpit-docker",
  27. "cockpit-kubernetes",
  28. "cockpit-shell",
  29. "cockpit-ws",
  30. "etcd",
  31. "httpd-tools",
  32. ]
  33. @staticmethod
  34. def node_packages(rpm_prefix):
  35. return [
  36. "{rpm_prefix}".format(rpm_prefix=rpm_prefix),
  37. "{rpm_prefix}-node".format(rpm_prefix=rpm_prefix),
  38. "{rpm_prefix}-sdn-ovs".format(rpm_prefix=rpm_prefix),
  39. "bind",
  40. "ceph-common",
  41. "dnsmasq",
  42. "docker",
  43. "firewalld",
  44. "flannel",
  45. "glusterfs-fuse",
  46. "iptables-services",
  47. "iptables",
  48. "iscsi-initiator-utils",
  49. "libselinux-python",
  50. "nfs-utils",
  51. "ntp",
  52. "openssl",
  53. "pyparted",
  54. "python-httplib2",
  55. "PyYAML",
  56. "yum-utils",
  57. ]