Mini Shell

Direktori : /opt/saltstack/salt/extras-3.10/rads/
Upload File :
Current File : //opt/saltstack/salt/extras-3.10/rads/ha.py

"""Backwards compat for rads.ha"""
import sys
import distro
import rads
from .compat import deprecated


@deprecated('rads.vz.is_vz')
def check_if_vz():
    """deprecated"""
    return rads.vz.is_vz()


@deprecated('distro.major_version')
def get_os_maj_version():
    """deprecated"""
    return distro.major_version()


@deprecated('rads.vz.is_vz7')
def check_vz7():
    """deprecated"""
    return rads.vz.is_vz7()


@deprecated('rads.vz.is_ct_running')
def is_container_running(ctid):
    """deprecated"""
    return rads.vz.is_ct_running(ctid)


@deprecated('rads.vz.uuid2ctid')
def get_name(ctid):
    """deprecated"""
    try:
        return rads.vz.uuid2ctid(ctid)
    except rads.vz.VZError as exc:
        # the old lib never raised errors
        print(repr(exc), file=sys.stderr)
        return None


@deprecated('rads.vz.get_envid')
def get_envid(ctid):
    """deprecated"""
    try:
        return rads.vz.get_envid(ctid)
    except rads.vz.VZError as exc:
        # the old lib never raised errors
        print(repr(exc), file=sys.stderr)
        return None


@deprecated('rads.vz.ctid2uuid')
def get_uuid(ctid):
    """deprecated"""
    try:
        return rads.vz.ctid2uuid(ctid)
    except rads.vz.VZError as exc:
        # old lib never raised errors
        print(repr(exc), file=sys.stderr)
        return None


@deprecated('rads.vz.get_cts')
def get_cts(*args, **kwargs):
    """deprecated"""
    # args changed from old version
    kwd = []
    if 'all' in kwargs:
        kwd.append('--all')
    return rads.vz.get_cts(list(args), kwd)

Zerion Mini Shell 1.0