def __init__(self): try: self.sys_config = SysConfig().sys_config self.inception_host = self.sys_config.get('inception_host') if self.sys_config.get('inception_port'): self.inception_port = int( self.sys_config.get('inception_port')) else: self.inception_port = 6669 self.inception_remote_backup_host = self.sys_config.get( 'inception_remote_backup_host') if self.sys_config.get('inception_remote_backup_port'): self.inception_remote_backup_port = int( self.sys_config.get('inception_remote_backup_port')) else: self.inception_remote_backup_port = 3306 self.inception_remote_backup_user = self.sys_config.get( 'inception_remote_backup_user') self.inception_remote_backup_password = self.sys_config.get( 'inception_remote_backup_password') self.prpCryptor = Prpcrypt() except AttributeError as a: print("Error: %s" % a) except ValueError as v: print("Error: %s" % v)
def __init__(self): prpCryptor = Prpcrypt() try: auth = AliyunAccessKey.objects.filter(is_enable=1) ak = prpCryptor.decrypt(auth[0].ak) secret = prpCryptor.decrypt(auth[0].secret) except Exception: logger.error('没有找到有效的ak信息!') else: self.clt = client.AcsClient(ak=ak, secret=secret)
def __init__(self): prpCryptor = Prpcrypt() auth = AliyunAccessKey.objects.filter(is_enable=1) try: ak = prpCryptor.decrypt(auth[0].ak) secret = prpCryptor.decrypt(auth[0].secret) except Exception: ak = '' secret = '' self.clt = client.AcsClient(ak=ak, secret=secret)
def getMasterConnStr(instance_name): listMasters = Instance.objects.filter(instance_name=instance_name) masterHost = listMasters[0].host masterPort = listMasters[0].port masterUser = listMasters[0].user masterPassword = Prpcrypt().decrypt(listMasters[0].password) dictConn = {'masterHost': masterHost, 'masterPort': masterPort, 'masterUser': masterUser, 'masterPassword': masterPassword} return dictConn
def getMasterConnStr(clusterName): listMasters = MasterConfig.objects.filter(cluster_name=clusterName) masterHost = listMasters[0].master_host masterPort = listMasters[0].master_port masterUser = listMasters[0].master_user masterPassword = Prpcrypt().decrypt(listMasters[0].master_password) dictConn = { 'masterHost': masterHost, 'masterPort': masterPort, 'masterUser': masterUser, 'masterPassword': masterPassword } return dictConn
def __init__(self): self.sys_config = SysConfig().sys_config self.inception_host = self.sys_config.get('inception_host') if self.sys_config.get('inception_port'): self.inception_port = int(self.sys_config.get('inception_port')) else: self.inception_port = 6669 self.inception_remote_backup_host = self.sys_config.get('inception_remote_backup_host') if self.sys_config.get('inception_remote_backup_port'): self.inception_remote_backup_port = int(self.sys_config.get('inception_remote_backup_port')) else: self.inception_remote_backup_port = 3306 self.inception_remote_backup_user = self.sys_config.get('inception_remote_backup_user') self.inception_remote_backup_password = self.sys_config.get('inception_remote_backup_password') self.prpCryptor = Prpcrypt()
from sql.utils.permission import superuser_required from sql.utils.jobs import job_info, del_sqlcronjob, add_sqlcronjob from .models import Users, SqlWorkflow, QueryPrivileges, SqlGroup, \ QueryPrivilegesApply, Config from sql.utils.workflow import Workflow from sql.utils.execute_sql import execute_call_back, execute_skipinc_call_back from sql.utils.sql_review import getDetailUrl, can_execute, can_timingtask, can_cancel from .const import Const, WorkflowDict from sql.utils.group import user_groups, user_instances import logging logger = logging.getLogger('default') prpCryptor = Prpcrypt() workflowOb = Workflow() # 登录 def login(request): return render(request, 'login.html') # 退出登录 def sign_out(request): logout(request) return HttpResponseRedirect(reverse('sql:login')) # 注册用户
def save(self, *args, **kwargs): pc = Prpcrypt() # 初始化 self.master_password = pc.encrypt(self.master_password) super(MasterConfig, self).save(*args, **kwargs)
def save(self, *args, **kwargs): pc = Prpcrypt() # 初始化 self.ak = pc.encrypt(self.ak) self.secret = pc.encrypt(self.secret) super(AliyunAccessKey, self).save(*args, **kwargs)
def save(self, *args, **kwargs): pc = Prpcrypt() # 初始化 self.slave_password = pc.encrypt(self.slave_password) super(SlaveConfig, self).save(*args, **kwargs)
def save(self, *args, **kwargs): pc = Prpcrypt() # 初始化 self.password = pc.encrypt(self.password) super(Instance, self).save(*args, **kwargs)