def warnOrGiveUsageMessage(conduit):
    """ either output a warning, or a usage message """
    msg = ""
    # TODO: refactor so there are not two checks for this
    if os.getuid() != 0:
        return
    try:
        try:
            ConsumerIdentity.read().getConsumerId()
            entdir = EntitlementDirectory()
            if len(entdir.listValid()) == 0:
                msg = no_subs_warning
            else:
                msg = repo_usage_message
        except:
            msg = not_registered_warning
    finally:
        conduit.info(2, msg)
Ejemplo n.º 2
0
def warnOrGiveUsageMessage(conduit):

    # XXX: Importing inline as you must be root to read the config file
    from subscription_manager.certlib import ConsumerIdentity
    """ either output a warning, or a usage message """
    msg = ""
    # TODO: refactor so there are not two checks for this
    if os.getuid() != 0:
        return
    try:
        try:
            ConsumerIdentity.read().getConsumerId()
            entdir = EntitlementDirectory()
            if len(entdir.listValid()) == 0:
                msg = no_subs_warning
            else:
                msg = registered_message
        except:
            msg = not_registered_warning
    finally:
        conduit.info(2, msg)
def warnOrGiveUsageMessage(conduit):

    # XXX: Importing inline as you must be root to read the config file
    from subscription_manager.certlib import ConsumerIdentity

    """ either output a warning, or a usage message """
    msg = ""
    # TODO: refactor so there are not two checks for this
    if os.getuid() != 0:
        return
    try:
        try:
            ConsumerIdentity.read().getConsumerId()
            entdir = EntitlementDirectory()
            if len(entdir.listValid()) == 0:
                msg = no_subs_warning
            else:
                msg = registered_message
        except:
            msg = not_registered_warning
    finally:
        conduit.info(2, msg)