Example #1
0
def maybe_build_base_devel():
    """


    :return:
    """
    if db.exists('antbs:docker-images:base-devel:built-today'):
        return True

    # No image was built in the past 24 hours, let's build one.
    status.current_status = 'Docker images are stale. Building new images.'
    build_script = os.path.join(DOC_DIR, 'base-devel.sh')
    build_it = False
    try:
        build_it = subprocess.check_output([build_script])
    except subprocess.CalledProcessError as err:
        logger.error('@@-docker_util.py-@@ | Image build script failed with error: %s', err.output)
        return False
    except shutil.Error as err2:
        logger(err2)

    if build_it:
        try:
            # Image was built successfully. Push it to docker hub.
            push_to_hub('antergos/archlinux-base-devel')
        except Exception:
            pass
        mpkg = build_makepkg()
        if not mpkg:
            return False
        db.setex('antbs:docker-images:base-devel:built-today', 84600, 'True')
        return True
    else:
        return False
Example #2
0
def maybe_build_base_devel():
    if db.exists('antbs:docker-images:base-devel:built-today'):
        return True

    # No image was built in the past 24 hours, let's build one.
    build_script = os.path.join(DOC_DIR, 'base-devel.sh')
    build_it = False
    try:
        build_it = subprocess.check_output([build_script])
        shutil.rmtree('/opt/antergos-packages')
    except subprocess.CalledProcessError as err:
        logger.error('@@-docker_util.py-@@ | Image build script failed with error: %s', err.output)
        return False
    except shutil.Error as err2:
        logger(err2)

    if build_it:
        # Image was built successfully. Push it to docker hub.
        push_to_hub('antergos/archlinux-base-devel')
        mpkg = build_makepkg()
        if not mpkg:
            return False
        db.psetex('antbs:docker-images:base-devel:built-today', 304800000, 'True')
        return True
    else:
        return False
Example #3
0
#/usr/bin/python/
""" This file should contain functions need to send SNMP alarms via the trapgen binary program.
This should also contain all the file names of the input files needed for the different applications that may 
send traps.

22/09/2015 : Modified to deal with Latency trap only.

email: [email protected] mob: 0851742253
"""

import commands
import debug
import logging_config

applog = logging_config.logger()

def trapgensend ():
    
    debug.p("Func: trapgensend in trapgen.py")
    f_set_fault = 5
    com_path = ". ./send_trap.sh " + str(f_set_fault) + " " + str('A1:latency')
    debug.p(str(com_path))
    p = commands.getoutput (com_path)
    applog.critical('A1:The system Call Latency has failed according to the criteria' ) 
    
    return
    
           

	
def trapgenclear ():
Example #4
0
#/usr/bin/python/
""" This file should contain functions need to send SNMP alarms via the trapgen binary program.
This should also contain all the file names of the input files needed for the different applications that may 
send traps.

22/09/2015 : Modified to deal with Latency trap only.

email: [email protected] mob: 0851742253
"""

import commands
import debug
import logging_config

applog = logging_config.logger()


def trapgensend():

    debug.p("Func: trapgensend in trapgen.py")
    f_set_fault = 5
    com_path = ". ./send_trap.sh " + str(f_set_fault) + " " + str('A1:latency')
    debug.p(str(com_path))
    p = commands.getoutput(com_path)
    applog.critical(
        'A1:The system Call Latency has failed according to the criteria')

    return


def trapgenclear():