Exemplo n.º 1
0
def main():
    global MyPatching, backup_logger, hutil, run_result, run_status, error_msg, freezer, freeze_result, snapshot_info_array, total_used_size, size_calculation_failed, patch_class_name, orig_distro
    try:
        run_result = CommonVariables.success
        run_status = 'success'
        error_msg = ''
        freeze_result = None
        snapshot_info_array = None
        total_used_size = 0
        size_calculation_failed = False
        HandlerUtil.waagent.LoggerInit('/dev/console', '/dev/stdout')
        hutil = HandlerUtil.HandlerUtility(HandlerUtil.waagent.Log,
                                           HandlerUtil.waagent.Error,
                                           CommonVariables.extension_name)
        backup_logger = Backuplogger(hutil)
        MyPatching, patch_class_name, orig_distro = GetMyPatching(
            backup_logger)
        hutil.patching = MyPatching
        for a in sys.argv[1:]:
            if re.match("^([-/]*)(disable)", a):
                disable()
            elif re.match("^([-/]*)(uninstall)", a):
                uninstall()
            elif re.match("^([-/]*)(install)", a):
                install()
            elif re.match("^([-/]*)(enable)", a):
                enable()
            elif re.match("^([-/]*)(update)", a):
                update()
            elif re.match("^([-/]*)(daemon)", a):
                daemon()
    except Exception as e:
        sys.exit(0)
Exemplo n.º 2
0
def main():
    global MyPatching, backup_logger, hutil, run_result, run_status, error_msg, freezer, freeze_result, unfreeze_result, snapshot_result, snapshot_done
    snapshot_done = False
    run_result = CommonVariables.success
    run_status = 'success'
    error_msg = ''
    freeze_result = None
    unfreeze_result = None
    snapshot_result = None
    HandlerUtil.LoggerInit('/var/log/waagent.log', '/dev/stdout')
    HandlerUtil.waagent.Log("%s started to handle." %
                            (CommonVariables.extension_name))
    hutil = HandlerUtil.HandlerUtility(HandlerUtil.waagent.Log,
                                       HandlerUtil.waagent.Error,
                                       CommonVariables.extension_name)
    backup_logger = Backuplogger(hutil)
    MyPatching = GetMyPatching(logger=backup_logger)
    hutil.patching = MyPatching

    for a in sys.argv[1:]:
        if re.match("^([-/]*)(disable)", a):
            disable()
        elif re.match("^([-/]*)(uninstall)", a):
            uninstall()
        elif re.match("^([-/]*)(install)", a):
            install()
        elif re.match("^([-/]*)(enable)", a):
            enable()
        elif re.match("^([-/]*)(update)", a):
            update()
        elif re.match("^([-/]*)(daemon)", a):
            daemon()
def main():
    global MyPatching,backup_logger,hutil
    HandlerUtil.LoggerInit('/var/log/waagent.log','/dev/stdout')
    HandlerUtil.waagent.Log("%s started to handle." % (CommonVariables.extension_name)) 
    hutil = HandlerUtil.HandlerUtility(HandlerUtil.waagent.Log, HandlerUtil.waagent.Error, CommonVariables.extension_name)
    backup_logger = Backuplogger(hutil)
    MyPatching = GetMyPatching(logger = backup_logger)
    for a in sys.argv[1:]:
        if re.match("^([-/]*)(disable)", a):
            disable()
        elif re.match("^([-/]*)(uninstall)", a):
            uninstall()
        elif re.match("^([-/]*)(install)", a):
            install()
        elif re.match("^([-/]*)(enable)", a):
            enable()
        elif re.match("^([-/]*)(update)", a):
            update()