示例#1
0
    def autoentitle(self):
        entitlement_hierarchy = ['enterprise_entitled']

        any_base_entitlements = 0

        for entitlement in entitlement_hierarchy:
            try:
                self._entitle(entitlement)
                any_base_entitlements = 1
            except rhnSQL.SQLSchemaError:
                e = sys.exc_info()[1]
                if e.errno == 20287:
                    # ORA-20287: (invalid_entitlement) - The server can not be
                    # entitled to the specified level
                    #
                    # ignore for now, since any_base_entitlements will throw
                    # an error at the end if not set
                    continue

                # Should not normally happen
                log_error("Failed to entitle", self.server["id"], entitlement,
                          e.errmsg)
                raise_with_tb(server_lib.rhnSystemEntitlementException("Unable to entitle"), sys.exc_info()[2])
            except rhnSQL.SQLError:
                e = sys.exc_info()[1]
                log_error("Failed to entitle", self.server["id"], entitlement,
                          str(e))
                raise_with_tb(server_lib.rhnSystemEntitlementException("Unable to entitle"), sys.exc_info()[2])
            else:
                if any_base_entitlements:
                    # All is fine
                    return
                else:
                    raise_with_tb(server_lib.rhnNoSystemEntitlementsException, sys.exc_info()[2])
示例#2
0
    def autoentitle(self):
        entitlement_hierarchy = ['enterprise_entitled']

        any_base_entitlements = 0

        for entitlement in entitlement_hierarchy:
            try:
                self._entitle(entitlement)
                any_base_entitlements = 1
            except rhnSQL.SQLSchemaError, e:
                if e.errno == 20287:
                    # ORA-20287: (invalid_entitlement) - The server can not be
                    # entitled to the specified level
                    #
                    # ignore for now, since any_base_entitlements will throw
                    # an error at the end if not set
                    continue

                # Should not normally happen
                log_error("Failed to entitle", self.server["id"], entitlement,
                          e.errmsg)
                raise server_lib.rhnSystemEntitlementException(
                    "Unable to entitle"), None, sys.exc_info()[2]
            except rhnSQL.SQLError, e:
                log_error("Failed to entitle", self.server["id"], entitlement,
                          str(e))
                raise server_lib.rhnSystemEntitlementException(
                    "Unable to entitle"), None, sys.exc_info()[2]
示例#3
0
    def autoentitle(self):
        # misa: as of 2005-05-27 nonlinux does not get a special treatment
        # anymore (this is in connection to feature 145440 - entitlement model
        # changes
        entitlement_hierarchy = ['enterprise_entitled', 'sw_mgr_entitled']

        any_base_entitlements = 0

        for entitlement in entitlement_hierarchy:
            try:
                self._entitle(entitlement)
                any_base_entitlements = 1
            except rhnSQL.SQLSchemaError, e:
                if e.errno == 20220:
                    # ORA-20220: (servergroup_max_members) - Server group
                    # membership cannot excede maximum membership
                    #
                    # ignore for now, since any_base_entitlements will throw
                    # an error at the end if not set
                    continue

                if e.errno == 20287:
                    # ORA-20287: (invalid_entitlement) - The server can not be
                    # entitled to the specified level
                    #
                    # ignore for now, since any_base_entitlements will throw
                    # an error at the end if not set
                    continue

                # Should not normally happen
                log_error("Failed to entitle", self.server["id"], entitlement,
                          e.errmsg)
                raise server_lib.rhnSystemEntitlementException(
                    "Unable to entitle"), None, sys.exc_info()[2]
            except rhnSQL.SQLError, e:
                log_error("Failed to entitle", self.server["id"], entitlement,
                          str(e))
                raise server_lib.rhnSystemEntitlementException(
                    "Unable to entitle"), None, sys.exc_info()[2]
示例#4
0
    def autoentitle(self):
        # misa: as of 2005-05-27 nonlinux does not get a special treatment
        # anymore (this is in connection to feature 145440 - entitlement model
        # changes
        entitlement_hierarchy = ['enterprise_entitled', 'sw_mgr_entitled']

        any_base_entitlements = 0

        for entitlement in entitlement_hierarchy:
            try:
                self._entitle(entitlement)
                any_base_entitlements = 1
            except rhnSQL.SQLSchemaError, e:
                if e.errno == 20220:
                    # ORA-20220: (servergroup_max_members) - Server group
                    # membership cannot excede maximum membership
                    #
                    # ignore for now, since any_base_entitlements will throw
                    # an error at the end if not set
                    continue

                if e.errno == 20287:
                    # ORA-20287: (invalid_entitlement) - The server can not be
                    # entitled to the specified level
                    #
                    # ignore for now, since any_base_entitlements will throw
                    # an error at the end if not set
                    continue


                # Should not normally happen
                log_error("Failed to entitle", self.server["id"], entitlement,
                    e.errmsg)
                raise server_lib.rhnSystemEntitlementException("Unable to entitle"), None, sys.exc_info()[2]
            except rhnSQL.SQLError, e:
                log_error("Failed to entitle", self.server["id"], entitlement,
                    str(e))
                raise server_lib.rhnSystemEntitlementException("Unable to entitle"), None, sys.exc_info()[2]