Ejemplo n.º 1
0
def database_menu():
	ds.datasyncBanner(dsappversion)
	print "The database menu will require Mobility to be stopped"
	if ds.askYesOrNo("Stop Mobility now"):
		ds.datasyncBanner(dsappversion)
		ds.rcDS('stop')
		menu = ['1. Vacuum Databases', '2. Re-Index Databases', '\n     3. Back up Databases', '4. Restore Databases', '\n     5. Recreate Global Address Book (GAL)', '6. Fix targets/membershipCache', '\n     7. CUSO Clean-Up Start-Over', '\n     0. Back -- Start Mobility']

		available = build_avaialbe(menu)
		loop = True
		while loop:
			show_menu(menu)
			choice = get_choice(available)
			if choice == '1':
				ds.datasyncBanner(dsappversion)
				print textwrap.fill("The amount of time this takes can vary depending on the last time it was completed. It is recommended that this be run every 6 months.", 80)
				print
				if ds.askYesOrNo("Do you want to continue"):
					ds.vacuumDB(dbConfig)
					print
					ds.eContinue()
			elif choice == '2':
				ds.datasyncBanner(dsappversion)
				print textwrap.fill("The amount of time this takes can vary depending on the last time it was completed. It is recommended that this be run after a database vacuum.", 80)
				print
				if ds.askYesOrNo("Do you want to continue"):
					ds.indexDB(dbConfig)
					print
					ds.eContinue()
			elif choice == '3':
				ds.backupDatabase(dbConfig)
				print; ds.eContinue()
			elif choice == '4':
				ds.restoreDatabase(dbConfig)
				print; ds.eContinue()
			elif choice == '5':
				ds.fix_gal(dbConfig)
				print; ds.eContinue()
			elif choice == '6':
				ds.addGroup(dbConfig, ldapConfig)
				print; ds.eContinue()
			elif choice == '7':
				cuso_menu()
			elif choice == '0':
				loop = False
				ds.datasyncBanner(dsappversion)
				ds.rcDS('start')
				main_menu()
	else:
		main_menu()
Ejemplo n.º 2
0
# Show sync status
if args.status:
	ds.showStatus(dbConfig)
	print; ds.eContinue()
	sys.exit(0)

# Update mobility URL
if args.update:
	ds.updateMobilityFTP()
	ds.eContinue()
	sys.exit(0)

# Vacuum db
if args.vacuum:
	ds.rcDS('stop')
	ds.vacuumDB(dbConfig)
	if args.index:
		ds.indexDB(dbConfig)
	ds.rcDS('start')
	ds.eContinue()
	sys.exit(0)

# Index db
if args.index:
	ds.rcDS('stop')
	ds.indexDB(dbConfig)
	if args.vacuum:
		ds.vacuumDB(dbConfig)
	ds.rcDS('start')
	ds.eContinue()
	sys.exit(0)
Ejemplo n.º 3
0
def database_menu():
    ds.datasyncBanner()
    print "The database menu will require Mobility to be stopped"
    if ds.askYesOrNo("Stop Mobility now"):
        ds.datasyncBanner()
        ds.rcDS('stop')
        menu = [
            '1. Vacuum Databases', '2. Re-Index Databases',
            '\n     3. Back up Databases', '4. Restore Databases',
            '\n     5. Recreate Global Address Book (GAL)',
            '6. Fix targets/membershipCache',
            '\n     7. CUSO Clean-Up Start-Over',
            '\n     0. Back -- Start Mobility'
        ]

        available = build_avaialbe(menu)
        loop = True
        while loop:
            show_menu(menu)
            choice = get_choice(available)
            if choice == '1':
                ds.datasyncBanner()
                print textwrap.fill(
                    "The amount of time this takes can vary depending on the last time it was completed. It is recommended that this be run every 6 months.",
                    80)
                print
                if ds.askYesOrNo("Do you want to continue"):
                    ds.vacuumDB()
                    print
                    ds.eContinue()
            elif choice == '2':
                ds.datasyncBanner()
                print textwrap.fill(
                    "The amount of time this takes can vary depending on the last time it was completed. It is recommended that this be run after a database vacuum.",
                    80)
                print
                if ds.askYesOrNo("Do you want to continue"):
                    ds.indexDB()
                    print
                    ds.eContinue()
            elif choice == '3':
                ds.backupDatabase()
                print
                ds.eContinue()
            elif choice == '4':
                ds.restoreDatabase()
                print
                ds.eContinue()
            elif choice == '5':
                ds.fix_gal()
                print
                ds.eContinue()
            elif choice == '6':
                ds.addGroup()
                print
                ds.eContinue()
            elif choice == '7':
                cuso_menu()
            elif choice == '0':
                loop = False
                ds.datasyncBanner()
                ds.rcDS('start')
                main_menu()
    else:
        main_menu()
Ejemplo n.º 4
0
    print
    ds.eContinue()
    sys.exit(0)

# Update mobility URL
if args.update:
    logger.info("Running switch: update")
    ds.updateMobilityFTP()
    ds.eContinue()
    sys.exit(0)

# Vacuum db
if args.vacuum:
    logger.info("Running switch: vacuum")
    ds.rcDS('stop')
    ds.vacuumDB()
    if args.index:
        logger.info("Running switch: index")
        ds.indexDB()
    ds.rcDS('start')
    ds.eContinue()
    sys.exit(0)

# Index db
if args.index:
    logger.info("Running switch: index")
    ds.rcDS('stop')
    ds.indexDB()
    if args.vacuum:
        logger.info("Running switch: vacuum")
        ds.vacuumDB()