Пример #1
0
def simplex_main():
    backup_file = None
    arg = 1
    while arg < len(sys.argv):
        if sys.argv[arg] in ['--help', '-h', '-?']:
            show_help_simplex()
            exit(1)
        elif arg == 1:
            backup_file = sys.argv[arg]
        else:
            print("Invalid option %s. Use --help for more information." %
                  sys.argv[arg])
            exit(1)
        arg += 1

    log.configure()

    if not backup_file:
        print("The BACKUP_FILE must be specified")
        exit(1)

    try:
        upgrade_controller_simplex(backup_file)
    except Exception as e:
        LOG.exception(e)
        print("Upgrade failed: {}".format(e))
        # TODO SET Upgrade fail flag
        # Set upgrade fail flag on mate controller
        exit(1)
Пример #2
0
def main():
    if (len(sys.argv) < 2 or sys.argv[1] in ['--help', '-h', '-?']):
        show_help()
        exit(1)

    log.configure()

    result_file = sys.argv[1]

    try:
        open(result_file, 'w')
    except IOError:
        raise TidyStorageFail("Failed to open file: %s" % result_file)
        exit(1)

    tidy_storage(result_file)
Пример #3
0
def main():

    from_release = None
    to_release = None
    arg = 1
    while arg < len(sys.argv):
        if sys.argv[arg] in ['--help', '-h', '-?']:
            show_help()
            exit(1)
        elif arg == 1:
            from_release = sys.argv[arg]
        elif arg == 2:
            to_release = sys.argv[arg]
        else:
            print("Invalid option %s. Use --help for more information." %
                  sys.argv[arg])
            exit(1)
        arg += 1

    log.configure()

    if not from_release or not to_release:
        print("Both the FROM_RELEASE and TO_RELEASE must be specified")
        exit(1)

    try:
        upgrade_controller(from_release, to_release)
    except Exception as e:
        LOG.exception(e)
        print("Upgrade failed: {}".format(e))

        # Set upgrade fail flag on mate controller
        LOG.info("Set upgrade fail flag on mate controller")
        os.mkdir("/tmp/etc_platform")
        nfs_mount_filesystem("/etc/platform", "/tmp/etc_platform")
        upgrade_fail_flag_file = os.path.join(
            "/tmp/etc_platform",
            os.path.basename(CONTROLLER_UPGRADE_FAIL_FLAG))
        open(upgrade_fail_flag_file, "w").close()
        unmount_filesystem("/tmp/etc_platform")
        os.rmdir("/tmp/etc_platform")

        exit(1)