예제 #1
0
    def get_activated_be_name(bootnext=False):
        """Gets the name of the currently activated boot environment.
                If 'bootnext' is true, then also consider temporary (bootnext)
                activations """
        try:
            beList = BootEnv.get_be_list()
            name = None

            for be in beList:
                # don't look at active but unbootable BEs.
                # (happens in zones when we have ZBEs
                # associated with other global zone BEs.)
                if be.get("active_unbootable", False):
                    continue
                if not be.get("global_active", True):
                    continue
                if (bootnext and be.get("active_nextboot", False)):
                    return be.get("orig_be_name")
                if be.get("active_boot"):
                    name = be.get("orig_be_name")
                    if not bootnext:
                        break
            return name
        except AttributeError:
            raise api_errors.BENamingNotSupported(be_name)
예제 #2
0
    def get_active_be_name():
        try:
            beList = BootEnv.get_be_list()

            for be in beList:
                if be.get("active"):
                    return be.get("orig_be_name")
        except AttributeError:
            raise api_errors.BENamingNotSupported(be_name)
예제 #3
0
        def get_activated_be_name():
                try:
                        beList = BootEnv.get_be_list()

                        for be in beList:
                                # don't look at active but unbootable BEs.
                                # (happens in zones when we have ZBEs
                                # associated with other global zone BEs.)
                                if be.get("active_unbootable", False):
                                        continue
                                if be.get("active_boot") and be.get("global_active", True):
                                        return be.get("orig_be_name")
                except AttributeError:
                        raise api_errors.BENamingNotSupported(be_name)
예제 #4
0
    def check_be_name(be_name):
        try:
            if be_name is None:
                return

            if be.beVerifyBEName(be_name) != 0:
                raise api_errors.InvalidBENameException(be_name)

            beList = BootEnv.get_be_list()

            # If there is already a BE with the same name as
            # be_name, then raise an exception.
            if be_name in (be.get("orig_be_name") for be in beList):
                raise api_errors.DuplicateBEName(be_name)
        except AttributeError:
            raise api_errors.BENamingNotSupported(be_name)
예제 #5
0
    def check_be_name(be_name):
        try:
            if be_name is None:
                return

            if be.beVerifyBEName(be_name) != 0:
                raise api_errors.InvalidBENameException(be_name)

            # Check for the old beList() API since pkg(1) can be
            # back published and live on a system without the
            # latest libbe.
            beVals = be.beList()
            if isinstance(beVals[0], int):
                rc, beList = beVals
            else:
                beList = beVals

            # If there is already a BE with the same name as
            # be_name, then raise an exception.
            if be_name in (be.get("orig_be_name") for be in beList):
                raise api_errors.DuplicateBEName(be_name)
        except AttributeError:
            raise api_errors.BENamingNotSupported(be_name)
예제 #6
0
 def check_be_name(be_name):
     if be_name:
         raise api_errors.BENamingNotSupported(be_name)