Beispiel #1
0
    def _check_patch_requirements(region_name,
                                  applied_patches=None,
                                  available_patches=None):
        """Checks whether specified patches are applied or available"""

        api_token = None
        if applied_patches:
            patches_applied = patch_api.patch_is_applied(
                token=api_token,
                timeout=constants.PATCH_DEFAULT_TIMEOUT_IN_SECS,
                region_name=region_name,
                patches=applied_patches)
            if not patches_applied:
                raise wsme.exc.ClientSideError(
                    _("The following patches must be applied before doing "
                      "the kubernetes upgrade: %s" % applied_patches))

        if available_patches:
            patches_available = patch_api.patch_is_available(
                token=api_token,
                timeout=constants.PATCH_DEFAULT_TIMEOUT_IN_SECS,
                region_name=region_name,
                patches=available_patches)
            if not patches_available:
                raise wsme.exc.ClientSideError(
                    _("The following patches must be available before doing "
                      "the kubernetes upgrade: %s" % available_patches))
Beispiel #2
0
 def _check_patch_is_applied(self, patches):
     try:
         system = self._dbapi.isystem_get_one()
         response = patch_api.patch_is_applied(
             token=None,
             timeout=constants.PATCH_DEFAULT_TIMEOUT_IN_SECS,
             region_name=system.region_name,
             patches=patches)
     except Exception as e:
         LOG.error(e)
         raise exception.SysinvException(
             _("Error while querying patch-controller for the "
               "state of the patch(es)."))
     return response