def tearDownClass(cls): super(JetStreamTemplateTests, cls).tearDownClass() cls.server_obj = GetSession() cls.server_obj.serversess('172.16.169.146', 'delphix_admin', 'delphix', 'DOMAIN') cls.template_name = 'js_test_template0001' js_template.delete_template(cls.server_obj, cls.template_name)
def tearDownClass(cls): super(JetStreamBookmarkTests, cls).tearDownClass() cls.server_obj = GetSession() cls.server_obj.serversess("172.16.169.146", "delphix_admin", "delphix", "DOMAIN") cls.bookmark_name = "js_test_bookmark" js_bookmark.delete_bookmark(cls.server_obj, cls.bookmark_name)
def setUpClass(cls): super(DxOperationsTests, cls).setUpClass() cls.server_obj = GetSession() cls.server_obj.serversess('172.16.169.146', 'delphix_admin', 'delphix', 'DOMAIN') cls.server_obj.dlpx_engines['engine_name'] = 'test_engine' cls.target_vdb = 'dx_vdb'
def tearDownClass(cls): super(JetStreamTemplateTests, cls).tearDownClass() cls.server_obj = GetSession() cls.server_obj.serversess("172.16.169.146", "delphix_admin", "delphix", "DOMAIN") cls.template_name = "js_test_template0001" js_template.delete_template(cls.server_obj, cls.template_name)
def setUpClass(cls): super(DxOperationsTests, cls).setUpClass() cls.server_obj = GetSession() cls.server_obj.serversess("172.16.169.146", "delphix_admin", "delphix", "DOMAIN") cls.server_obj.dlpx_engines["engine_name"] = "test_engine" cls.target_vdb = "dx_vdb"
def tearDownClass(cls): super(JetStreamBookmarkTests, cls).tearDownClass() cls.server_obj = GetSession() cls.server_obj.serversess('172.16.169.146', 'delphix_admin', 'delphix', 'DOMAIN') cls.bookmark_name = 'js_test_bookmark' js_bookmark.delete_bookmark(cls.server_obj, cls.bookmark_name)
def setUpClass(cls): super(JetStreamTemplateTests, cls).setUpClass() cls.server_obj = GetSession() cls.server_obj.serversess('172.16.169.146', 'delphix_admin', 'delphix', 'DOMAIN') cls.server_obj.dlpx_engines['engine_name'] = 'test_engine' cls.database_name = 'jst3' cls.template_name = 'js_test_template0001' js_template.create_template(cls.server_obj, cls.template_name, cls.database_name)
def setUpClass(cls): super(JetStreamTemplateTests, cls).setUpClass() cls.server_obj = GetSession() cls.server_obj.serversess("172.16.169.146", "delphix_admin", "delphix", "DOMAIN") cls.server_obj.dlpx_engines["engine_name"] = "test_engine" cls.database_name = "jst3" cls.template_name = "js_test_template0001" js_template.create_template(cls.server_obj, cls.template_name, cls.database_name)
def tearDownClass(cls): super(JetStreamBranchTests, cls).tearDownClass() cls.server_obj = GetSession() cls.server_obj.serversess("172.16.169.146", "delphix_admin", "delphix", "DOMAIN") cls.branch_name = "js_test_branch0001" cls.container_name = "js_test_container0001" cls.template_name = "js_test_template0001" js_branch.delete_branch(cls.server_obj, cls.branch_name) js_container.delete_container(cls.server_obj, cls.container_name, True) js_template.delete_template(cls.server_obj, cls.template_name)
def tearDownClass(cls): super(JetStreamBranchTests, cls).tearDownClass() cls.server_obj = GetSession() cls.server_obj.serversess('172.16.169.146', 'delphix_admin', 'delphix', 'DOMAIN') cls.branch_name = 'js_test_branch0001' cls.container_name = 'js_test_container0001' cls.template_name = 'js_test_template0001' js_branch.delete_branch(cls.server_obj, cls.branch_name) js_container.delete_container(cls.server_obj, cls.container_name, True) js_template.delete_template(cls.server_obj, cls.template_name)
def setUpClass(cls): super(JetStreamBookmarkTests, cls).setUpClass() cls.server_obj = GetSession() cls.server_obj.serversess("172.16.169.146", "delphix_admin", "delphix", "DOMAIN") cls.server_obj.dlpx_engines["engine_name"] = "test_engine" cls.data_layout = "jscontainer" cls.branch_name = "default" cls.bookmark_name = "js_test_bookmark" js_bookmark.create_bookmark(cls.server_obj, cls.bookmark_name, cls.data_layout, cls.branch_name)
def setUpClass(cls): super(JetStreamBookmarkTests, cls).setUpClass() cls.server_obj = GetSession() cls.server_obj.serversess('172.16.169.146', 'delphix_admin', 'delphix', 'DOMAIN') cls.server_obj.dlpx_engines['engine_name'] = 'test_engine' cls.data_layout = 'jscontainer' cls.branch_name = 'default' cls.bookmark_name = 'js_test_bookmark' js_bookmark.create_bookmark(cls.server_obj, cls.bookmark_name, cls.data_layout, cls.branch_name)
def setUpClass(cls): super(DxAuthorizationTests, cls).setUpClass() cls.server_obj = GetSession() cls.server_obj.serversess('172.16.169.146', 'delphix_admin', 'delphix', 'DOMAIN') cls.server_obj.dlpx_engines['engine_name'] = 'test_engine' cls.user = '******' cls.target_vdb = 'dx_vdb' cls.group = 'Untitled' cls.target_type_db = 'database' cls.target_type_group = 'group' cls.role_data = 'Data' cls.role_read = 'Read' cls.role_owner = 'OWNER'
def setUpClass(cls): super(DxAuthorizationTests, cls).setUpClass() cls.server_obj = GetSession() cls.server_obj.serversess("172.16.169.146", "delphix_admin", "delphix", "DOMAIN") cls.server_obj.dlpx_engines["engine_name"] = "test_engine" cls.user = "******" cls.target_vdb = "dx_vdb" cls.group = "Untitled" cls.target_type_db = "database" cls.target_type_group = "group" cls.role_data = "Data" cls.role_read = "Read" cls.role_owner = "OWNER"
def setUpClass(cls): super(JetStreamBranchTests, cls).setUpClass() cls.server_obj = GetSession() cls.server_obj.serversess('172.16.169.146', 'delphix_admin', 'delphix', 'DOMAIN') cls.server_obj.dlpx_engines['engine_name'] = 'test_engine' cls.container_name = 'js_test_container0001' cls.branch_name = 'js_test_branch0001' cls.template_name = 'js_test_template0001' cls.template_db = 'jst3' cls.database_name = 'jst3_cld' js_template.create_template(cls.server_obj, cls.template_name, cls.template_db) js_container.create_container(cls.server_obj, cls.template_name, cls.container_name, cls.database_name) js_branch.create_branch(cls.server_obj, cls.branch_name, cls.template_name, cls.container_name)
def setUpClass(cls): super(JetStreamBranchTests, cls).setUpClass() cls.server_obj = GetSession() cls.server_obj.serversess("172.16.169.146", "delphix_admin", "delphix", "DOMAIN") cls.server_obj.dlpx_engines["engine_name"] = "test_engine" cls.container_name = "js_test_container0001" cls.branch_name = "js_test_branch0001" cls.template_name = "js_test_template0001" cls.template_db = "jst3" cls.database_name = "jst3_cld" js_template.create_template(cls.server_obj, cls.template_name, cls.template_db) js_container.create_container(cls.server_obj, cls.template_name, cls.container_name, cls.database_name) js_branch.create_branch(cls.server_obj, cls.branch_name, cls.template_name, cls.container_name)
def tearDownClass(cls): super(DxAuthorizationTests, cls).tearDownClass() cls.server_obj = GetSession() cls.server_obj.serversess('172.16.169.146', 'delphix_admin', 'delphix', 'DOMAIN') cls.user = '******' cls.target_vdb = 'dx_vdb' cls.group = 'Untitled' cls.target_type_db = 'database' cls.target_type_group = 'group' cls.role_data = 'Data' cls.role_read = 'Read' cls.role_owner = 'OWNER' dx_authorization.delete_authorization(cls.server_obj, cls.role_data, cls.target_type_db, cls.target_vdb, cls.user) dx_authorization.delete_authorization(cls.server_obj, cls.role_data, cls.target_type_group, cls.group, cls.user)
def tearDownClass(cls): super(DxAuthorizationTests, cls).tearDownClass() cls.server_obj = GetSession() cls.server_obj.serversess("172.16.169.146", "delphix_admin", "delphix", "DOMAIN") cls.user = "******" cls.target_vdb = "dx_vdb" cls.group = "Untitled" cls.target_type_db = "database" cls.target_type_group = "group" cls.role_data = "Data" cls.role_read = "Read" cls.role_owner = "OWNER" dx_authorization.delete_authorization(cls.server_obj, cls.role_data, cls.target_type_db, cls.target_vdb, cls.user) dx_authorization.delete_authorization(cls.server_obj, cls.role_data, cls.target_type_group, cls.group, cls.user)
def main(): # We want to be able to call on these variables anywhere in the script. global single_thread global debug time_start = time() single_thread = False try: dx_session_obj = GetSession() logging_est(arguments['--logdir']) print_debug(arguments) config_file_path = arguments['--config'] # Parse the dxtools.conf and put it into a dictionary dx_session_obj.get_config(config_file_path) # This is the function that will handle processing main_workflow for # all the servers. run_job(dx_session_obj, config_file_path) elapsed_minutes = time_elapsed(time_start) print_info('script took {:.2f} minutes to get this far.'.format( elapsed_minutes)) # Here we handle what we do when the unexpected happens except SystemExit as e: # This is what we use to handle our sys.exit(#) sys.exit(e) except DlpxException as e: # We use this exception handler when an error occurs in a function call. print_exception('ERROR: Please check the ERROR message below:\n' '{}'.format(e.message)) sys.exit(2) except HttpError as e: # We use this exception handler when our connection to Delphix fails print_exception('ERROR: Connection failed to the Delphix Engine. Please' 'check the ERROR message below:\n{}'.format(e.message)) sys.exit(2) except JobError as e: # We use this exception handler when a job fails in Delphix so that we # have actionable data print_exception('A job failed in the Delphix Engine:\n{}'.format(e.job)) elapsed_minutes = time_elapsed(time_start) print_exception('{} took {:.2f} minutes to get this far'.format( basename(__file__), elapsed_minutes)) sys.exit(3) except KeyboardInterrupt: # We use this exception handler to gracefully handle ctrl+c exits print_debug('You sent a CTRL+C to interrupt the process') elapsed_minutes = time_elapsed(time_start) print_info('{} took {:.2f} minutes to get this far'.format( basename(__file__), elapsed_minutes)) except: # Everything else gets caught here print_exception('{}\n{}'.format(sys.exc_info()[0], traceback.format_exc())) elapsed_minutes = time_elapsed(time_start) print_info("{} took {:.2f} minutes to get this far".format( basename(__file__), elapsed_minutes)) sys.exit(1)
def main(arguments): #We want to be able to call on these variables anywhere in the script. global single_thread global usebackup global time_start global config_file_path global dx_session_obj global debug if arguments['--debug']: debug = True try: dx_session_obj = GetSession() logging_est(arguments['--logdir']) print_debug(arguments) time_start = time() engine = None single_thread = False config_file_path = arguments['--config'] #Parse the dxtools.conf and put it into a dictionary dx_session_obj.get_config(config_file_path) #This is the function that will handle processing main_workflow for # all the servers. run_job() #elapsed_minutes = time_elapsed() print_info('script took {:.2f} minutes to get this far.'.format( time_elapsed())) #Here we handle what we do when the unexpected happens except SystemExit as e: """ This is what we use to handle our sys.exit(#) """ sys.exit(e) except HttpError as e: """ We use this exception handler when our connection to Delphix fails """ print_exception('Connection failed to the Delphix Engine' 'Please check the ERROR message:\n{}\n').format(e) sys.exit(1) except JobError as e: """ We use this exception handler when a job fails in Delphix so that we have actionable data """ elapsed_minutes = time_elapsed() print_exception('A job failed in the Delphix Engine') print_info('{} took {:.2f} minutes to get this far:\n{}\n'.format( basename(__file__), elapsed_minutes, e)) sys.exit(3) except KeyboardInterrupt: """ We use this exception handler to gracefully handle ctrl+c exits """ print_debug("You sent a CTRL+C to interrupt the process") elapsed_minutes = time_elapsed() print_info('{} took {:.2f} minutes to get this far\n'.format( basename(__file__), elapsed_minutes)) except: """ Everything else gets caught here """ print_exception(sys.exc_info()[0]) elapsed_minutes = time_elapsed() print_info('{} took {:.2f} minutes to get this far\n'.format( basename(__file__), elapsed_minutes)) sys.exit(1)
def main(argv): try: logging_est() global time_start time_start = time.time() dx_session_obj = GetSession() engine_ip = "" engine_pass = "" old_engine_pass = "" try: opts,args = getopt.getopt(argv,"e:d:p:hv") except getopt.GetoptError: help() for opt, arg in opts: if opt == '-h': help() elif opt == '-e': engine_ip = arg elif opt == '-p': engine_pass = arg elif opt == '-d': key_path = arg + '/engine_key.pub' elif opt == '-v': version() if (engine_ip == "" or engine_pass == "") : help() dx_session_obj.serversess(engine_ip, 'sysadmin', engine_pass, 'SYSTEM') dx_session_obj.server_wait() sys_server = system_serversess(engine_ip, "sysadmin", engine_pass) system_info = system.get(sys_server) print_info(system_info.ssh_public_key) print_info("Writing to " + key_path) target = open(key_path, 'w') target.write(system_info.ssh_public_key) target.close print_info("File saved") elapsed_minutes = time_elapsed() print_info("Script took " + str(elapsed_minutes) + " minutes to get this far.") except SystemExit as e: sys.exit(e) except HttpError as e: print_error("Connection failed to the Delphix Engine") print_error( "Please check the ERROR message below") print_error(e.message) sys.exit(2) except JobError as e: print_error("A job failed in the Delphix Engine") print_error(e.job) elapsed_minutes = time_elapsed() print_info("Prime took " + str(elapsed_minutes) + " minutes to get this far.") sys.exit(2) except KeyboardInterrupt: print_debug("You sent a CTRL+C to interrupt the process") elapsed_minutes = time_elapsed() print_info("Prime took " + str(elapsed_minutes) + " minutes to get this far.") sys.exit(2) except: print_error(sys.exc_info()[0]) print_error(traceback.format_exc()) elapsed_minutes = time_elapsed() print_info("Prime took " + str(elapsed_minutes) + " minutes to get this far.") sys.exit(2)
def main(argv): # We want to be able to call on these variables anywhere in the script. global single_thread global usebackup global time_start global config_file_path global database_name global host_name global dx_session_obj global debug try: dx_session_obj = GetSession() debug = arguments["--debug"] logging_est(arguments["--logdir"], debug) print_debug(arguments, debug) time_start = time() single_thread = False config_file_path = arguments["--config"] print_info("Welcome to %s version %s" % (basename(__file__), VERSION)) # Parse the dxtools.conf and put it into a dictionary dx_session_obj.get_config(config_file_path) database_name = arguments["--target"] host_name = arguments["--environment"] # This is the function that will handle processing main_workflow for # all the servers. run_job() elapsed_minutes = time_elapsed() print_info("script took %s minutes to get this far. " % (str(elapsed_minutes))) # Here we handle what we do when the unexpected happens except SystemExit as e: """ This is what we use to handle our sys.exit(#) """ sys.exit(e) except DlpxException as e: """ We use this exception handler when an error occurs in a function call. """ print ("\nERROR: Please check the ERROR message below:\n%s" % (e.message)) sys.exit(2) except HttpError as e: """ We use this exception handler when our connection to Delphix fails """ print ( "\nERROR: Connection failed to the Delphix Engine. Please " "check the ERROR message below:\n%s" % (e.message) ) sys.exit(2) except JobError as e: """ We use this exception handler when a job fails in Delphix so that we have actionable data """ print("A job failed in the Delphix Engine:\n%s"(e.job)) elapsed_minutes = time_elapsed() print_info( "%s took %s minutes to get this far" % (basename(__file__), str(elapsed_minutes)) ) sys.exit(3) except KeyboardInterrupt: """ We use this exception handler to gracefully handle ctrl+c exits """ print_debug("You sent a CTRL+C to interrupt the process") elapsed_minutes = time_elapsed() print_info( "%s took %s minutes to get this far" % (basename(__file__), str(elapsed_minutes)) ) except: """ Everything else gets caught here """ print (sys.exc_info()[0]) print (traceback.format_exc()) elapsed_minutes = time_elapsed() print_info( "%s took %s minutes to get this far" % (basename(__file__), str(elapsed_minutes)) ) sys.exit(1)
def main(argv): try: logging_est() global time_start time_start = time.time() dx_session_obj = GetSession() engine_ip = "" engine_pass = "" old_engine_pass = "" try: opts, args = getopt.getopt(argv, "e:o:p:hv") except getopt.GetoptError: help() for opt, arg in opts: if opt == '-h': help() elif opt == '-e': engine_ip = arg elif opt == '-o': old_engine_pass = arg elif opt == '-p': engine_pass = arg elif opt == '-v': version() if (engine_ip == "" or engine_pass == "" or old_engine_pass == ""): help() dx_session_obj.serversess(engine_ip, 'sysadmin', old_engine_pass, 'SYSTEM') dx_session_obj.server_wait() sys_server = system_serversess(engine_ip, "sysadmin", old_engine_pass) if user.get(sys_server, "USER-1").email_address == None: print_info("Setting sysadmin's email address") sysadmin_user = User() sysadmin_user.email_address = "*****@*****.**" user.update(sys_server, 'USER-1', sysadmin_user) print_info("Setting sysadmin's password") sysadmin_credupdate = CredentialUpdateParameters() sysadmin_credupdate.new_credential = PasswordCredential() sysadmin_credupdate.new_credential.password = engine_pass user.update_credential(sys_server, 'USER-1', sysadmin_credupdate) else: print_info("sysadmin user has already been configured") try: sys_server = system_serversess(engine_ip, "sysadmin", engine_pass) domain.get(sys_server) print_info("domain0 already exists. Skipping domain0 creation.") elapsed_minutes = time_elapsed() print_info("Prime took " + str(elapsed_minutes) + " minutes to get this far.") sys.exit(7) except HttpError as e: device_list = storage.device.get_all(sys_server) system_init_params = DomainCreateParameters() system_init_params.devices = [ device.reference for device in device_list if not device.configured ] print_info("Creating storage domain") domain.set(sys_server, system_init_params) while True: try: sys_server = system_serversess(engine_ip, "sysadmin", engine_pass) domain.get(sys_server) except: break print_info("Waiting for Delphix Engine to go down") time.sleep(3) dx_session_obj.serversess(engine_ip, 'sysadmin', engine_pass, 'SYSTEM') dx_session_obj.server_wait() except SystemExit as e: sys.exit(e) except HttpError as e: print_error("Connection failed to the Delphix Engine") print_error("Please check the ERROR message below") print_error(e.message) sys.exit(2) except JobError as e: print_error("A job failed in the Delphix Engine") print_error(e.job) elapsed_minutes = time_elapsed() print_info("Prime took " + str(elapsed_minutes) + " minutes to get this far.") sys.exit(2) except KeyboardInterrupt: print_debug("You sent a CTRL+C to interrupt the process") elapsed_minutes = time_elapsed() print_info("Prime took " + str(elapsed_minutes) + " minutes to get this far.") sys.exit(2) except: print_error(sys.exc_info()[0]) print_error(traceback.format_exc()) elapsed_minutes = time_elapsed() print_info("Prime took " + str(elapsed_minutes) + " minutes to get this far.") sys.exit(2)