Example #1
0
def cuso_menu():
	menu = ['1. Clean up and start over (Except Users)', '2. Clean up and start over (Everything)', '\n     3. Uninstall Mobility', '\n     0. Back']

	available = build_avaialbe(menu)
	loop = True
	while loop:
		show_menu(menu)
		choice = get_choice(available)
		if choice == '1':
			ds.datasyncBanner(dsappversion)
			if ds.askYesOrNo("Clean up and start over (Except Users)"):
				ds.cuso(dbConfig, 'user')
				print; ds.eContinue()
		elif choice == '2':
			ds.datasyncBanner(dsappversion)
			if ds.askYesOrNo("Clean up and start over (Everything)"):
				ds.cuso(dbConfig, 'everything')
				print; ds.eContinue()
		elif choice == '3':
			ds.datasyncBanner(dsappversion)
			print "Please run 'sh /opt/novell/datasync/uninstall.sh' first"
			if ds.askYesOrNo("Uninstall Mobility"):
				ds.cuso(dbConfig, 'uninstall')
		elif choice == '0':
			loop = False
			return
Example #2
0
def remove_device_menu():
    menu = [
        '1. Remove all devices', '2. Remove user devices', '\n     0. Back'
    ]

    available = build_avaialbe(menu)
    loop = True
    while loop:
        show_menu(menu)
        choice = get_choice(available)
        if choice == '1':
            ds.datasyncBanner()
            if ds.askYesOrNo("Remove all users devices"):
                ds.removeDevice()
        elif choice == '2':
            userConfig = ds.verifyUser()[0]
            if ds.confirm_user(userConfig, 'mobility'):
                if ds.askYesOrNo("Remove all devices for %s" %
                                 userConfig['name']):
                    ds.removeDevice(userConfig)
            else:
                ds.eContinue()
        elif choice == '0':
            loop = False
            return
Example #3
0
def performance_menu():
	menu = ['1. Top device requests','2. Check manual syncing devices', '\n     0. Back']

	available = build_avaialbe(menu)
	loop = True
	while loop:
		show_menu(menu)
		choice = get_choice(available)
		if choice == '1':
			ds.datasyncBanner(dsappversion)
			if ds.askYesOrNo("Parse debug log for top device requests"):
				log = ds.getFilePath("Enter path to mobility-agent log file: ")
				if log is None:
					return
				dsPerformance.getDeviceCommands(log)
				ds.eContinue()

		elif choice == '2':
			ds.datasyncBanner(dsappversion)
			if ds.askYesOrNo("Parse debug log for devices set to manual sync"):
				log = ds.getFilePath("Enter path to mobility-agent log file: ")
				if log is None:
					return
				dsPerformance.getPinglessDevices(log)
				ds.eContinue()

		elif choice == '0':
			loop = False
			return
Example #4
0
def viewAttachments_menu():
    menu = [
        '1. View user attachments', '2. View total attachment size by users',
        '3. Check Mobility attachments count', '\n     0. Back'
    ]

    available = build_avaialbe(menu)
    loop = True
    while loop:
        show_menu(menu)
        choice = get_choice(available)
        if choice == '1':
            ds.view_users_attach()
        elif choice == '2':
            ds.view_attach_byUser()
        elif choice == '3':
            ds.datasyncBanner()
            print(
                "Compare the mobility database ID count, with the mobility filestore ID count"
            )
            if ds.askYesOrNo("This may take some time to complete, continue"):
                ds.check_mob_attachments()
                print
                ds.eContinue()
        elif choice == '0':
            loop = False
            return
Example #5
0
def cuso_menu():
    menu = [
        '1. Clean up and start over (Except Users)',
        '2. Clean up and start over (Everything)',
        '\n     3. Uninstall Mobility', '\n     0. Back'
    ]

    available = build_avaialbe(menu)
    loop = True
    while loop:
        show_menu(menu)
        choice = get_choice(available)
        if choice == '1':
            ds.datasyncBanner()
            if ds.askYesOrNo("Clean up and start over (Except Users)"):
                ds.cuso('user')
                print
                ds.eContinue()
        elif choice == '2':
            ds.datasyncBanner()
            if ds.askYesOrNo("Clean up and start over (Everything)"):
                ds.cuso('everything')
                print
                ds.eContinue()
        elif choice == '3':
            ds.datasyncBanner()
            print "Please run 'sh /opt/novell/datasync/uninstall.sh' first"
            if ds.askYesOrNo("Uninstall Mobility"):
                ds.cuso('uninstall')
        elif choice == '0':
            loop = False
            return
Example #6
0
def debug_menu():
    menu = [
        'DEBUG MENU\n', '1. SOAP - View user folder list',
        '2. SOAP - View user address book list',
        '3. SOAP - getUserListRequest', '4. View verifyUser data',
        '5. View variables', '\n     0. Quit'
    ]
    logger.info("Running DEBUG menu!")

    available = build_avaialbe(menu)
    loop = True
    while loop:
        show_menu(menu)
        choice = get_choice(available)
        if choice == '1':
            logger.info("DEBUG MENU: Checking SOAP folder check")
            userConfig = ds.verifyUser()[0]
            if userConfig['name'] is not None:
                pydoc.pager(str(dsSOAP.soap_checkFolderListTEST(userConfig)))

        elif choice == '2':
            logger.info("DEBUG MENU: Checking SOAP address book check")
            userConfig = ds.verifyUser()[0]
            if userConfig['name'] is not None:
                pydoc.pager(
                    str(dsSOAP.soap_checkAddressBookListTEST(userConfig)))

        elif choice == '3':
            gw_location = "%(sSecure)s://%(gListenAddress)s:%(sPort)s/soap" % glb.gwConfig
            info = "Trusted Name: %s\nTrusted Key: %s\nAddress: %s\n\n" % (
                glb.trustedConfig['name'], glb.trustedConfig['key'],
                gw_location)
            info += str(dsSOAP.soap_getUserList())
            pydoc.pager(info)

        elif choice == '4':
            logger.info("DEBUG MENU: Running verifyUser()")
            for user in ds.verifyUser():
                print user
                print
            ds.eContinue()
        elif choice == '5':
            logger.info("DEBUG MENU: Listing variables")
            saved_variables = ("Database Config:\n%s\n" % glb.dbConfig)
            saved_variables += ("\nLDAP Config:\n%s\n" % glb.ldapConfig)
            saved_variables += ("\nMobility Config:\n%s\n" %
                                glb.mobilityConfig)
            saved_variables += ("\nGroupWise Config:\n%s\n" % glb.gwConfig)
            saved_variables += ("\nTrusted App Config:\n%s\n" %
                                glb.trustedConfig)
            saved_variables += ("\nConfig Files:\n%s\n" % glb.config_files)
            saved_variables += ("\nWeb Config:\n%s\n" % glb.webConfig)
            saved_variables += ("\nAuth Config:\n%s\n" % glb.authConfig)
            pydoc.pager(saved_variables)

        elif choice == '0':
            loop = False
            ds.clear()
            return
Example #7
0
def letsEncrypt_menu():
    a = acme.acme()

    loop = True
    while loop:
        a.clearDNS()
        # Make dynamic menu
        if a.getAcmeInstalled():
            is_acmeInstalled = "Uninstall"
        else:
            is_acmeInstalled = "Install"
        if a.getCronInstalled():
            is_cronInstalled = "Uninstall"
        else:
            is_cronInstalled = "Setup"
    # Dynamic menu based on acme or cron installed
        menu = [
            '1. %s acme.sh' % is_acmeInstalled, '2. Issue certificate',
            '\n     3. %s auto renew' % is_cronInstalled, '\n     0. Back'
        ]

        available = build_avaialbe(menu)

        show_menu(menu)
        choice = get_choice(available)
        if choice == '1':
            if not a.getAcmeInstalled():
                ds.datasyncBanner()
                a.setupAcme()
                print
                ds.eContinue()
            else:
                ds.datasyncBanner()
                a.removeAcme()
                print
                ds.eContinue()
        elif choice == '2':
            ds.datasyncBanner()
            a.autoIssue()
            print
            ds.eContinue()
        elif choice == '3':
            if not a.getCronInstalled():
                ds.datasyncBanner()
                a.setAutoRenew()
                print
                ds.eContinue()
            else:
                ds.datasyncBanner()
                a.uninstallAutoRenew()
                print
                ds.eContinue()
        elif choice == '0':
            loop = False
            return
Example #8
0
def certificate_menu():
	menu = ['1. Generate CSR & Private key', '2. Generate self-signed certificate', '3. Apply certificates (Generate PEM)', '\n     4. Verify certificate / key pair', '\n     0. Back']

	available = build_avaialbe(menu)
	loop = True
	while loop:
		show_menu(menu)
		choice = get_choice(available)
		if choice == '1':
			ds.createCSRKey()
			print; ds.eContinue()
		elif choice == '2': # TODO : Finish
			ds.pre_signCert()
			print; ds.eContinue()
		# elif choice == '3':
		# 	ds.createCSRKey(True)
		# 	print; ds.eContinue()
		elif choice == '3':
			ds.createPEM()
			print; ds.eContinue()
		elif choice == '4':
			ds.verifyCertifiateMatch()
			print; ds.eContinue()
		elif choice == '0':
			loop = False
			main_menu()
Example #9
0
def debug_menu():
	menu = ['DEBUG MENU\n','1. SOAP - View user folder list', '2. SOAP - View user address book list', '3. SOAP - getUserListRequest', '4. View verifyUser data', '5. View variables', '\n     0. Quit']
	logger.info("Running DEBUG menu!")

	available = build_avaialbe(menu)
	loop = True
	while loop:
		show_menu(menu)
		choice = get_choice(available)
		if choice == '1':
			logger.info("DEBUG MENU: Checking SOAP folder check")
			userConfig = ds.verifyUser(dbConfig)[0]
			if userConfig['name'] is not None:
				pydoc.pager(str(dsSOAP.soap_checkFolderListTEST(trustedConfig, gwConfig, userConfig)))

		elif choice == '2':
			logger.info("DEBUG MENU: Checking SOAP folder check")
			userConfig = ds.verifyUser(dbConfig)[0]
			if userConfig['name'] is not None:
				pydoc.pager(str(dsSOAP.soap_checkAddressBookListTEST(trustedConfig, gwConfig, userConfig)))

		elif choice =='3':
			gw_location = "%(sSecure)s://%(gListenAddress)s:%(sPort)s/soap" % gwConfig
			info = "Trusted Name: %s\nTrusted Key: %s\nAddress: %s\n\n" % (trustedConfig['name'], trustedConfig['key'],gw_location)
			info += str(dsSOAP.soap_getUserList(trustedConfig, gwConfig))
			pydoc.pager(info)

		elif choice == '4':
			logger.info("DEBUG MENU: Running verifyUser()")
			for user in ds.verifyUser(dbConfig):
				print user
				print
			ds.eContinue()
		elif choice == '5':
			logger.info("DEBUG MENU: Listing variables")
			saved_variables = ("Database Config:\n%s\n" % dbConfig)
			saved_variables += ("\nLDAP Config:\n%s\n" % ldapConfig)
			saved_variables += ("\nMobility Config:\n%s\n" % mobilityConfig)
			saved_variables += ("\nGroupWise Config:\n%s\n" % gwConfig)
			saved_variables += ("\nTrusted App Config:\n%s\n" % trustedConfig)
			saved_variables += ("\nConfig Files:\n%s\n" % config_files)
			saved_variables += ("\nWeb Config:\n%s\n" % webConfig)
			saved_variables += ("\nAuth Config:\n%s\n" % authConfig)
			pydoc.pager(saved_variables)

		elif choice == '0':
			loop = False
			ds.clear()
			return
Example #10
0
def exit_cleanup():
	logger.debug("Running exit cleanup..")
	try:
		if spinner.isAlive():
			spinner.stop()
			print;ds.eContinue()
	except NameError:
		pass

	# Clear dsapp/tmp
	ds.removeAllFolders(dsapptmp)
	ds.removeAllFiles(dsapptmp)

	# Reset terminal (for blank text bug on Ctrl + C)
	os.system('stty sane')
	
	logger.info('------------- Successfully shutdown dsapp -------------')
Example #11
0
def log_menu():
	menu = ['1. Upload logs','2. Remove log archives', '\n     0. Back']
	
	available = build_avaialbe(menu)
	loop = True
	while loop:
		show_menu(menu)
		choice = get_choice(available)
		if choice == '1':
			ds.getLogs(mobilityConfig, gwConfig, XMLconfig ,ldapConfig, dbConfig, trustedConfig, config_files, webConfig)
			print; ds.eContinue()
		elif choice == '2':
			ds.cleanLog()
			print; ds.eContinue()
		elif choice == '0':
			loop = False
			main_menu()
Example #12
0
def update_menu():
	menu = ['1. Update via Local ISO', '2. Update via %s' % updateURL, '\n     0. Back']

	available = build_avaialbe(menu)
	loop = True
	while loop:
		show_menu(menu)
		choice = get_choice(available)
		if choice == '1':
			ds.updateMobilityISO()
			ds.eContinue()
		elif choice == '2':
			ds.updateMobilityFTP()
			ds.eContinue()
		elif choice == '0':
			loop = False
			return
Example #13
0
def exit_cleanup():
    logger.debug("Running exit cleanup..")
    try:
        if spinner.isAlive():
            spinner.stop()
            print
            ds.eContinue()
    except NameError:
        pass

    # Clear dsapp/tmp
    ds.removeAllFolders(glb.dsapptmp)
    ds.removeAllFiles(glb.dsapptmp)

    # Reset terminal (for blank text bug on Ctrl + C)
    os.system('stty sane')

    logger.info('------------- Exiting dsapp v%s -------------' %
                glb.dsappversion)
Example #14
0
def log_menu():
    menu = ['1. Upload logs', '2. Remove log archives', '\n     0. Back']

    available = build_avaialbe(menu)
    loop = True
    while loop:
        show_menu(menu)
        choice = get_choice(available)
        if choice == '1':
            ds.getLogs()
            print
            ds.eContinue()
        elif choice == '2':
            ds.cleanLog()
            print
            ds.eContinue()
        elif choice == '0':
            loop = False
            main_menu()
Example #15
0
def registerUpdate_menu():
	menu = ['1. Register Mobility', '2. Update Mobility', '3. FTF options...', '\n     0. Back']

	available = build_avaialbe(menu)
	loop = True
	while loop:
		show_menu(menu)
		choice = get_choice(available)
		if choice == '1':
			ds.datasyncBanner(dsappversion)
			ds.registerDS()
			print; ds.eContinue()
		elif choice == '2':
			update_menu()
		elif choice == '3':
			ftf_menu()
		elif choice == '0':
			loop = False
			main_menu()
Example #16
0
def update_menu():
    menu = [
        '1. Update via Local ISO',
        '2. Update via %s' % updateURL, '\n     0. Back'
    ]

    available = build_avaialbe(menu)
    loop = True
    while loop:
        show_menu(menu)
        choice = get_choice(available)
        if choice == '1':
            ds.updateMobilityISO()
            ds.eContinue()
        elif choice == '2':
            ds.updateMobilityFTP()
            ds.eContinue()
        elif choice == '0':
            loop = False
            return
Example #17
0
def viewAttachments_menu():
	menu = ['1. View user attachments','2. View total attachment size by users', '3. Check Mobility attachments count', '\n     0. Back']

	available = build_avaialbe(menu)
	loop = True
	while loop:
		show_menu(menu)
		choice = get_choice(available)
		if choice == '1':
			ds.view_users_attach(dbConfig)
		elif choice == '2':
			ds.view_attach_byUser(dbConfig)
		elif choice == '3':
			ds.datasyncBanner(dsappversion)
			print ("Compare the mobility database ID count, with the mobility filestore ID count")
			if ds.askYesOrNo("This may take some time to complete, continue"):
				ds.check_mob_attachments(dbConfig)
				print; ds.eContinue()
		elif choice == '0':
			loop = False
			return
Example #18
0
def removeUser_menu():
	menu = ['1. Force remove user(s)/group(s) db references', '2. Remove user/group (restarts configengine)', '3. Remove disabled users & fix referenceCount', '\n     4. Reinitialize user(s)', '5. Reinitialize all failed users', '6. Reinitialize all users', '\n     0. Back']

	available = build_avaialbe(menu)
	loop = True
	while loop:
		show_menu(menu)
		choice = get_choice(available)
		if choice == '1':
			ds.remove_user(dbConfig, 1)
		elif choice == '2':
			ds.remove_user(dbConfig)
		elif choice == '3':
			ds.datasyncBanner(dsappversion)
			ds.removed_disabled(dbConfig)
			print
			ds.fix_referenceCount(dbConfig)
			print; ds.eContinue()
		elif choice == '4':
			ds.setUserState(dbConfig, '7')
		elif choice == '5':
			ds.reinitAllFailedUsers(dbConfig)
			print;ds.eContinue()
		elif choice == '6':
			ds.reinitAllUsers(dbConfig)
			print;ds.eContinue()
		elif choice == '0':
			loop = False
			return
Example #19
0
def checksQueries_menu():
	menu = ['1. General Health Check', '2. Nightly Maintenance Check', '\n     3. Show Sync Status', '4. GW pending events by User (consumerevents)', '5. Mobility pending events by User (syncevents)', '\n     6. Attachments...', '7. Performance...', '\n     0. Back']

	available = build_avaialbe(menu)
	loop = True
	while loop:
		show_menu(menu)
		choice = get_choice(available)
		if choice == '1':
			ghc.generalHealthCheck(mobilityConfig, gwConfig, XMLconfig ,ldapConfig, dbConfig, trustedConfig, config_files, webConfig)
			print; ds.eContinue()
		elif choice == '2':
			print ds.checkNightlyMaintenance(config_files, mobilityConfig)['output']
			print; ds.eContinue()
		elif choice == '3':
			ds.datasyncBanner(dsappversion)
			ds.showStatus(dbConfig)
			print; ds.eContinue()
		elif choice == '4':
			ds.show_GW_syncEvents(dbConfig)
		elif choice == '5':
			ds.show_Mob_syncEvents(dbConfig)
		elif choice == '6':
			viewAttachments_menu()
		elif choice == '7':
			performance_menu()
		elif choice == '0':
			loop = False
			main_menu()
Example #20
0
def certificate_menu():
    menu = [
        '1. Generate CSR & Private key', '2. Generate self-signed certificate',
        '3. Apply certificates (Generate PEM)',
        '4. Verify certificate / key pair', '\n     5. LetsEncrypt..',
        '\n     0. Back'
    ]

    available = build_avaialbe(menu)
    loop = True
    while loop:
        show_menu(menu)

        # Check certs each loop (If they are changed)
        try:
            mob_result = ds.getExpiry(glb.mobileCertPath)[0].split('=')[1]
            ds.print_there(
                22, 6, "Device (mobility.pem) expiry date: %s" % mob_result)
        except:
            pass
        try:
            ser_result = ds.getExpiry(glb.serverCertPath)[0].split('=')[1]
            ds.print_there(
                23, 6, "Webadmin (server.pem) expiry date: %s" % ser_result)
        except:
            pass

        choice = get_choice(available)
        if choice == '1':
            ds.createCSRKey()
            print
            ds.eContinue()
        elif choice == '2':
            ds.pre_signCert()
            print
            ds.eContinue()
        elif choice == '3':
            ds.createPEM()
            print
            ds.eContinue()
        elif choice == '4':
            ds.verifyCertifiateMatch()
            print
            ds.eContinue()
        elif choice == '5':
            letsEncrypt_menu()
        elif choice == '0':
            loop = False
            main_menu()
Example #21
0
def registerUpdate_menu():
    menu = [
        '1. Register Mobility', '2. Update Mobility', '3. FTF options..',
        '\n     0. Back'
    ]

    available = build_avaialbe(menu)
    loop = True
    while loop:
        show_menu(menu)
        choice = get_choice(available)
        if choice == '1':
            ds.datasyncBanner()
            ds.registerDS()
            print
            ds.eContinue()
        elif choice == '2':
            update_menu()
        elif choice == '3':
            ftf_menu()
        elif choice == '0':
            loop = False
            main_menu()
Example #22
0
def performance_menu():
    menu = [
        '1. Top device requests', '2. Check manual syncing devices',
        '\n     0. Back'
    ]

    available = build_avaialbe(menu)
    loop = True
    while loop:
        show_menu(menu)
        ds.print_there(23, 6, "DEBUG logging required. Logs parsed for data")
        choice = get_choice(available)
        if choice == '1':
            ds.datasyncBanner()
            if ds.askYesOrNo("Parse debug log for top device requests"):
                log = ds.getFilePath(
                    "mobility-agent log file",
                    '/var/log/datasync/connectors/mobility-agent.log')
                if log is None:
                    return
                dsPerformance.getDeviceCommands(log)
                ds.eContinue()

        elif choice == '2':
            ds.datasyncBanner()
            if ds.askYesOrNo("Parse debug log for devices set to manual sync"):
                log = ds.getFilePath(
                    "mobility-agent log file",
                    '/var/log/datasync/connectors/mobility-agent.log')
                if log is None:
                    return
                dsPerformance.getPinglessDevices(log)
                ds.eContinue()

        elif choice == '0':
            loop = False
            return
Example #23
0
def groupwiseChecks_menu():
	menu = ['1. Check user over SOAP', '2. Check GroupWise folder structure', '\n     3. Count user shared folders', '4. Count all users shared folders', '\n     0. Back']

	available = build_avaialbe(menu)
	loop = True
	while loop:
		show_menu(menu)
		choice = get_choice(available)
		if choice == '1':
			userConfig = ds.verifyUser(dbConfig)[0]
			if userConfig['name'] != None:
				if userConfig['type'] != 'group':
					dsSOAP.soap_printUser(trustedConfig, gwConfig, userConfig)
				else:
					print ("Input '%(name)s' is not a user. Type='%(type)s'" % userConfig)
				print; ds.eContinue()

		elif choice == '2':
			dsSOAP.soap_checkFolderList(trustedConfig, gwConfig, ds.verifyUser(dbConfig)[0])

		elif choice == '3':
			userConfig = ds.verifyUser(dbConfig)[0]
			if userConfig['name'] != None:
				if userConfig['type'] != 'group':
					shared_list = dsSOAP.soap_check_sharedFolders(trustedConfig, gwConfig, userConfig)
					if shared_list is not None:
						pydoc.pager(shared_list)
						if ds.askYesOrNo("Save to file"):
							with open(dsappdata + '/shared_folder_list.txt', 'w') as file:
								file.write(shared_list)
								file.write('\n')
							logger.info("Saving shared list to %s" % (dsappdata + '/shared_folder_list.txt'))
							print ("Saved to %s" % (dsappdata + '/shared_folder_list.txt'))
					print; ds.eContinue()

		elif choice == '4':
			ds.datasyncBanner(dsappversion)
			print ("This can take some time to check every user in mobility")
			if ds.askYesOrNo("Warning! CPU may become busy. Continue"):
				userList = ds.getMobilityUserList(dbConfig)
				shared_list = dsSOAP.soap_check_allSharedFolders(trustedConfig, gwConfig, userList)
				if shared_list is not None:
					pydoc.pager(shared_list)
					if ds.askYesOrNo("Save to file"):
						with open(dsappdata + '/shared_folder_list-allUsers.txt', 'w') as file:
							file.write(shared_list)
							file.write('\n')
						logger.info("Saving shared list to %s" % (dsappdata + '/shared_folder_list-allUsers.txt'))
						print ("Saved to %s" % (dsappdata + '/shared_folder_list-allUsers.txt'))
					print; ds.eContinue()
					
		elif choice == '0':
			loop = False
			return
Example #24
0
def ftf_menu():
    menu = ['1. Show applied FTFs', '2. Apply FTFs', '\n     0. Back']

    available = build_avaialbe(menu)
    loop = True
    while loop:
        show_menu(menu)
        choice = get_choice(available)
        if choice == '1':
            ds.showAppliedPatches()
            ds.eContinue()
        elif choice == '2':
            ds.datasyncBanner()

            Config.read(glb.dsappSettings)
            serviceCheck = Config.get('FTF URL', 'check.service.address')
            serviceCheckPort = Config.getint('FTF URL', 'check.service.port')
            dlPath = Config.get('FTF URL', 'download.address')
            if ds.DoesServiceExist(serviceCheck, serviceCheckPort):
                # Get latest FTFlist.txt file
                FTFfile = glb.dsappConf + '/dsapp_FTFlist.txt'
                if os.path.isfile(FTFfile):
                    os.rename(FTFfile, FTFfile + '.bak')

                if not ds.dlfile('%sdsapp_FTFlist.txt' % dlPath, glb.dsappConf,
                                 False, False):
                    if os.path.isfile(FTFfile + '.bak'):
                        os.rename(FTFfile + '.bak', FTFfile)

                if os.path.isfile(FTFfile):
                    patches = ds.buildFTFPatchList(FTFfile)
                    ds.selectFTFPatch(patches)
                else:
                    print "No FTFs / Patches available"
                    print
                    ds.eContinue()
            else:
                print "FTFs / Patches require FTF access to download"
                print
                ds.eContinue()
        elif choice == '0':
            loop = False
            return
Example #25
0
def ftf_menu():
	menu = ['1. Show applied FTFs','2. Apply FTFs', '\n     0. Back']
	
	available = build_avaialbe(menu)
	loop = True
	while loop:
		show_menu(menu)
		choice = get_choice(available)
		if choice == '1':
			ds.showAppliedPatches()
			ds.eContinue()
		elif choice == '2':
			ds.datasyncBanner(dsappversion)

			Config.read(dsappSettings)
			serviceCheck = Config.get('FTF URL', 'check.service.address')
			serviceCheckPort = Config.getint('FTF URL', 'check.service.port')
			dlPath = Config.get('FTF URL', 'download.address')
			if ds.DoesServiceExist(serviceCheck, serviceCheckPort):
				# Get latest FTFlist.txt file
				FTFfile = dsappConf + '/dsapp_FTFlist.txt'
				if os.path.isfile(FTFfile):
					os.rename(FTFfile, FTFfile + '.bak')

				if not ds.dlfile('%sdsapp_FTFlist.txt' % dlPath, dsappConf, False, False):
					if os.path.isfile(FTFfile + '.bak'):
						os.rename(FTFfile + '.bak', FTFfile)

				if os.path.isfile(FTFfile):
					patches = ds.buildFTFPatchList(FTFfile)
					ds.selectFTFPatch(patches)
				else:
					print "No FTFs / Patches available"
					print; ds.eContinue()
			else:
				print "FTFs / Patches require FTF access to download"
				print; ds.eContinue()
		elif choice == '0':
			loop = False
			return
Example #26
0
def checksQueries_menu():
    menu = [
        '1. General Health Check', '2. Nightly Maintenance Check',
        '\n     3. Show Sync Status',
        '4. GW pending events by User (consumerevents)',
        '5. Mobility pending events by User (syncevents)',
        '\n     6. Attachments..', '7. Performance..', '\n     0. Back'
    ]

    available = build_avaialbe(menu)
    loop = True
    while loop:
        show_menu(menu)
        choice = get_choice(available)
        if choice == '1':
            ghc.generalHealthCheck()
            print
            ds.eContinue()
        elif choice == '2':
            print ds.checkNightlyMaintenance()['output']
            print
            ds.eContinue()
        elif choice == '3':
            ds.datasyncBanner()
            ds.showStatus()
            print
            ds.eContinue()
        elif choice == '4':
            ds.show_GW_syncEvents()
        elif choice == '5':
            ds.show_Mob_syncEvents()
        elif choice == '6':
            viewAttachments_menu()
        elif choice == '7':
            performance_menu()
        elif choice == '0':
            loop = False
            main_menu()
Example #27
0
def removeUser_menu():
    menu = [
        '1. Force remove user(s)/group(s) db references',
        '2. Remove user/group (restarts configengine)',
        '3. Remove disabled users & fix referenceCount',
        '\n     4. Reinitialize user(s)', '5. Reinitialize all failed users',
        '6. Reinitialize all users', '\n     0. Back'
    ]

    available = build_avaialbe(menu)
    loop = True
    while loop:
        show_menu(menu)
        choice = get_choice(available)
        if choice == '1':
            ds.remove_user(1)
        elif choice == '2':
            ds.remove_user()
        elif choice == '3':
            ds.datasyncBanner()
            ds.removed_disabled()
            print
            ds.fix_referenceCount()
            print
            ds.eContinue()
        elif choice == '4':
            ds.setUserState('7')
        elif choice == '5':
            ds.reinitAllFailedUsers()
            print
            ds.eContinue()
        elif choice == '6':
            ds.reinitAllUsers()
            print
            ds.eContinue()
        elif choice == '0':
            loop = False
            return
Example #28
0
parser.add_argument('-u', '--users', action='store_true', dest='users', help='Print list of all users with count')
parser.add_argument('-d', '--devices', action='store_true', dest='devices', help='Print list of all devices with count')
parser.add_argument('-ch', '--changeHost', action='store_true', dest='host', help='Fix mobility encryption with old hostname')
parser.add_argument('-f', '--force', action='store_true', dest='force', help='Force runs dsapp')
parser.add_argument('-db', '--database', action='store_true', dest='db', help='Change database password')
parser.add_argument('-cl', '--clear', action='store_true', dest='clear', help='Remove encryption from XMLs')
parser.add_argument('--config', dest='re', choices=['backup', 'restore'], help='Backup settings or install Mobility with backup')
parser.add_argument('--setlog', dest='loglevel', choices=['debug','info','warning'], help='Set the logging level')
parser.add_argument('--debugMenu', action='store_true', dest='debugMenu', help=argparse.SUPPRESS)
args = parser.parse_args()
logger.debug("Switches: %s" % args)

if args.re == 'restore':
	import dsapp_re
	dsapp_re.install_settings()
	print; ds.eContinue()
	sys.exit(0)

if args.bug:
	ds.datasyncBanner(dsappversion)
	print "Report issues to: https://github.com/snielson/dsapp_python/issues\n"
	print "Useful logs can be located at:\n/opt/novell/datasync/tools/dsapp/logs/\nSet dsapp logs into debug for more information `dsapp --setlog debug`\n"
	print "Feel free to email %s directly at <%s>" % (__author__, __email__)
	sys.exit(0)

if args.dsUpdate:
	ds.autoUpdateDsapp(True)
	ds.eContinue()
	sys.exit(0)

# Set logs if loglevel switch passed in
Example #29
0
def soap_checkFolderList(userConfig):
    if userConfig['name'] is None:
        return

    soap_userConfig = soap_getUserInfo(userConfig)

    # Log output for users folder structure
    folderStructure_Log = glb.dsappLogs + '/folderStructure/%s_folderStructure.log' % userConfig[
        'name']

    # Set up IDs for fixing structure
    systemIDs = dict()
    system_problemIDs = dict()
    subContact_problemIDs = dict()
    subCalendar_problemIDs = dict()

    problem = False
    print("Getting folder list..")
    logger.info("Getting folder list..")
    soap_folderList = soap_getFolderList(userConfig,
                                         soap_userConfig=soap_userConfig)
    if soap_folderList == None:
        logger.debug("SOAP folder list is None")
        print()
        ds.eContinue()
        return

    # Write folder list to log
    if not os.path.exists(glb.dsappLogs + '/folderStructure'):
        os.makedirs(glb.dsappLogs + '/folderStructure')
    with open(folderStructure_Log, 'w') as file:
        file.write(str(soap_folderList))

    # Get root folder ID
    if soap_folderList[0][0][0]['sid'] == 1:
        root_id = soap_folderList[0][0][0]['id']
    else:
        foundRoot = False
        for folder in soap_folderList[0][
                0]:  # for loop to find the root folder id
            try:
                if folder['sid'] == 1 or folder['folderType'] == 'Root':
                    root_id = folder['id']
                    foundRoot = True
                    break
            except AttributeError:
                logger.error("AttributeError - No sid or folderType")
                logger.error(folder)

        if not foundRoot:
            print("Unable to find the root folder for %s" % userConfig['name'])
            logger.warning("Unable to find the root folder for %s" %
                           userConfig['name'])
            return

    systemIDs['root'] = root_id
    logger.debug('root {id: %s}' % root_id)

    print("Checking %s folder structure..\n" % userConfig['name'])
    logger.info("Checking %s folder structure" % userConfig['name'])
    folder_check = ['Mailbox', 'Calendar', 'Contacts']
    for folder in soap_folderList[0][0]:
        if 'folderType' in folder:
            if folder['folderType'] in folder_check:
                if folder['parent'] != root_id:
                    print(
                        "Problem with system folder structure [%s]\n%s not found under root\n"
                        % (folder['folderType'], folder['name']))
                    logger.debug(
                        "%s {id: %s, parent: %s}" %
                        (folder['name'], folder['id'], folder['parent']))
                    logger.error(
                        "Problem with system folder [%s] structure - %s not found under root"
                        % (folder['folderType'], folder['name']))
                    system_problemIDs[folder['folderType']] = {
                        folder['name']: folder['id']
                    }
                    problem = True

                # Check sub folders
                if folder['folderType'] == 'Contacts':
                    systemIDs['Contacts'] = folder['id']
                    if check_subContacts(soap_folderList, folder['id'],
                                         subContact_problemIDs):
                        problem = True
                if folder['folderType'] == 'Calendar':
                    systemIDs['Calendar'] = folder['id']
                    if check_subCalendars(soap_folderList, folder['id'],
                                          subCalendar_problemIDs):
                        problem = True

    if not problem:
        print("No problems found with GroupWise folder structure")
        logger.info("No problems found with GroupWise folder structure")
    else:
        if ds.askYesOrNo("Fix %s folder structure" % userConfig['name']):
            fixFolderStructure(soap_userConfig, systemIDs, system_problemIDs,
                               subCalendar_problemIDs, subContact_problemIDs)

    soap_logout(soap_userConfig)
    print()
    ds.eContinue()
Example #30
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()
Example #31
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()
Example #32
0
def groupwiseChecks_menu():
    menu = [
        '1. Check user over SOAP', '2. Check GroupWise folder structure',
        '\n     3. Count user shared folders',
        '4. Count all users shared folders', '\n     0. Back'
    ]

    available = build_avaialbe(menu)
    loop = True
    while loop:
        show_menu(menu)
        choice = get_choice(available)
        if choice == '1':
            userConfig = ds.verifyUser()[0]
            if userConfig['name'] != None:
                if userConfig['type'] != 'group':
                    dsSOAP.soap_printUser(userConfig)
                else:
                    print("Input '%(name)s' is not a user. Type='%(type)s'" %
                          userConfig)
                print
                ds.eContinue()

        elif choice == '2':
            dsSOAP.soap_checkFolderList(ds.verifyUser()[0])

        elif choice == '3':
            userConfig = ds.verifyUser()[0]
            if userConfig['name'] != None:
                if userConfig['type'] != 'group':
                    shared_list = dsSOAP.soap_check_sharedFolders(userConfig)
                    if shared_list is not None:
                        pydoc.pager(shared_list)
                        if ds.askYesOrNo("Save to file"):
                            with open(
                                    glb.dsappdata + '/shared_folder_list.txt',
                                    'w') as file:
                                file.write(shared_list)
                                file.write('\n')
                            logger.info(
                                "Saving shared list to %s" %
                                (glb.dsappdata + '/shared_folder_list.txt'))
                            print("Saved to %s" %
                                  (glb.dsappdata + '/shared_folder_list.txt'))
                    print
                    ds.eContinue()

        elif choice == '4':
            ds.datasyncBanner()
            print("This can take some time to check every user in mobility")
            if ds.askYesOrNo("Warning! CPU may become busy. Continue"):
                userList = ds.getMobilityUserList()
                shared_list = dsSOAP.soap_check_allSharedFolders(userList)
                if shared_list is not None:
                    pydoc.pager(shared_list)
                    if ds.askYesOrNo("Save to file"):
                        with open(
                                glb.dsappdata +
                                '/shared_folder_list-allUsers.txt',
                                'w') as file:
                            file.write(shared_list)
                            file.write('\n')
                        logger.info("Saving shared list to %s" %
                                    (glb.dsappdata +
                                     '/shared_folder_list-allUsers.txt'))
                        print("Saved to %s" %
                              (glb.dsappdata +
                               '/shared_folder_list-allUsers.txt'))
                    print
                    ds.eContinue()

        elif choice == '0':
            loop = False
            return
Example #33
0
def soap_checkFolderList(trustedConfig, gwConfig, userConfig):
	if userConfig['name'] is None:
		return

	soap_userConfig = soap_getUserInfo(trustedConfig, gwConfig, userConfig)

	# Log output for users folder structure
	folderStructure_Log = dsappLogs + '/folderStructure/%s_folderStructure.log' % userConfig['name']

	# Set up IDs for fixing structure
	systemIDs = dict()
	system_problemIDs = dict()
	subContact_problemIDs = dict()
	subCalendar_problemIDs = dict()

	problem = False
	print ("Getting folder list..")
	logger.info("Getting folder list..")
	soap_folderList = soap_getFolderList(trustedConfig, gwConfig, userConfig, soap_userConfig=soap_userConfig)
	if soap_folderList == None:
		logger.debug("SOAP folder list is None")
		print(); ds.eContinue()
		return

	# Write folder list to log
	if not os.path.exists(dsappLogs + '/folderStructure'):
		os.makedirs(dsappLogs + '/folderStructure')
	with open(folderStructure_Log, 'w') as file:
		file.write(str(soap_folderList))

	# Get root folder ID
	if soap_folderList[0][0][0]['sid'] == 1:
		root_id = soap_folderList[0][0][0]['id']
	else:
		foundRoot = False
		for folder in soap_folderList[0][0]:
			if folder['sid'] == 1 or folder['folderType'] == 'Root':
				root_id = folder['id']
				foundRoot = True

		if not foundRoot:
			print ("Unable to find the root folder for %s" % userConfig['name'])
			logger.warning("Unable to find the root folder for %s" % userConfig['name'])
			return

	systemIDs['root'] = root_id
	logger.debug('root {id: %s}' % root_id)

	print ("Checking %s folder structure..\n" % userConfig['name'])
	logger.info("Checking %s folder structure" % userConfig['name'])
	folder_check = ['Mailbox', 'Calendar', 'Contacts']
	for folder in soap_folderList[0][0]:
		if 'folderType' in folder:
			if folder['folderType'] in folder_check:
				if folder['parent'] != root_id:
					print ("Problem with system folder structure [%s]\n%s not found under root\n" % (folder['folderType'], folder['name']))
					logger.debug("%s {id: %s, parent: %s}" % (folder['name'], folder['id'], folder['parent']))
					logger.error("Problem with system folder [%s] structure - %s not found under root" % (folder['folderType'], folder['name']))
					system_problemIDs[folder['folderType']] = {folder['name']: folder['id']}
					problem = True

				# Check sub folders
				if folder['folderType'] == 'Contacts':
					systemIDs['Contacts'] = folder['id']
					if check_subContacts(soap_folderList, folder['id'], subContact_problemIDs): problem = True
				if folder['folderType'] == 'Calendar':
					systemIDs['Calendar'] = folder['id']
					if check_subCalendars(soap_folderList, folder['id'], subCalendar_problemIDs): problem = True

	if not problem:
		print ("No problems found with GroupWise folder structure")
		logger.info("No problems found with GroupWise folder structure")
	else:
		if ds.askYesOrNo("Fix %s folder structure" % userConfig['name']):
			fixFolderStructure(soap_userConfig, systemIDs, system_problemIDs, subCalendar_problemIDs, subContact_problemIDs)

	print(); ds.eContinue()
Example #34
0
                    dest='loglevel',
                    choices=['debug', 'info', 'warning'],
                    help='Set the logging level')
parser.add_argument('--debugMenu',
                    action='store_true',
                    dest='debugMenu',
                    help='Show debug menu for dsapp')
args = parser.parse_args()
logger.debug("Switches: %s" % args)

if args.re == 'restore':
    logger.info("Running switch: restore")
    import dsapp_re
    dsapp_re.install_settings()
    print
    ds.eContinue()
    sys.exit(0)

if args.bug:
    logger.info("Running switch: bug")
    ds.datasyncBanner()
    print "Report issues to: https://github.com/snielson/dsapp_python/issues\n"
    print "Useful logs can be located at:\n/opt/novell/datasync/tools/dsapp/logs/\nSet dsapp logs into debug for more information `dsapp --setlog debug`\n"
    print "Feel free to email %s directly at <%s>" % (__author__, __email__)
    sys.exit(0)

if args.dsUpdate:
    logger.info("Running switch: updateDsapp")
    ds.autoUpdateDsapp(True)
    ds.eContinue()
    sys.exit(0)