Skip to content

Commit

Permalink
correct lint format
Browse files Browse the repository at this point in the history
  • Loading branch information
bobfantansy committed Jul 17, 2023
1 parent ae5ba58 commit 94b485c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.pyc
.venv/
*.swp
*.lock
*.log
Expand Down
22 changes: 9 additions & 13 deletions sql/engines/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,14 @@ def __init__(self, instance=None):
self.mode = instance.mode
self.awsSecretId = instance.awsSecretId
self.is_ssl = instance.is_ssl

if not self.awsSecretId == None and self.awsSecretId.strip():
client = boto3.client('secretsmanager')
response = client.get_secret_value(
SecretId=self.awsSecretId
)
secret = json.loads(response['SecretString'])
client = boto3.client("secretsmanager")
response = client.get_secret_value(SecretId=instance.awsSecretId)
secret = json.loads(response["SecretString"])
self.user = secret["username"]
self.password = secret["password"]

# 判断如果配置了隧道则连接隧道,只测试了MySQL
if self.instance.tunnel:
self.ssh = SSHConnection(
Expand Down Expand Up @@ -74,13 +72,11 @@ def remote_instance_conn(self, instance=None):
self.remote_port = instance.port
self.remote_user = instance.user
self.remote_password = instance.password

if not instance.awsSecretId == None and instance.awsSecretId.strip():
client = boto3.client('secretsmanager')
response = client.get_secret_value(
SecretId=instance.awsSecretId
)
secret = json.loads(response['SecretString'])
client = boto3.client("secretsmanager")
response = client.get_secret_value(SecretId=instance.awsSecretId)
secret = json.loads(response["SecretString"])
self.remote_user = secret["username"]
self.remote_password = secret["password"]

Expand Down
4 changes: 3 additions & 1 deletion sql/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,9 @@ class Instance(models.Model):
"Oracle service name", max_length=50, null=True, blank=True
)
sid = models.CharField("Oracle sid", max_length=50, null=True, blank=True)
awsSecretId = models.CharField("AWS Secret Id", max_length=50, null=True, blank=True)
awsSecretId = models.CharField(
"AWS Secret Id", max_length=50, null=True, blank=True
)
resource_group = models.ManyToManyField(
ResourceGroup, verbose_name="资源组", blank=True
)
Expand Down

0 comments on commit 94b485c

Please sign in to comment.